Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker services #15

Merged
merged 7 commits into from
Jun 28, 2024
Merged

add docker services #15

merged 7 commits into from
Jun 28, 2024

Conversation

lfjnascimento
Copy link
Contributor

@lfjnascimento lfjnascimento commented Jun 26, 2024

Description

Add docker-compose.yml creating 3 services:

  • database service using postgresql;
  • backend service for our django app;
  • proxy service with nginx.

Related Issues

How to test it

Create secret files:

mkdir -p backend/runtime/secrets
uuidgen > backend/runtime/secrets/postgres_password_secret

Startup the services with

docker compose up --build -d

Make a request to the proxy, it should return the default Django content as we don't have any custom endpoints for now

curl http://localhost:80

@lfjnascimento lfjnascimento force-pushed the feat/add_docker_files branch 2 times, most recently from 5540160 to 16ef288 Compare June 27, 2024 16:41
@lfjnascimento lfjnascimento marked this pull request as ready for review June 27, 2024 16:42
@lfjnascimento lfjnascimento changed the title [WIP] add docker files add docker services Jun 27, 2024
@lfjnascimento lfjnascimento force-pushed the feat/add_docker_files branch 3 times, most recently from a835f45 to 95de0ce Compare June 27, 2024 17:11
@lfjnascimento lfjnascimento self-assigned this Jun 27, 2024
Copy link
Collaborator

@mari1912 mari1912 left a comment

Choose a reason for hiding this comment

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

The build is failing

Copy link
Collaborator

Choose a reason for hiding this comment

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

why we are adding this file? the poetry.toml ahould be enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is equivalent to package-lock.json, that is, it guarantees the precise installation of dependency versions, so for stability we must include it in versioning as well

@@ -9,6 +9,8 @@ readme = "README.md"
python = "^3.10"
django = "^5.0.6"
djangorestframework = "^3.15.2"
gunicorn = "^22.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we adding this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we will use gunicorn as a server for the Django application

Copy link
Collaborator

Choose a reason for hiding this comment

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

but the django already have a server I think, it's just run poetry run python3 manage.py run server

Copy link
Contributor Author

@lfjnascimento lfjnascimento Jun 28, 2024

Choose a reason for hiding this comment

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

Django server is a dev-only tool that make the development straight forward, it is not a "real server"

Copy link
Collaborator

Choose a reason for hiding this comment

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

why we don't use a .env file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, this shouldn't be here. This is a docker solution for secrets, you can read more about it in this doc

@lfjnascimento lfjnascimento force-pushed the feat/add_docker_files branch 5 times, most recently from 97941ce to 02c46bc Compare June 28, 2024 15:12
exit 0
fi

exec gunicorn kernelCI.wsgi:application "$@"
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should run django here, not gunicorn poetry run python3 manage.py run server`

@lfjnascimento lfjnascimento force-pushed the feat/add_docker_files branch from 02c46bc to 28089bb Compare June 28, 2024 17:31
@lfjnascimento lfjnascimento merged commit 28089bb into main Jun 28, 2024
@mari1912 mari1912 deleted the feat/add_docker_files branch June 28, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup docker structure
2 participants