Skip to content

Commit d764ee4

Browse files
committed
first version of traefik setup and deploy to containers-dev
1 parent fcea810 commit d764ee4

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build and Deploy (Docker Linux) - Development
2+
on:
3+
workflow_dispatch:
4+
5+
env:
6+
REMOTE_HOST: containers-dev.library.illinois.edu
7+
REMOTE_USER: container-user
8+
COMPOSE_FILE: docker-compose-traefik.yml
9+
REMOTE_PATH: /home/container-user/getmarc-dev
10+
11+
#Environment Specific
12+
FQDN: getmarc-dev.library.illinois.edu
13+
14+
jobs:
15+
deploy:
16+
runs-on: [self-hosted, linux]
17+
environment:
18+
name: development
19+
url: https://${{ env.FQDN }}
20+
steps:
21+
- name: Checkout the repo
22+
uses: actions/checkout@v2
23+
24+
- name: Make api.cfg file
25+
run: |
26+
echo "[ALMA_API]" > ./api.cfg
27+
echo "API_DOMAIN=${{ vars.API_DOMAIN }}" >> ./api.cfg
28+
echo "API_KEY=${{ secrets.API_KEY }}" >> ./api.cfg
29+
30+
- name: rsync deployments
31+
uses: burnett01/[email protected]
32+
with:
33+
switches: -avzr --delete --exclude public/system/imports
34+
path: .
35+
remote_path: "${{ env.REMOTE_PATH }}"
36+
remote_host: "${{ env.REMOTE_HOST }}"
37+
remote_user: "${{ env.REMOTE_USER }}"
38+
remote_key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }}
39+
40+
- name: Update containers
41+
uses: fifsky/ssh-action@master
42+
with:
43+
command: |
44+
cd "${{ env.REMOTE_PATH }}"
45+
docker compose -f "${{ env.COMPOSE_FILE }}" build --no-cache
46+
docker compose -f "${{ env.COMPOSE_FILE }}" up --force-recreate --pull always -d
47+
host: "${{ env.REMOTE_HOST }}"
48+
user: "${{ env.REMOTE_USER }}"
49+
key: "${{ secrets.DOCKER_SSH_PRIVATE_KEY }}"

docker-compose-traefik.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
services:
2+
getmarc:
3+
build:
4+
context: .
5+
args:
6+
- FQDN=${FQDN}
7+
- BACKEND_SERVICE=${BACKEND_SERVICE}
8+
- ENTITY_ID=${ENTITY_ID}
9+
restart: unless-stopped
10+
networks:
11+
- proxy
12+
- default
13+
healthcheck:
14+
test: ["CMD", "curl", "-f", "http://localhost:5000"]
15+
interval: 1m30s
16+
timeout: 10s
17+
retries: 3
18+
labels:
19+
- "traefik.enable=true"
20+
- "traefik.docker.network=proxy"
21+
- "traefik.http.routers.getmarc-secure.rule=Host(`${FQDN}`)"
22+
- "traefik.http.routers.getmarc-secure.entrypoints=websecure"
23+
- "traefik.http.routers.getmarc.tls=true"
24+
- "traefik.http.services.getmarc.loadbalancer.server.port=443"
25+
- "traefik.http.services.getmarc.loadbalancer.server.scheme=https"
26+
- "traefik.http.services.getmarc.loadbalancer.serversTransport=${TRAEFIK_SERVER_TRANSPORT}"
27+
- "traefik.http.routers.getmarc-secure.middlewares=campus-ips-whitelist@file"
28+
29+
networks:
30+
proxy:
31+
external: true

docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
getmarc:
3+
build: .
4+
ports:
5+
- "5000:5000"

0 commit comments

Comments
 (0)