Open dacook opened 6 days ago
There are some subdomains pointing to the server (see Cloudflare DNS), but they appear to be simple redirects (probably set up in nginx)
There are some subdomains pointing to the server (see Cloudflare DNS), but they appear to be simple redirects (probably set up in nginx)
- meet.openfoodnetwork.net
- donate.openfoodnetwork.net
Yep! Cloudflare gives us three redirects and we only use two. We use them a good amount.
Slack thread: #instance-managers
1. Setting up the new server
ls /etc/nginx/sites-enabled
systemctl --state=running
prod2.openfoodnetwork.org
)config
inventory/hosts
host_vars/x/config.yml
, clean up if neededcertbot_domains
ofn-secrets:x_prod/secrets.yml
, clean up if neededsetup
Enable passthrough on current server to allow new server to generate a certificate:
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/
setup.yml
provision.yml
deploy.yml
db_integrations
(Permit DB access for n8n, Metabase)initial migration
sudo systemctl stop sidekiq && sudo systemctl disable sidekiq
ofn-admin
andopenfoodnetwork
as per guideansible-playbook -l x_prod -e rsync_to=x_prod2 playbooks/
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
reboot
/admin/mail_methods/edit
)./admin/terms_of_service_files
/admin/stripe_connect_settings/edit
)3. Migration
preparation
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.
in meta description/admin/general_settings/edit
)switchover: old server
maintenance_mode.yml
sudo systemctl stop sidekiq redis-jobs puma
/var/lib/redis-jobs/dump.rdb
to new server (see guide)db_transfer.yml
~3minsudo systemctl stop postgres
(ensure other integrations no longer touch it)transfer_assets.yml
just in caseswitchover: new server
sudo systemctl restart puma; sudo systemctl start sidekiq redis-jobs
Rails.cache.clear
(or migrate redis-cache/dump.rdb also)temporary_proxy.yml -e 'proxy_target=<ip>'
redirect traffic to new prodhosts
file entry to test a direct connection~/apps/openfoodnetwork/current/logs/production.log
andsidekiq.log
4. Cleanup (after 48hrs)
provision.yml
still works. This will rename x-prod2 to x-prodRollback plan