Skip to content

Commit

Permalink
docker: simplify docker-compose
Browse files Browse the repository at this point in the history
And also make it compatible with podman-compose.
Host it by default on port 8080 which can run without root privs.
Add missing copy of config.py to README.
Add missing env variable for Redis host.

Signed-off-by: Paul Spooren <[email protected]>
  • Loading branch information
aparcar committed Feb 28, 2022
1 parent abce6ed commit 11810c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 27 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ is required. Suggestions on how to improve this setup are welcome.

mkdir ./asu-service/
chmod 777 ./asu-service/
cp ./misc/config.py ./asu-service/
docker-compose up

A webserver should proxy API calls to port 8000 of the `server` service while
Expand Down
35 changes: 10 additions & 25 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,36 @@
version: "2"

services:
server:
image: aparcar/asu-server
build:
context: ./
dockerfile: Dockerfile.server
image: "aparcar/asu-server:latest"
environment:
- REDIS_HOST=redis
volumes:
- "./asu-service:/home/build/asu/"
ports:
- 8000
- "8000"
depends_on:
- redis

janitor:
image: aparcar/asu-server
build:
context: ./
dockerfile: Dockerfile.server
image: "aparcar/asu-server:latest"
environment:
- FLASK_APP=asu.asu
- REDIS_HOST=redis
command: flask janitor update
volumes:
- "./asu-service:/home/build/asu/"
depends_on:
- redis

worker:
image: aparcar/asu-worker
build:
context: ./
dockerfile: Dockerfile.worker
image: "aparcar/asu-worker:latest"
volumes:
- "./asu-service/public:/home/build/asu/public"
- "./asu-service/cache:/home/build/asu/cache"
depends_on:
- redis

worker2:
image: aparcar/asu-worker
build:
context: ./
dockerfile: Dockerfile.worker
volumes:
- "./asu-service/public:/home/build/asu/public"
- "./asu-service/cache2:/home/build/asu/cache"
depends_on:
- redis

redis:
image: "redis:alpine"

Expand All @@ -55,4 +40,4 @@ services:
- "./misc/Caddyfile:/etc/caddy/Caddyfile"
- "./asu-service:/site/"
ports:
- 80:80
- "8080:80"
5 changes: 3 additions & 2 deletions misc/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

:80 {
root * /site/
file_server browse
file_server /json/
file_server /store/
header Access-Control-Allow-Methods "POST, GET, OPTIONS"
header Access-Control-Allow-Headers "*"
header Access-Control-Allow-Origin "*"
reverse_proxy /api/* server:8000
reverse_proxy * server:8000
}

0 comments on commit 11810c5

Please sign in to comment.