Skip to content

Commit

Permalink
refactor: docker-compose supports shorter filename
Browse files Browse the repository at this point in the history
  • Loading branch information
azzamsa committed Jun 12, 2024
1 parent 46e9337 commit 418d2a6
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ configs
.env
CHANGELOG.md
README.md
docker-compose.example.yml
compose.example.yml

# Container Data
cdata
2 changes: 1 addition & 1 deletion .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ APP_ENV='dev'
APP_BASE_URL='127.0.0.1'
PORT='8001'
SCHEMA_LOCATION='tests/schema.graphql'
DATABASE_URL='postgres://durin:SpeakFriendAndEnter@127.0.0.1:5432/tin'
DATABASE_URL='postgres://gandalf:SpeakFriendAndEnter@127.0.0.1:5432/tin'
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ jobs:
env:
PGPASSWORD: secret
run: |
docker-compose --file ./tests/docker-compose.yml run --detach -p 5432:5432 --name postgres_db postgres_db
docker-compose --file ./tests/compose.yml run --detach -p 5432:5432 --name postgres_db postgres_db
# Wait until the DB is up
docker exec postgres_db bash -c "until pg_isready; do sleep 1; done"
# Check DB version
docker exec postgres_db psql -h localhost -p 5432 -U durin --version
docker exec postgres_db psql -h localhost -p 5432 -U gandalf --version
- name: Show version information
shell: bash
Expand All @@ -84,7 +84,7 @@ jobs:
- name: Run tests
env:
DATABASE_URL: postgres://durin:SpeakFriendAndEnter@localhost:5432/tin
DATABASE_URL: postgres://gandalf:SpeakFriendAndEnter@localhost:5432/tin
run: just test

build:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ And, enjoy :)
$ # Clone the repository

$ # Run the database
$ podman-compose -f docker-compose.local.yml up db -d
$ podman-compose -f compose.local.yml up db -d

$ touch $SCHEMA_LOCATION # See .example.env
$ just dev # See also `just setup`
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.local.yml → compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ services:
- APP_ENV=dev
- APP_BASE_URL=0.0.0.0
- PORT=8001
- DATABASE_URL=postgres://durin:SpeakFriendAndEnter@db/tin
- DATABASE_URL=postgres://gandalf:SpeakFriendAndEnter@db/tin

db:
image: docker.io/postgres:15
image: docker.io/postgres:16
restart: always
ports:
- 5432:5432
volumes:
# Use `:Z` in SELinux-enabled disro.
- ./cdata/db:/var/lib/postgresql/data/:Z
environment:
POSTGRES_USER: durin
POSTGRES_USER: gandalf
POSTGRES_PASSWORD: SpeakFriendAndEnter
POSTGRES_DB: tin
2 changes: 1 addition & 1 deletion docs/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```bash
$ # start the container database
$ podman-compose -f docker-compose.local.yml up db -d
$ podman-compose -f compose.local.yml up db -d

$ # start the backend in host
$ # you need to prepare the .env. Otherwise, start it in container. See "Configure Environment Variables"
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ image-build:

# Run the container.
image-start service="":
podman-compose --file docker-compose.local.yml up {{ service }} -d
podman-compose --file compose.local.yml up {{ service }} -d

# Stop the container.
image-stop:
podman-compose --file docker-compose.local.yml down
podman-compose --file compose.local.yml down

# Restart the containers.
image-restart:
Expand Down
4 changes: 2 additions & 2 deletions tests/docker-compose.yml → tests/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ version: "3"
services:

postgres_db:
image: postgres:15
image: postgres:16
ports:
- 5432
environment:
POSTGRES_USER: durin
POSTGRES_USER: gandalf
POSTGRES_PASSWORD: SpeakFriendAndEnter
POSTGRES_DB: tin

0 comments on commit 418d2a6

Please sign in to comment.