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

TIED-73 | Create a production ready container #352

Merged
merged 4 commits into from
Mar 31, 2023

Conversation

charn
Copy link
Contributor

@charn charn commented Mar 30, 2023

Run backend with uWSGI on production mode without development requirements.

  • Move dev-requirement* -> requirements-dev*
  • Add uwsgi to requirements
  • Add uWSGI configuration
  • Run uWSGI from docker-entrypoint.sh
  • Add staticbuilder and production stages to the Dockerfile
  • Add ELASTICSEARCH_ANALYZER_MODE setting mainly for avoiding an error when collectstatic failed due to elasticsearch connection error.
  • compose.yml use development image and make django depend on elasticsearch

Also this PR replaces createsuperuser in docker-entrypoint.sh with a new add_admin_user command. Django's createsuperuser fails if user already exists.

@charn charn force-pushed the TIED-73-production-container branch 3 times, most recently from 00bb9a5 to 84ed00d Compare March 30, 2023 16:51
@codecov-commenter
Copy link

codecov-commenter commented Mar 30, 2023

Codecov Report

Merging #352 (690372a) into main (6d7443c) will increase coverage by 0.00%.
The diff coverage is 94.59%.

❗ Current head 690372a differs from pull request most recent head 63940d0. Consider uploading reports for the commit 63940d0 to get more accurate results

@@           Coverage Diff           @@
##             main     #352   +/-   ##
=======================================
  Coverage   93.89%   93.89%           
=======================================
  Files         149      149           
  Lines        5468     5472    +4     
=======================================
+ Hits         5134     5138    +4     
  Misses        334      334           
Impacted Files Coverage Δ
search_indices/utils.py 92.30% <90.90%> (-7.70%) ⬇️
helerm/settings.py 85.71% <100.00%> (+0.15%) ⬆️
search_indices/__init__.py 100.00% <100.00%> (+13.33%) ⬆️
search_indices/documents/action.py 100.00% <100.00%> (ø)
search_indices/documents/base.py 100.00% <100.00%> (ø)
search_indices/documents/classification.py 93.33% <100.00%> (-0.42%) ⬇️
search_indices/documents/function.py 93.33% <100.00%> (-0.42%) ⬇️
search_indices/documents/phase.py 100.00% <100.00%> (ø)
search_indices/documents/record.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@voneiden voneiden left a comment

Choose a reason for hiding this comment

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

Lets debate the get_finnish_analyzer() a bit more, my spider senses are tingling on that one.

.docker/django/.env.example Show resolved Hide resolved
search_indices/__init__.py Outdated Show resolved Hide resolved
@charn charn force-pushed the TIED-73-production-container branch from 84ed00d to 690372a Compare March 31, 2023 09:32
@charn charn requested a review from voneiden March 31, 2023 09:34
@charn charn force-pushed the TIED-73-production-container branch from 690372a to 63940d0 Compare March 31, 2023 09:36
Run backend with uWSGI on production mode without development
requirements.

- Move dev-requirement* -> requirements-dev*
- Add uwsgi to requirements
- Add uWSGI configuration
- Run uWSGI from docker-entrypoint.sh
- Add staticbuilder and production stages to the Dockerfile
- Add ELASTICSEARCH_ANALYZER_MODE setting mainly for avoiding
  an error when collectstatic failed due to elasticsearch
  connection error.
- compose.yml use development image and make django depend
  on elasticsearch

Refs TIED-73
@charn charn force-pushed the TIED-73-production-container branch 2 times, most recently from 2b743b7 to 05df603 Compare March 31, 2023 12:16
- Change isort url in pre-commit config
- Remove requirement for a specific python minor version

Refs TIED-73
@charn charn force-pushed the TIED-73-production-container branch 2 times, most recently from e761165 to b4394d5 Compare March 31, 2023 12:38
Copy link
Contributor

@voneiden voneiden left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Replace createsuperuser in docker-entrypoint.sh with the new
add_admin_user command. Default createsuperuser fails if user
already exists.

Refs TIED-73
@charn charn force-pushed the TIED-73-production-container branch from b4394d5 to 2f847a2 Compare March 31, 2023 12:55
@sonarcloud
Copy link

sonarcloud bot commented Mar 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

94.4% 94.4% Coverage
0.0% 0.0% Duplication

@charn charn merged commit d9330e8 into main Mar 31, 2023
@charn charn deleted the TIED-73-production-container branch March 31, 2023 13:30
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.

3 participants