Skip to content

Commit

Permalink
add test-docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchin committed Jan 25, 2024
1 parent 3814772 commit d1c740a
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 29 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build-and-push-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,23 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push GWS amd64
if: false
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/gws-amd64/Dockerfile
push: true
platforms: linux/amd64
provenance: false
tags: gplates/gws:amd64-${{github.ref_name}}
-
name: Build and push GWS arm64
if: false
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/gws-arm64/Dockerfile
push: true
platforms: linux/arm64
provenance: false
tags: gplates/gws:arm64-${{github.ref_name}}
-
name: Build and push PostGIS amd64
Expand All @@ -66,5 +68,5 @@ jobs:
name: Create cross-platform images
run: |
docker buildx imagetools create -t gplates/postgis:${{github.ref_name}} gplates/postgis:amd64-${{github.ref_name}} gplates/postgis:arm64-${{github.ref_name}}
# docker buildx imagetools create -t gplates/gws:${{github.ref_name}} gplates/gws:amd64-${{github.ref_name}} gplates/gws:arm64-${{github.ref_name}}
docker buildx imagetools create -t gplates/gws:${{github.ref_name}} gplates/gws:amd64-${{github.ref_name}} gplates/gws:arm64-${{github.ref_name}}
33 changes: 33 additions & 0 deletions .github/workflows/test-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test Docker Compose

on:
release:
types: [published]

jobs:
test-docker-compose:
runs-on: ubuntu-latest

steps:
-
name: Start Docker compose
run: |
cd docker
docker-compose up -d
-
name: Sleep for 30 seconds
run: sleep 30s
shell: bash
-
name: Check Docker compose
if: always()
run: |
docker ps
docker network ls
docker inspect gws -f "{{json .NetworkSettings.Networks }}"
wget http://localhost:18000
curl --fail -s http://localhost:18000/raster/query?lon=128.86&lat=-12.42&raster_name=crustal_thickness
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,30 @@ jobs:
if: always()
run: |
docker exec gws cat /var/log/apache2/error.log
test-docker-compose:
runs-on: ubuntu-latest

steps:
-
name: Start Docker compose
run: |
cd docker
docker-compose up -d
-
name: Sleep for 30 seconds
run: sleep 30s
shell: bash
-
name: Check Docker compose
if: always()
run: |
docker ps
docker network ls
docker inspect gws -f "{{json .NetworkSettings.Networks }}"
wget http://localhost:18000
curl --fail -s http://localhost:18000/raster/query?lon=128.86&lat=-12.42&raster_name=crustal_thickness
65 changes: 65 additions & 0 deletions docker/docker-compose-mc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This is for Michael Chin only...
version: '3.9'

volumes:
gws-code:
external: true
name: gws-code
gws-db-data:
external: true
name: gws-db-data-new

services:
gws-postgis:
image: gplates/postgis
networks:
- gws-net
hostname: gws-postgis
volumes:
- gws-db-data:/var/lib/postgresql/15/main
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD="this is not a real password! go away!"
restart: on-failure
healthcheck:
test: pg_isready -U gplates -d gplates
interval: 1m30s
timeout: 10s
retries: 3

gws:
image: gplates/gws
networks:
- gws-net
hostname: gws
depends_on:
- gws-postgis
- gws-redis
volumes:
- gws-code:/gws
ports:
- 18000:80
restart: on-failure
healthcheck:
test: curl --fail -s "http://localhost:80/raster/query?lon=128.86&lat=-12.42&raster_name=crustal_thickness" || exit 1
interval: 1m30s
timeout: 10s
retries: 3

gws-redis:
image: redis
networks:
- gws-net
hostname: gws-redis
restart: on-failure
healthcheck:
test: redis-cli -h gws-redis ping
interval: 1m30s
timeout: 10s
retries: 3


networks:
gws-net:
external: true
24 changes: 0 additions & 24 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
version: '3.9'

volumes:
gws-code:
external: true
name: gws-code
gws-db-data:
external: true
name: gws-db-data-new

services:
gws-postgis:
image: gplates/postgis
networks:
- gws-net
hostname: gws-postgis
volumes:
- gws-db-data:/var/lib/postgresql/15/main
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD="this is not a real password! go away!"
restart: on-failure
Expand All @@ -29,14 +15,10 @@ services:

gws:
image: gplates/gws
networks:
- gws-net
hostname: gws
depends_on:
- gws-postgis
- gws-redis
volumes:
- gws-code:/gws
ports:
- 18000:80
restart: on-failure
Expand All @@ -48,8 +30,6 @@ services:

gws-redis:
image: redis
networks:
- gws-net
hostname: gws-redis
restart: on-failure
healthcheck:
Expand All @@ -58,7 +38,3 @@ services:
timeout: 10s
retries: 3


networks:
gws-net:
external: true
2 changes: 1 addition & 1 deletion docker/gws-amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ RUN pip3 install plate-model-manager --upgrade
RUN pip3 install redis

ADD . /gws

RUN mv /gws/django/GWS/env.template /gws/django/GWS/.env
RUN pmm download all /gws/django/GWS/data/model-repo/

# Add Tini
Expand Down
2 changes: 1 addition & 1 deletion docker/gws-arm64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ RUN pip3 install plate-model-manager --upgrade
RUN pip3 install redis

ADD . /gws

RUN mv /gws/django/GWS/env.template /gws/django/GWS/.env
RUN pmm download all /gws/django/GWS/data/model-repo/

# Add Tini
Expand Down

0 comments on commit d1c740a

Please sign in to comment.