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

Restart after config changes #911

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

dacook
Copy link
Member

@dacook dacook commented Nov 9, 2023

Ensure relevant services are restarted, after updating Rails or Postgres environment variables. Normally they would be restarted when the full provision playbook is executed anyway, but my vision is to be able to perform individual actions quicker.
My vision: to update app config in a minute with--tags=app, instead of waiting ages for every single action to run.

Probably this could have been separated into two separate tasks (one for Rails and one for Postgres). But it didn't seem worth spending more time on. Especially because additional tasks make ansible even slower...

I'm not sure why it failed on CI.
Update: I thought it was time to act on this one, so found a way to avoid the sidekiq error. Hmm, perhaps it was never started on initial setup? Then we should probably fix that.. but is this ok for now?

@dacook dacook self-assigned this Nov 9, 2023
@dacook
Copy link
Member Author

dacook commented Nov 9, 2023

Unable to start service sidekiq: Job for sidekiq.service failed because the control process exited with error code.\nSee \"systemctl status sidekiq.service\" and \"journalctl -xe\" for details

@dacook dacook force-pushed the restart-with-config-changes branch 2 times, most recently from 7d028f7 to 9da8e66 Compare December 6, 2023 01:16
@dacook
Copy link
Member Author

dacook commented Dec 11, 2023

I accidentally just "tested" this on us_prod.

Thankfully, it works 😌 ✅

ansible-playbook playbooks/provision.yml --limit="us_prod" --tags="app_templates"

PLAY [provision] *******************************************************************************************************
Monday 11 December 2023  20:09:59 +1100 (0:00:00.155)       0:00:00.155 *******

TASK [Gathering Facts] *************************************************************************************************
ok: [openfoodnetwork.net]
Monday 11 December 2023  20:10:06 +1100 (0:00:07.280)       0:00:07.436 *******

TASK [app : template files] ********************************************************************************************
changed: [openfoodnetwork.net] => (item={'src': 'env.j2', 'dest': '/home/openfoodnetwork/apps/openfoodnetwork/shared/config/.env.production'})
ok: [openfoodnetwork.net] => (item={'src': 'postgresql.yml.j2', 'dest': '/home/openfoodnetwork/apps/openfoodnetwork/shared/config/database.yml'})
Monday 11 December 2023  20:10:16 +1100 (0:00:09.212)       0:00:16.649 *******

TASK [jdauphant.nginx : include_vars] **********************************************************************************
ok: [openfoodnetwork.net] => (item=/Users/dcook/projects/ofn-install/community/jdauphant.nginx/vars/../vars/Debian.yml)
Monday 11 December 2023  20:10:16 +1100 (0:00:00.047)       0:00:16.696 *******

RUNNING HANDLER [restart puma] *****************************************************************************************
changed: [openfoodnetwork.net]
Monday 11 December 2023  20:10:18 +1100 (0:00:02.274)       0:00:18.970 *******

RUNNING HANDLER [restart postgres] *************************************************************************************
changed: [openfoodnetwork.net]
Monday 11 December 2023  20:10:22 +1100 (0:00:04.193)       0:00:23.164 *******

RUNNING HANDLER [restart sidekiq] **************************************************************************************
changed: [openfoodnetwork.net]

PLAY RECAP *************************************************************************************************************
openfoodnetwork.net        : ok=6    changed=4    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

@dacook dacook force-pushed the restart-with-config-changes branch from 9da8e66 to f5fcd99 Compare April 22, 2024 02:20
I'm not sure why it fails otherwise.
@dacook dacook marked this pull request as ready for review April 22, 2024 05:02
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

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

Great!

@mkllnk mkllnk merged commit fb093d4 into openfoodfoundation:master Apr 23, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants