FPDC SOP

Fedora Product Definition Center is a service that aims to replace PDC in Fedora. It is meant to be a database with REST API access used to store data needed by other services.

Contact Information

Owner

Infrastructure Team

Contact

#fedora-apps, #fedora-admin

Persons

cverna, abompard

Location

Phoenix (Openshift)

Public addresses
  • fpdc.fedoraproject.org

  • fpdc.stg.fedoraproject.org

Servers
  • os.fedoraproject.org

  • os.stg.fedoraproject.org

Purpose

Centralize metadata and facilitate access.

Systems

FPDC is built using the DJANGO REST FRAMEWORK and uses a POSTGRESQL database to store the metadata. The application is run on Openshift and uses the Source-to-image technology to build the container directly from the git repository.

In the staging and production environments, the application is automatically rebuilt for every new commit in the staging or production branch, this is achieved by configuring a github webhook’s to trigger an openshift deployment.

For example a new deployment to staging would look like that:

git clone git@github.com:fedora-infra/fpdc.git cd fpdc git checkout staging git rebase master git push origin staging

The initial Openshift project deployment is manual and is done using the following ansible playbook :

sudo rbac-playbook openshift-apps/fpdc.yml

This will create a new fpdc project in Openshift with all the needed configuration.

Logs

Logs can be retrive using the openshift command line:

$ oc login os-master01.phx2.fedoraproject.org
You must obtain an API token by visiting https://os.fedoraproject.org/oauth/token/request

$ oc login os-master01.phx2.fedoraproject.org --token=<Your token here>
$ oc -n fpdc get pods
fpdc-28-bfj52          1/1       Running     522        28d
$ oc logs fpdc-28-bfj52

Database migrations

FPDC uses the recreate deployment configuration of openshift, which means that openshift will bring down the pods currently running and recreate new ones with the new version of the application. In the phase between the pods being down and the new pods being up, the database migrations are run in an independent pod.

Things that could go wrong

Hopefully not much. If something goes wrong is it currently advised to kill the pods to trigger a fresh deployment. :

$ oc login os-master01.phx2.fedoraproject.org
You must obtain an API token by visiting https://os.fedoraproject.org/oauth/token/request

$ oc login os-master01.phx2.fedoraproject.org --token=<Your token here>
$ oc -n fpdc get pods
fpdc-28-bfj52          1/1       Running     522        28d
$ oc delete pod fpdc-28-bfj52

It is also possible to rollback to a previous version :

$ oc -n fpdc get dc
NAME      REVISION   DESIRED   CURRENT   TRIGGERED BY
fpdc      39         1         1         config,image(fpdc:latest)
$ oc -n fpdc rollback fpdc