Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ jobs:
- image: docker:27.1.2
steps:
- checkout
- run:
name: Copy base docker-compose
command: |
cp ../docker-compose.base.yml ./docker-compose.base.yml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't ever work. CI is not working in scope of full_stack repo.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this caught me off guard and I haven't come up with a solution yet. But as you mentioned in another comment, having the docker-compose.yml only in the full stack repo would make it very difficult to implement proper CI and testing. It would require some bash scripts which will add extra overhead in terms of their maintenance.

- setup_remote_docker
- run:
name: Install dependencies
Expand Down
49 changes: 20 additions & 29 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
services:
db:
image: postgres
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- .:/postgres_data/ # Persist data even if container shuts down volumes
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
ports:
- "8000:8000"
depends_on:
- db
- migration
env_file:
- ./env_config/local.env
healthcheck:
test: curl -s -o /dev/null localhost:8000
interval: 3s
timeout: 5s
retries: 5
migration:
build: .
command: [ "bash", "-c", "while !</dev/tcp/db/5432; do sleep 1; done; python manage.py migrate" ]
depends_on:
- db
db:
extends:
file: ../docker-compose.base.yml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be okay approach with monorepo, but not really with current wonky git submodules approach.
Maybe it'd be better to have whole docker-compose.yml in full stack repo, but then again - CI and testing would become more complex.

service: db

web:
extends:
file: ../docker-compose.base.yml
service: web
build: .

migration:
extends:
file: ../docker-compose.base.yml
service: migration
build: .

volumes:
postgres_data:
postgres_data:

networks:
db: