New central namespace
In ODS 2, there was a central namespace cd
, alongside 3 namespace dedicated to the provisioning app: prov-cd
, prov-dev
and prov-test
. In ODS 3, there is only one namespace ods
, which contains the whole OpenDevStack installation. When updating from ODS 2 to ODS 3, you will need to move the services running in cd
, prov-cd
and prov-test
to ods
. In detail:
-
SonarQube is moving from
cd
toods
-
Nexus is moving from
cd
toods
-
Jenkins (Master and Webhook Proxy) is moving from
prov-cd
toods
-
Provisioning App is moving from
prov-test
toods
The Provisioning App will make use of the Jenkins instance in ods
to provision new ODS projects.
Apart from the instances, also all build configurations and image streams are moving from cd
to ods
, which means all users need to pull images from the new namespace.
With that in mind, we can start the update procedure!
Update your OpenDevStack repositories
Updating repositories means that new refs from repositories under
github.com/opendevstack
are pushed into the repositories in your BitBucket
instance.
To do so, run the following and select the version you want to install (3.x
).
make sync-repos
If your OpenDevStack installation is based on a custom branch (such as 3.acme
), then you
need to create a pull request on BitBucket from 3.x
into that custom branch now.
Now that the repositories are updated, you also need to modify the images and the running instances in OpenShift.
Backup
Before proceeding, it is advisable to make a backup of the existing OpenShift configuration. This can be done easily with Tailor:
# Backup CD project
tailor export -n cd > backup_CD.yml
# Backup provision app namespaces
tailor export -n prov-cd > backup_PROV_CD.yml
tailor export -n prov-dev > backup_PROV_DEV.yml
tailor export -n prov-test > backup_PROV_TEST.yml
Note that the executing user needs to have permissions to access all resources
in the cd
namespaces for this to work properly.
Tailor
Next, update Tailor. 3.x requires Tailor 1.2.2.
Configuration
Run:
make prepare-config
In 2.x, the Jenkins master base image was pulled from the openshift
namespace. The agent base image could have been pulled from that namespace as well, or directly from a registry. In 3.x, the master can also be pulled directly from a registry. The advantage of this is that you do not need to worry about the import policy set in the openshift
namespace, which can have suprising results (e.g. your base image never updating even though a fix has been released by RedHat). The behaviour is defined by a new configuration parameter, JENKINS_MASTER_BASE_FROM_IMAGE
.
Further, in 2.x you had to pick (via JENKINS_AGENT_BASE_IMAGE
) whether you wanted to use Dockerfile.centos7
or Dockerfile.rhel7
. However, both files contained the same instructions. Therefore, those were combined into a single Dockerfile
and you only need to choose which base image to use via JENKINS_AGENT_BASE_FROM_IMAGE
(like before).
After you have updated/added/removed all parameters with your desired values, commit and push the result.
OpenShift resources
Next you need to update all OpenShift resources (such as DC or BC). Review the diff produced by Tailor carefully before applying changes.
In ods-core
, run:
make install-ods-project
make install-jenkins
make install-nexus
make install-doc-gen
In ods-quickstarters
, run:
make install-jenkins-agent
Provisioning App changes
With OpenDevStack version 3.x the "production" instance of the Provisioning App is moving from the prov-test
to the ods
namespace.
The following steps describe how to perform the change:
-
Backup Data to a local directory
oc cp prov-test/<ods-provisioning-pod-name>:/opt/provision/history/ ./history
-
Backup Data to a local directory
oc cp prov-test/<ods-provisioning-pod-name>:/opt/provision/history/ ./history
-
Install the Provisioning App in the
ods
namespace
make install-provisioning-app
-
Copy backed up data to new instance
oc cp ./history ods/<ods-provisioning-pod-name>:/opt/provision
-
Depending on your use of the Provisioning App you can either:
-
delete all
prov-*
namespaces if you are only interested in running a "production" instance. -
only delete the data under
/opt/provision/history
in theprov-test
namespace if you want to keep your setup.
-
SonarQube changes
With OpenDevStack version 3.x SonarQube is moving from the cd
namespace to the ods
namespace.
The following outlines the procedure for SonarQube:
-
Create the SonarQube build resources in
ods
usingmake apply-sonarqube-build
-
Start build of SonarQube image in
ods
usingmake start-sonarqube-build
-
Scale down the SonarQube pod in
cd
-
Create a backup of the old data using
make ODS_NAMESPACE=cd backup-sonarqube
-
Create the SonarQube deploy resources in
ods
usingmake apply-sonarqube-deploy
-
Scale down the SonarQube pod in
ods
-
Upload backup to new Postgres pod:
oc -n ods cp sonarqube/sonarqube.sql <sonarqube-postgresql-pod>:/var/lib/pgsql/
-
Start a bash in the Postgres pod:
oc rsh -n ods pod/<sonarqube-postgresql-pod> bash
and start apsql
session. -
Drop the
sonarqube
database (DROP DATABASE sonarqube
) and create a new, empty one (CREATE DATABASE sonarqube OWNER sonarqube
). Then quit frompsql
. -
Import the backup with
psql sonarqube < sonarqube.sql
-
Scale up the SonarQube pod in
ods
. -
At this stage, the new SonarQube instance is fully functional, but the Elasticsearch index is not correct and therefore no projects show on the dashboard initially. To fix this, log into SonarQube with an admin user and go to "Administration > System". Then, start a bash in the SonarQube pod:
oc rsh -n ods pod/<sonarqube-pod> bash
and remove/opt/sonarqube/data/es6
. Afterwards, restart the server from the UI (there’s a button on the "Administration > System" page). Booting will take some time (depending on the amount of data to process) as a full re-index is performed. -
Call
make configure-sonarqube
to verify the new installation is correctly configured. -
Now delete the old SonarQube route in
cd
. -
Create a new route in
ods
with the same host as the old route so that projects using the old URL don’t break.
Secure route removal
Checking for secure routes has been removed from the core, but is still available at https://github.com/BIX-Digital/ods-contrib.