Skip to content

Reorganizing project structure - #819

Draft
bradchoate wants to merge 4 commits into
masterfrom
reorg-plus-alpine
Draft

Reorganizing project structure#819
bradchoate wants to merge 4 commits into
masterfrom
reorg-plus-alpine

Conversation

@bradchoate

Copy link
Copy Markdown
Collaborator

Placing most source files under web/ and worker-specific source files under worker/ and test-specific source files under test/.

Replaced base Docker image with python:alpine for web and worker images. Moved nginx to a separate image, which will now be used for running locally and in production via docker compose.

Placing most source files under web/ and worker-specific
source files under worker/ and test-specific source files
under test/.

Replaced base Docker image with python:alpine for web and
worker images. Moved nginx to a separate image, which will
now be used for running locally and in production via
docker compose.
@bradchoate
bradchoate requested review from dphiffer and snark February 17, 2025 04:59
@bradchoate

Copy link
Copy Markdown
Collaborator Author

Still in draft at the moment, but looking to swap out our base image with python3:alpine instead of using ubuntu. Much smaller footprint for our images, which makes for faster builds and deploys. Last execution of the test pipeline prior to this PR took 2m50s. This branch's run completed in 1m32s.

Image size for mltshp/mltshp-web:latest for linux/amd64 is 911mb on disk, 325mb compressed. The alpine edition is 275mb on disk, and only 72mb compressed.

@bradchoate

Copy link
Copy Markdown
Collaborator Author

To follow the reorganization aspect of this change, it would be easier to take a look at the branch file listing. Notably, all the source code for the tornado app has been moved into a "web" directory. The unique files for workers are now in a "worker" directory. I also relocated the tests into a "test" directory (including a test.py module that was in the root).

Since this repo produces "web" and "worker" Docker images, it made sense to me to segment those into separate folders. It also gave me the opportunity to streamline the contents of those images. Before, we were producing near identical Docker images for both. Main difference being the installation of nginx for the web image, and configuration for supervisor was different in terms of running nginx instances and the tornado app versus running celery and cron. But all the Python code was included in both images. They should include only the files needed for their operation.

The other change was to move the nginx and fakes3 docker files to separate Github repos, so we can build those independently, and simply reference them via Docker compose. I'll have to adjust the web servers to run via the compose file instead of running the image directly. A big advantage to using Alpine for building nginx is that the upload module we utilize is available as an Alpine package, so we no longer have to build nginx from source.

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.

1 participant