-
Notifications
You must be signed in to change notification settings - Fork 4
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
Docker refactor ready for AWS #1176
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1176 +/- ##
===========================================
+ Coverage 83.36% 83.45% +0.08%
===========================================
Files 115 115
Lines 4377 4399 +22
===========================================
+ Hits 3649 3671 +22
Misses 728 728 see 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey AJ, nice work :)
I've put it on platform.sh here just to double check that nothing goes funny as a result of this: https://feature-aws-migration-qtvcsiq-rasrzs7pi6sd4.uk-1.platformsh.site/ - all looks good to me on there 😃
I've got one problem with running commands in the CLI (fab sh
then e.g. python manage.py createsuperuser
) it seems to be running quite slow. Normally these commands are near instant, but it's currently hanging slightly (~10 seconds) before running any of these commands. It seems like it's only the python manage.py
commands that are hanging - I'm thinking it might be because we've got the server constantly running in the background?
I also tried running a few commands to make sure everything was working. I ran poetry update
to update to the latest Python packages to make sure that was working - when it stopped the container and restarted the web
container and that's now stuck restarting in a loop:
2023-07-12 11:49:39 Skipping virtualenv creation, as specified in config file.
2023-07-12 11:49:39 Traceback (most recent call last):
2023-07-12 11:49:39 File "/app/manage.py", line 15, in <module>
2023-07-12 11:49:39 from django.core.management import execute_from_command_line
2023-07-12 11:49:39 ModuleNotFoundError: No module named 'django'
But again I assume this is coming from the constantly running server. Is there a way to stop the site from running, but have the containers running so I can run commands without the site/server on?
Co-authored-by: James Biggs <[email protected]>
@jamesbiggs - The line responsible for running the server on startup is this one: https://github.com/nationalarchives/ds-wagtail/pull/1176/files#diff-81ab1d3980be928d58ce321fa0b4e94c90e3ff0eaad9f8cdea2e7e63490f6f34R6 I've done that so as to be as close to the production script as possible but maybe we want to comment out this line if most people would rather not have it run automatically? Keen to know what others think... |
Personally, I like to run |
I have commented out the two lines in Hope that works a little better @jamesbiggs? |
Hey AJ, I've just tried
Which just keeps running in a loop. I've checked and I've definitely got the latest version of this branch, and I can even see |
You can now add the following to your .env to run migrations and start the server automatically: AUTO_START_SERVER=true |
@jamesbiggs - Really sorry to have to ask but when you get a chance, could you try again? I'm hoping I've squashed the issue you were having with |
Hey @ahosgood, I've given it a go and I'm getting this now:
I think it might be this |
Hi @ahosgood, I ran some commands on this branch and compared the times to develop: developfab startreal 1m46.300s fab shI had to type exit to get the time, so it's slightly inaccurate fab pull-staging-datareal 0m52.494s fab pull-staging-mediareal 0m7.344s createsuperuserI had to enter credentials to retrieve time makemigrationsreal 0m10.057s migratereal 0m11.110s runserverI had to kill server as soon as it finished running aws-migrationfab startreal 1m5.080s fab shI had to type exit to get the time, so it's slightly inaccurate fab pull-staging-datareal 1m0.049s fab pull-staging-mediareal 0m9.517s createsuperuserI had to enter credentials to retrieve time makemigrationsreal 0m10.479s migratereal 0m11.682s runserverI had to kill server as soon as it finished running Seems like the time to start the server is quicker on this branch, but everything else is slightly slower (only by a few seconds in most cases) I'm just going to restart my laptop though as I've found before that restarting my laptop makes things start quicker, and any time I rebuild things my laptop gets slower and slower... |
After restarting PC, on this branch: fab startreal 0m54.140s makemigrationsreal 0m8.844s and on develop: fab startreal 1m24.347s makemigrationsreal 0m14.645s So looks like this one is running slightly faster now 🙂 I've also noticed something, not sure if it holds any relevance... When I run but on this branch I get: I'm not sure if that's intended but just something I noticed 😃🙌 |
This is now down to the fact that the Docker image is no longer running as the We now have a non-root/standard user ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work AJ, and thanks for answering all the questions! 🙌😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving from FE workflow perspective.
Supersedes #1031
Test by checking out branch and running:
fab build && fab start
The images should get completely rebuilt, start running automatically on http://localhost:8000/ (it may take a bit of time so check your Docker logs) and be watching for Python, template, CSS and JS changes.
No other commands should be required.