Update appsettings.json URLs and add CI/CD workflow for ERP Distribution
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
name: CI/CD - ERP Distribution
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- production
|
||||
types:
|
||||
- closed
|
||||
jobs:
|
||||
build-and-deploy-backend:
|
||||
name: Build & Deploy Backend
|
||||
runs-on: linux
|
||||
if: github.event.pull_request.merged == true
|
||||
steps:
|
||||
- name: Checkout code
|
||||
run: |
|
||||
git clone \
|
||||
--depth 1 \
|
||||
--branch production \
|
||||
https://oauth2:${{ secrets.DISTRIBUTION }}@gitea.hexdive.com/New_REP_SYSTEM/ERP_Distribution.git \
|
||||
.
|
||||
- name: Restore
|
||||
run: dotnet restore Distribution/Distribution.csproj
|
||||
- name: Publish
|
||||
run: |
|
||||
rm -rf /tmp/erpdistribution-deploy
|
||||
mkdir -p /tmp/erpdistribution-deploy
|
||||
dotnet publish Distribution/Distribution.csproj \
|
||||
-c Release \
|
||||
-r linux-x64 \
|
||||
--self-contained true \
|
||||
-o /tmp/erpdistribution-deploy
|
||||
- name: Stop service
|
||||
run: systemctl stop erpdistribution.service
|
||||
- name: Copy to deploy folder
|
||||
run: |
|
||||
mkdir -p /home/distribution/core/publish
|
||||
rm -rf /home/distribution/core/publish/*
|
||||
cp -r /tmp/erpdistribution-deploy/* /home/distribution/core/publish/
|
||||
- name: Fix ownership and permissions
|
||||
run: |
|
||||
chown -R distributionuser:distributionuser /home/distribution/core/publish
|
||||
find /home/distribution/core/publish -type d -exec chmod 755 {} +
|
||||
find /home/distribution/core/publish -type f -exec chmod 644 {} +
|
||||
chmod +x /home/distribution/core/publish/Distribution
|
||||
- name: Restart service
|
||||
run: systemctl restart erpdistribution.service
|
||||
- name: Verify
|
||||
run: |
|
||||
systemctl is-active erpdistribution.service && echo "✅ Service running" || echo "❌ Service failed"
|
||||
|
||||
build-and-deploy-frontend:
|
||||
name: Build & Deploy Frontend
|
||||
runs-on: linux
|
||||
if: github.event.pull_request.merged == true
|
||||
steps:
|
||||
- name: Checkout code
|
||||
run: |
|
||||
git clone \
|
||||
--depth 1 \
|
||||
--branch production \
|
||||
https://oauth2:${{ secrets.DISTRIBUTION_FE }}@gitea.hexdive.com/New_REP_SYSTEM/ERP_Distribution_FE.git \
|
||||
.
|
||||
- name: Build Docker image
|
||||
run: docker build -t erpdistributionfe:latest .
|
||||
- name: Stop & remove existing container
|
||||
run: |
|
||||
docker stop erpdistributionfe 2>/dev/null || true
|
||||
docker rm erpdistributionfe 2>/dev/null || true
|
||||
- name: Start container
|
||||
run: |
|
||||
docker run -d \
|
||||
--name erpdistributionfe \
|
||||
-p 8801:3000 \
|
||||
--restart unless-stopped \
|
||||
--memory="512m" \
|
||||
--cpus="1.0" \
|
||||
--cap-drop ALL \
|
||||
--security-opt no-new-privileges \
|
||||
erpdistributionfe:latest
|
||||
- name: Remove old images
|
||||
run: docker image prune -f
|
||||
- name: Verify
|
||||
run: |
|
||||
docker ps --filter name=erpdistributionfe --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" \
|
||||
| grep erpdistributionfe && echo "✅ Container running" || echo "❌ Container failed"
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"Urls": "http://localhost:5089",
|
||||
"Urls": "http://localhost:8802",
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=187.127.102.190;Port=3306;Database=distribution;User=kalana;Password=kalana@hexdive"
|
||||
},
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
},
|
||||
"AuthHex": {
|
||||
"BaseUrl": "http://localhost:6102"
|
||||
"BaseUrl": "http://localhost:8801"
|
||||
},
|
||||
"StoreManagement": {
|
||||
"UnverifiedKycOrderThreshold": 0
|
||||
|
||||
Reference in New Issue
Block a user