Skip to content

Commit

Permalink
fix chown (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
khanzadimahdi committed Jan 3, 2025
1 parent d3bc4ca commit 1b460b8
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 37 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/infrastructure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,13 @@ jobs:
sudo mkdir -p $VOLUME_PATH/mongodb/db
sudo mkdir -p $VOLUME_PATH/mongodb/configdb
sudo mkdir -p $VOLUME_PATH/nats
sudo chown -R ${{ secrets.EC2_SSH_USER }}:${{ secrets.EC2_SSH_USER }} $VOLUME_PATH/*
EOF
# Copy files
scp -q -i ~/ec2-key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r ./* $EC2_SSH_ENDPOINT:/opt/deployment/ > /dev/null 2>&1
# Connect and deploy services
ssh -q -i ~/ec2-key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $EC2_SSH_ENDPOINT > /dev/null 2>&1 << 'EOF'
ssh -q -i ~/ec2-key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $EC2_SSH_ENDPOINT << 'EOF'
export VOLUME_PATH="${{ secrets.VOLUME_PATH }}"
export MONGO_USERNAME="${{ secrets.MONGO_USERNAME }}"
Expand Down Expand Up @@ -183,12 +182,12 @@ jobs:
# Run Docker Compose
cd /opt/deployment/
docker stack deploy -c compose.mongodb.yaml mongodb --detach=true
docker stack deploy -c compose.mongodb_dashboard.yaml mongodb_dashboard --detach=true
docker stack deploy -c compose.nats.yaml nats --detach=true
docker stack deploy -c compose.docker.yaml docker --detach=true
docker stack deploy -c compose.docker_dashboard.yaml docker_dashboard --detach=true
docker stack deploy -c compose.backend.yaml backend --detach=true
docker stack deploy -c compose.frontend.yaml frontend --detach=true
docker stack deploy -c compose.proxy.yaml proxy --detach=true
docker compose -f compose.mongodb.yaml --project-name mongodb up --pull always --detach
docker compose -f compose.mongodb_dashboard.yaml --project-name mongodb_dashboard up --pull always --detach
docker compose -f compose.nats.yaml --project-name nats up --pull always --detach
docker compose -f compose.docker.yaml --project-name docker up --pull always --detach
docker compose -f compose.docker_dashboard.yaml --project-name docker_dashboard up --pull always --detach
docker compose -f compose.app.yaml --project-name app up --pull always --detach
docker compose -f compose.frontend.yaml --project-name frontend up --pull always --detach
docker compose -f compose.proxy.yaml --project-name proxy up --pull always --detach
EOF
32 changes: 16 additions & 16 deletions infrastructure/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@ ssh:
ssh -i "ssh-private-key.pem" ${EC2_SSH_ENDPOINT}

up:
docker stack deploy -c compose.mongodb.yaml mongodb --detach=false
docker stack deploy -c compose.mongodb_dashboard.yaml mongodb_dashboard --detach=false
docker stack deploy -c compose.nats.yaml nats --detach=false
docker stack deploy -c compose.docker.yaml docker --detach=false
docker stack deploy -c compose.docker_dashboard.yaml docker_dashboard --detach=false
docker stack deploy -c compose.backend.yaml backend --detach=false
docker stack deploy -c compose.frontend.yaml frontend --detach=false
docker stack deploy -c compose.proxy.yaml proxy --detach=false
docker compose -f compose.mongodb.yaml --project-name mongodb up --pull always --detach
docker compose -f compose.mongodb_dashboard.yaml --project-name mongodb_dashboard up --pull always --detach
docker compose -f compose.nats.yaml --project-name nats up --pull always --detach
docker compose -f compose.docker.yaml --project-name docker up --pull always --detach
docker compose -f compose.docker_dashboard.yaml --project-name docker_dashboard up --pull always --detach
docker compose -f compose.app.yaml --project-name app up --pull always --detach
docker compose -f compose.frontend.yaml --project-name frontend up --pull always --detach
docker compose -f compose.proxy.yaml --project-name proxy up --pull always --detach

down:
docker stack rm proxy
docker stack rm frontend
docker stack rm backend
docker stack rm docker_dashboard
docker stack rm docker
docker stack rm nats
docker stack rm mongodb_dashboard
docker stack rm mongodb
docker compose -f compose.frontend.yaml --project-name frontend down --volumes --remove-orphans
docker compose -f compose.app.yaml --project-name app down --volumes --remove-orphans
docker compose -f compose.proxy.yaml --project-name proxy down --volumes --remove-orphans
docker compose -f compose.nats.yaml --project-name nats down --volumes --remove-orphans
docker compose -f compose.docker_dashboard.yaml --project-name docker_dashboard down --volumes --remove-orphans
docker compose -f compose.docker.yaml --project-name docker down --volumes --remove-orphans
docker compose -f compose.mongodb_dashboard.yaml --project-name mongodb_dashboard down --volumes --remove-orphans
docker compose -f compose.mongodb.yaml --project-name mongodb down --volumes --remove-orphans
1 change: 0 additions & 1 deletion infrastructure/compose.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ services:
networks:
app:
name: app
driver: overlay
mongodb:
name: mongodb
external: true
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/compose.docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ services:
delay: 5s
max_attempts: 3
runtime: sysbox-runc
# privileged: true # To test localy: enable this line and disable runtime
environment:
DOCKER_TLS_CERTDIR: "" # disable certs

networks:
docker:
name: docker
driver: overlay
1 change: 0 additions & 1 deletion infrastructure/compose.docker_dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ services:
networks:
docker_dashboard:
name: docker_dashboard
driver: overlay
docker:
name: docker
external: true
1 change: 0 additions & 1 deletion infrastructure/compose.frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ services:
networks:
frontend:
name: frontend
driver: overlay
app:
name: app
external: true
1 change: 0 additions & 1 deletion infrastructure/compose.mongodb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ services:
networks:
mongodb:
name: mongodb
driver: overlay
3 changes: 0 additions & 3 deletions infrastructure/compose.mongodb_dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ services:
condition: on-failure
delay: 5s
max_attempts: 3
depends_on:
- mongodb
environment:
ME_CONFIG_BASICAUTH_USERNAME: ${DASHBOARD_MONGO_USERNAME}
ME_CONFIG_BASICAUTH_PASSWORD: ${DASHBOARD_MONGO_PASSWORD}
Expand All @@ -22,7 +20,6 @@ services:
networks:
mongodb_dashboard:
name: mongodb_dashboard
driver: overlay
mongodb:
name: mongodb
external: true
3 changes: 1 addition & 2 deletions infrastructure/compose.nats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ services:
delay: 5s
max_attempts: 3
volumes:
- ${VOLUME_PATH}/nats:/jetstream
- ${VOLUME_PATH}/nats:/data
command: ["--jetstream", "--http_port", "8222", "--port", "4222", "--store_dir", "/data"]

networks:
nats:
name: nats
driver: overlay
1 change: 0 additions & 1 deletion infrastructure/compose.proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ services:
networks:
proxy:
name: proxy
driver: overlay
frontend:
name: frontend
external: true
Expand Down

0 comments on commit 1b460b8

Please sign in to comment.