Skip to content

Feature/docker compose#4

Open
AlcibiadesCleinias wants to merge 21 commits intoArkadyBuryakov:mainfrom
AlcibiadesCleinias:feature/docker-compose
Open

Feature/docker compose#4
AlcibiadesCleinias wants to merge 21 commits intoArkadyBuryakov:mainfrom
AlcibiadesCleinias:feature/docker-compose

Conversation

@AlcibiadesCleinias
Copy link
Copy Markdown

@AlcibiadesCleinias AlcibiadesCleinias commented Sep 9, 2021

Hey, Arkady

The PR was started from my desire to add a simple compose file, and I am deept in refactoring a bit. Thus:

  • add compose file: so db + bot starts with 1 click
  • add an entrypoint for a Dockerfile: it checks that Postgres is running (if proper settings in .env)
  • rename some constants to uppercase
  • move code into src, so we have different layers: layers of orchestrator (docker-compose) with docs, git/github files, useful db scripts (database) then layer with code (i.e. src/)
  • move models (tables) in models.py
  • add kinda first migration to the app: table initiation (as it should be, coz run primitively SQL query - seems not a good approach to make a 1st migration, i.e. app tables initiation)
  • as well to the above: take a note that for migration history and sqlalchemy we should use https://alembic.sqlalchemy.org/

@AlcibiadesCleinias
Copy link
Copy Markdown
Author

If you accept the changes: squash commits pls, ofc

Comment thread src/main.py
# the easiest way to create tables
# but better to use https://alembic.sqlalchemy.org/
# so, it store migration story as well
Base.metadata.create_all(bind=engine)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Base.metadata.create_all() should be used only in cases when you start with new database.

If you have a database with active strategies and different version of models.py - main.py will return Error on this step and won't run.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

no, it depends on if you create tables yourself with meta that differ from declared in models

Comment thread docker-compose.yml Outdated

x-app: &general-settings
networks:
- volatabot-test-net
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

volatabot -> volatobot :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

)

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.

2 participants