Refactor makefile to separate loadenvs command in deploy-test target

This commit is contained in:
2024-06-04 19:38:27 +08:00
parent bf693e7236
commit 8df524c9d5
2 changed files with 54 additions and 36 deletions
+31 -10
View File
@@ -14,15 +14,32 @@ pull:
@echo "Pulling the project..." @echo "Pulling the project..."
git pull git pull
deploy-core: pull
{ \
echo "Deploying the core stack..." ;\
set -a ;\
. ./swarm/.env ;\
set +a ;\
docker stack deploy --compose-file ./swarm/core.yml core ;\
}
deploy-services: pull deploy-services: pull
@echo "Deploying the services stack..." { \
$(loadenvs ./swarm/.env) echo "Deploying the services stack..." ;\
docker stack deploy --compose-file ./swarm/services.yml services set -a ;\
. ./swarm/.env ;\
set +a ;\
docker stack deploy --compose-file ./swarm/services.yml services ;\
}
deploy-apps: pull deploy-apps: pull
@echo "Deploying the apps stack..." { \
$(loadenvs ./swarm/.env) echo "Deploying the apps stack..." ;\
docker stack deploy --compose-file ./swarm/apps.yml apps set -a ;\
. ./swarm/.env ;\
set +a ;\
docker stack deploy --compose-file ./swarm/apps.yml apps ;\
}
deploy-ghost: pull deploy-ghost: pull
{ \ { \
@@ -33,8 +50,12 @@ deploy-ghost: pull
docker stack deploy --compose-file ./swarm/ghost.yml ghost ;\ docker stack deploy --compose-file ./swarm/ghost.yml ghost ;\
} }
deploy-test: pull deploy-thelounge: pull
@echo "Deploying the test stack..." { \
$(loadenvs ./swarm/.env) echo "Deploying the thelounge stack..." ;\
docker stack deploy --compose-file ./swarm/thelounge.yml thelounge set -a ;\
. ./swarm/.env ;\
set +a ;\
docker stack deploy --compose-file ./swarm/thelounge.yml thelounge ;\
}
# git submodule update --init --recursive # git submodule update --init --recursive
+23 -26
View File
@@ -5,12 +5,12 @@ x-environment: &app-environment
STREAMLIT_BAI_SERVER_PORT: 8502 STREAMLIT_BAI_SERVER_PORT: 8502
GROQ_API_KEY: "${GROQ_API_KEY}" GROQ_API_KEY: "${GROQ_API_KEY}"
volumes: # volumes:
bai_cache: {} # bai_cache: {}
jellyfin_config: {} # jellyfin_config: {}
jellyfin_cache: {} # jellyfin_cache: {}
pgadmin: {} # adminer_data: {}
privatebin_data: {} # privatebin_data: {}
networks: networks:
traefik-public: traefik-public:
@@ -28,7 +28,7 @@ services:
TZ: Asia/Singapore TZ: Asia/Singapore
DOMAIN: ${DOMAIN} DOMAIN: ${DOMAIN}
volumes: volumes:
- pgadmin:/var/lib/pgadmin - /var/data/adminer_data:/var/lib/pgadmin
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- postgres_db - postgres_db
@@ -91,8 +91,8 @@ services:
- DOMAIN=${DOMAIN} - DOMAIN=${DOMAIN}
- JELLYFIN_PublishedServerUrl=https://media.${DOMAIN} - JELLYFIN_PublishedServerUrl=https://media.${DOMAIN}
volumes: volumes:
- jellyfin_config:/config - /var/data/jellyfin_config:/config
- jellyfin_cache:/cache - /var/data/jellyfin_cache:/cache
- type: bind - type: bind
source: ~/media source: ~/media
target: /media target: /media
@@ -101,10 +101,10 @@ services:
networks: networks:
- traefik-public - traefik-public
deploy: deploy:
placement: # placement:
constraints: # constraints:
- node.labels.jellyfin.jellyfin_config == true # - node.labels.jellyfin.jellyfin_config == true
- node.labels.jellyfin.jellyfin_cache == true # - node.labels.jellyfin.jellyfin_cache == true
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.docker.network=traefik-public - traefik.docker.network=traefik-public
@@ -138,16 +138,16 @@ services:
image: privatebin/nginx-fpm-alpine:latest image: privatebin/nginx-fpm-alpine:latest
read_only: true read_only: true
volumes: volumes:
- privatebin_data:/srv/data # data volume for pastes allows pastes - /var/data/privatebin_data:/srv/data # data volume for pastes allows pastes
# to persist after container stop or restart # to persist after container stop or restart
- "~/config/conf.php:/srv/cfg/conf.php:ro" # second volume for custom configuration file - "/var/data/config/conf.php:/srv/cfg/conf.php:ro" # second volume for custom configuration file
restart: unless-stopped restart: unless-stopped
networks: networks:
- traefik-public - traefik-public
deploy: deploy:
placement: # placement:
constraints: # constraints:
- node.labels.privatebin.privatebin_data == true # - node.labels.privatebin.privatebin_data == true
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.docker.network=traefik-public - traefik.docker.network=traefik-public
@@ -165,13 +165,10 @@ services:
restart: unless-stopped restart: unless-stopped
command: streamlit run --server.port=$STREAMLIT_BAI_SERVER_PORT --server.address=0.0.0.0 --server.baseUrlPath=$BAI_LOCATION src/app.py command: streamlit run --server.port=$STREAMLIT_BAI_SERVER_PORT --server.address=0.0.0.0 --server.baseUrlPath=$BAI_LOCATION src/app.py
volumes: volumes:
- bai_cache:/app/cache - /var/data/bai_cache:/app/cache
networks: networks:
- traefik-public - traefik-public
deploy: deploy:
# placement:
# constraints:
# - node.labels.bai.bai_cache == true
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.docker.network=traefik-public - traefik.docker.network=traefik-public
@@ -204,13 +201,13 @@ services:
image: nginx:alpine image: nginx:alpine
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ~/site:/usr/share/nginx/html:ro - var/data/site:/usr/share/nginx/html:ro
networks: networks:
- traefik-public - traefik-public
deploy: deploy:
placement: # placement:
constraints: # constraints:
- node.labels.site.site_server == true # - node.labels.site.site_server == true
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.docker.network=traefik-public - traefik.docker.network=traefik-public