Merge branch 'main' of https://git.avolut.com/midsuit/wms-be
Deploy Application / deploy (push) Successful in 20s
Details
Deploy Application / deploy (push) Successful in 20s
Details
This commit is contained in:
commit
1cf875d13c
|
|
@ -7,7 +7,6 @@ DB_PASS=<your password>
|
||||||
DB_NAME=<your database name>
|
DB_NAME=<your database name>
|
||||||
DB_PORT=5432
|
DB_PORT=5432
|
||||||
|
|
||||||
NGINX_PORT=80
|
|
||||||
GOLANG_PORT=8888
|
GOLANG_PORT=8888
|
||||||
APP_ENV=localhost
|
APP_ENV=localhost
|
||||||
JWT_SECRET=<your secret key>
|
JWT_SECRET=<your secret key>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
name: Deploy Application
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup SSH
|
||||||
|
run: |
|
||||||
|
echo "Setting up SSH..."
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
echo "SSH key setup complete"
|
||||||
|
ls -la ~/.ssh/id_rsa
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
SSH_USER: ${{ secrets.SSH_USER }}
|
||||||
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||||
|
SSH_PORT: ${{ secrets.SSH_PORT }}
|
||||||
|
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
||||||
|
run: |
|
||||||
|
echo "Starting deployment..."
|
||||||
|
echo "Debug: User=$SSH_USER Host=$SSH_HOST Port=$SSH_PORT"
|
||||||
|
|
||||||
|
if [ -z "$SSH_USER" ] || [ -z "$SSH_HOST" ] || [ -z "$SSH_PORT" ]; then
|
||||||
|
echo "Error: Required SSH variables are not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEST="${SSH_USER}@${SSH_HOST}"
|
||||||
|
echo "Connecting to $DEST"
|
||||||
|
|
||||||
|
ssh -i ~/.ssh/id_rsa \
|
||||||
|
-p "${SSH_PORT}" \
|
||||||
|
-o StrictHostKeyChecking=no \
|
||||||
|
"${DEST}" \
|
||||||
|
"cd ${DEPLOY_PATH} && \
|
||||||
|
git pull && \
|
||||||
|
docker compose up -d --build"
|
||||||
|
|
@ -8,41 +8,11 @@ services:
|
||||||
- .:/app
|
- .:/app
|
||||||
ports:
|
ports:
|
||||||
- ${GOLANG_PORT:-8888}:8888
|
- ${GOLANG_PORT:-8888}:8888
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
|
|
||||||
nginx:
|
|
||||||
image: nginx:latest
|
|
||||||
container_name: ${APP_NAME:-go-gin-clean-starter}-nginx
|
|
||||||
ports:
|
|
||||||
- ${NGINX_PORT:-81}:80
|
|
||||||
volumes:
|
|
||||||
- .:/var/www/html
|
|
||||||
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
|
|
||||||
depends_on:
|
|
||||||
- app
|
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
|
|
||||||
postgres:
|
|
||||||
hostname: postgres
|
|
||||||
container_name: ${APP_NAME:-go-gin-clean-starter}-db
|
|
||||||
image: postgres:latest
|
|
||||||
ports:
|
|
||||||
- 15432:5432
|
|
||||||
volumes:
|
|
||||||
- ./docker/postgresql/tmp:/var/lib/postgresql/data
|
|
||||||
- app-data:/var/lib/postgresql/data
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER=${DB_USER}
|
|
||||||
- POSTGRES_PASSWORD=${DB_PASS}
|
|
||||||
- POSTGRES_DB=${DB_NAME}
|
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
app-data:
|
app-data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
app-network:
|
default:
|
||||||
driver: bridge
|
name: production
|
||||||
|
external: true
|
||||||
Loading…
Reference in New Issue