Replies: 2 comments 3 replies
-
Hey @choinek the structure of the scripts - this is great, let's do it Makefile - ok we can have it, I'm not a big fan of- it's so much... eighties? It's great for C apps but not cool for python (at least this is just my subjective POV) But we can have it splitted as you described Other way would be to have the |
Beta Was this translation helpful? Give feedback.
2 replies
-
Update: added IDEA2 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I suggest plan as follows for running scripts:
./cli
– shortcut to scripts, e.g.,cli/celery
./scripts/run-local.sh
./scripts/run-docker.sh
./scripts/run-celery.sh
– a straightforward 1:1 redirect to Celery, enriched with-A text_extract_api.tasks
The result would be something like:
./cli celery logtool traces
.Of course, we’ll add more tools here that will also be useful for development.
Setups / Makefile
make
is a good option for installers but isn’t ideal for runtime execution. Sometimes it works, but it has the limitation of running in subshells, so you can’t fully rely on it. I’d leave basic environment setup tasks in the Makefile, while more advanced executions are moved to.sh
scripts.venv
isn’t feasible in a Makefile because every new command is a new subshell. As a result, tasks like running or fetching Python dependencies need to be extracted into scripts.Summary
scripts/...
– scripts for managing and running the application.Makefile
– basic environment configurator and initializer; it will also save basic configuration to.env
, so it doesn’t need to prompt the user every time. Instead, it will use the user’s default settings (e.g., docker/local).cli
– shortcut to scripts for developers (if we want to avoid clutter, we can add it to.gitignore
, put it inscripts
, and let developers copy it if they prefer, like me).I’m also considering replacing this extended Makefile functionality with an interactive Python CLI configurator. In this case, the Makefile would essentially be limited to:
install
– installs, validates, and prepares the basic configuration. This should be the user’s first step, and it would then hand off tosetup
.setup
– launches the interactive configurator.reset
– asks twice before resetting the environment (e.g.,.env
,.venv
, etc.).💡 IDEAS 💡
2025-01-13
[IDEA1] Python Setup
I would go with python script, because It will be much easier to maintain than bash/make (we will use make for basic install and bash for some specific tsks)
Interactive Menu:
Version Management:
Monitoring:
Configuration:
2025-01-14
[IDEA2] Only one port should be propagated to the host -
fastapi_app
.The rest of the services are just tools and not part of the core functionality.
I'll add easy access to the CLI (like cli/redis-cli which will be using under hood
docker-compose exec it...
) and remove the following from the configuration:We can also opt for a more advanced solution, as we’ll have installers that modify
docker-compose
based on templates.I’ve already implemented this approach in php-multienv-library-tester so we have a ready solution for it. In Python, this will be even easier to implement.
[IDEA3] Universalizing Dev Environment Configuration
On the last day when I spent a lot of time making adjustments to the environment, I came to a conclusion.
I believe we should universalize every operational mode in the dev environment – i.e., GPU / non-GPU / local.
Consolidation Plan
I propose consolidating everything into a single Docker Compose template configuration, which would include:
fastapi_app
: {none/gpu/no-gpu}celery_worker
: {none/gpu/no-gpu}redis
: {none/yes}ollama
: {none/gpu/no-gpu}Configuration and Installation Workflow
During installation, based on the configuration chosen by the user:
Detailed Configuration Behavior
fastapi
none127.0.0.1
with forwarded ports.celery
nonefastapi
for local operation.Redis none
.env
.fastapi
andcelery
are running on the host or in Docker.ollama
none.env
.GPU and Non-GPU Versions
Benefits of This Approach
env
).Beta Was this translation helpful? Give feedback.
All reactions