-
Notifications
You must be signed in to change notification settings - Fork 442
Deployment of build.opensuse.org
-
Check get the commit id of the currently deployed code
osc api /about
-
Verify that newly built packages are available on the OBS instance by checking the versions:
zypper search --details obs-api
Get the commit id of the currently available (published) packages
NOTE: If new packages don't get published due to running builds, you might want to disable the GitHub / OBS integration.
-
Inspect the code (diff) for migrations and other changes that require attention. You can do this in GitHub with the following url:
https://github.com/openSUSE/open-build-service/compare/commit1...commit2
i.e using curl
curl -L "https://github.com/openSUSE/open-build-service/compare/80cb3011e...3c1e92ea8.diff"
Go to the "When there is no migration" section if there are not migrations, or to the "When there are migrations" section otherwise.
-
Check
/etc/motd
, it lists all pull requests that manually got applied to the deployment. Either merge them and wait for new packages or make sure you manually apply the changes after deployment again. Read here to know how to apply them manually. -
Update the packages
zypper update --best-effort --details obs-api (--best-effort is to get the latest version for which dependencies are met)
-
Check the state of OBS. Especially the areas that have been touched by code you just deployed. Make sure delayed jobs are running.
-
Apply monkey patches if there are any and modify the Monkey Patch section of /etc/motd accordingly.
If the migrations are just data, you don't need to wait for the maintenance window. You can apply those migrations right away as they won't cause any downtime. You will recognize data migrations when they contain db/data
in their path, instead of db/migrate
. To do so, apply just points 5 and 6 on this section and then jump to 9.
-
Wait for our maintenance window
Thursday, 8am to 10am CET / CEST
-
Check
/etc/motd
, it lists all pull requests that manually got applied to the deployment. Either merge them and wait for new packages or make sure you manually apply the changes after deployment again. -
Put apache into maintenance mode in
/etc/sysconfig/apache2
APACHE_SERVER_FLAGS="STATUS MAINTENANCE"
-
Restart apache
rcapache2 restart
-
Update the packages
zypper update --best-effort --details obs-api (--best-effort is to get the latest version for which dependencies are met)
-
Migrate the database
run_in_api rails db:migrate:with_data
-
Put apache out of maintenance mode in
/etc/sysconfig/apache2
APACHE_SERVER_FLAGS="STATUS"
-
Restart apache and delayed jobs
rcapache2 restart
-
Check the state of OBS. Especially the areas that have been touched by code you just deployed. Make sure delayed jobs are running.
-
Apply monkey patches if there are any and modify the Monkey Patch section of /etc/motd accordingly.
-
Check that the Factory dashboard still works https://build.opensuse.org/project/dashboard/openSUSE:Factory. If not, inform Ludwig / DimStar / Coolo.
Pull Requests which introduce migrations (which are expected to raise a downtime) are required to get merged on Wednesday morning (Those pull requests are labeled as Merge on Wednesday
) to make sure the migrations can be run in the maintenance window.
The creator of the pull request is responsible to merge those changes.
For delayed jobs, clockworkd and indexing sphinx there is a systemd target:
systemctl obs-api-support.target start|stop|status|restart
To make sure everything is running fine:
# The systemd target should display as active (running), in green
systemctl status obs-api-support.target
# All dependant services should display active (running), in green
systemctl list-dependencies obs-api-support.target
If one of this is already running and systemctl obs-api-support.target stop
does not stop it, you have to manually kill it (ps aux | grep delayed
) otherwise restarting will fail.
To get an overview about remaining jobs, you can run:
run_in_api rails runner script/delayed_job_stats.rb
When you see errors like SSL_connect SYSCALL returned=5 errno=0 state=unknown state
in Errbit this usually means that there is some issue with the RabbitMQ server / connection.
The maintenance window of the RabbitMQ server is Thursday, 8:00am to 10:00am CET
. This can also cause this issue.
To make sure that Airbrake is working, run the following command run_in_api rake airbrake:test
and it will send an airbrake event to our errbit. It should show up in the OBS frontend App.
In case that the deployment caused some breakage and you might need to build some new packages quickly. In that case you might want to temporarily disable the test suite in our rpm spec. To do that add %disable_obs_test_suite 1
to the project config of OBS:Server:Unstable. Important: It needs to go into the Macros: ... :Macros
section.
It might happen that a deployment breaks OBS badly and you need to get it to work again quickly. In that case you can check if zypper still has the old packages in it's cache. Just run zypper se --details
and verify that the package version you want is still available.
If that's the case, run zypper in --oldpackage obs-api-$VERSION.$ARCH
to downgrade the package.
OBS packages are build whenever a PR get's merged to master. This might delay publishing of built packages. To prevent this, disable the OBS integration in GitHub:
- Go to settings of the OBS GitHub project
- Select the 'Integration & services' tab and click on 'Edit' in the OBS column
- Uncheck the 'Activate' checkbox and 'Update services'
- Once the deployment is done activate the checkbox again ;-)
As far as possible, when a bug is found we should act as usual: create a Pull Request, wait for it to be reviewed and merged and then wait until the changes can be deployed.
This process usually takes so long that, sometimes, we can not wait for it to finish. For example, when the bug is blocking someone's work or even the whole application.
Only in such cases, we can apply the changes manually on production (monkey patch) following these steps:
- Access production server via SSH.
- Go to the application's directory.
- Apply the fix manually.
- Run
touch tmp/restart.txt
to restart the server (Passenger). - Add to
/etc/motd
the link to the Pull Request that fixes the problem. In the next deployment, that PR is going to be applied and will replace the manual changes.
- ssh to our cloud uploader instance
- Run
zypper up obs-cloud-uploader
- Development Environment Overview
- Development Environment Tips & Tricks
- Spec-Tips
- Code Style
- Rubocop
- Testing with VCR
- Authentication
- Authorization
- Autocomplete
- BS Requests
- Events
- ProjectLog
- Notifications
- Feature Toggles
- Build Results
- Attrib classes
- Flags
- The BackendPackage Cache
- Maintenance classes
- Cloud uploader
- Delayed Jobs
- Staging Workflow
- StatusHistory
- OBS API
- Owner Search
- Search
- Links
- Distributions
- Repository
- Data Migrations
- next_rails
- Ruby Update
- Rails Profiling
- Installing a local LDAP-server
- Remote Pairing Setup Guide
- Factory Dashboard
- osc
- Setup an OBS Development Environment on macOS
- Run OpenQA smoketest locally
- Responsive Guidelines
- Importing database dumps
- Problem Statement & Solution
- Kickoff New Stuff
- New Swagger API doc
- Documentation and Communication
- GitHub Actions
- How to Introduce Software Design Patterns
- Query Objects
- Services
- View Components
- RFC: Core Components
- RFC: Decorator Pattern
- RFC: Backend models