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

Upgrade updates #964

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/ISSUE_TEMPLATE/server-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ assignees: ''
Checklist based on general guide https://github.com/openfoodfoundation/ofn-install/wiki/Migrating-a-Production-Server

## 1. Setting up the new server
- [ ] Check old server config for any additional services to be aware of (eg `/etc/nginx/sites-available`). Document any necessary steps for migration.
- [ ] Check old server config for any additional services to be aware of. Document any necessary steps for migration. Eg:
- `ls /etc/nginx/sites-enabled`
- `systemctl --state=running`
- [ ] Hosting: provision new server with Ubuntu 20
- [ ] DNS: add temporary domain (eg `prod2.openfoodnetwork.org`)

Expand All @@ -27,7 +29,7 @@ Enable passthrough on _current_ server to allow new server to generate a certifi
- [ ] `ansible-playbook playbooks/letsencrypt_proxy.yml -l x_prod -e "proxy_target=<new_ip>" `

Then setup new server. Ensure you have the correct secrets (current secrets are usually fine).
`ansible-playbook -l x_prod2 -e "@../ofn-secrets/x_prod/secrets.yml playbooks/`
`ansible-playbook -l x_prod2 -e "@../ofn-secrets/x_prod/secrets.yml" playbooks/`
- [ ] `setup.yml`
- [ ] `provision.yml`
- [ ] `deploy.yml`
Expand All @@ -42,6 +44,9 @@ Then setup new server. Ensure you have the correct secrets (current secrets are
- [ ] `db_transfer.yml`
- [ ] `transfer_assets.yml`

Make sure to clear cache so that instance settings are applied:
`cd ~/apps/openfoodnetwork/current; bin/rails runner -e production "Rails.cache.clear"`

## 2. Testing
- [ ] test `reboot`
- [ ] send test mail (`/admin/mail_methods/edit`).
Expand All @@ -55,7 +60,7 @@ Then setup new server. Ensure you have the correct secrets (current secrets are

## 3. Migration
### preparation
- [ ] new server: `bundle exec rake db:reset -e production`
- [ ] **new server**: `bin/rake db:reset -e production` (important: make sure you're on the new server!)
- [ ] `deploy.yml -l x_prod2 -e "git_version=vX.Y.Z"` matching version with current prod
- [ ] old server: make a tiny data change to verify later (eg add `.` in meta description `/admin/general_settings/edit`)

Expand Down
2 changes: 1 addition & 1 deletion roles/default_user/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: create deploy user
user:
name="{{ user }}"
groups=adm,dialout,cdrom,floppy,audio,dip,video,plugdev,netdev,sudo
groups=adm,dialout,cdrom,floppy,audio,dip,video,plugdev,sudo
Copy link
Member

Choose a reason for hiding this comment

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

Totally fine. We have sudo for everything we want to do.

append=yes
state=present
shell=/bin/bash
Expand Down
Loading