GitXplorerGitXplorer
p

bpo-builder

public
7 stars
4 forks
5 issues

Commits

List of commits on branch master.
Unverified
5118639351fec94c88bfcfae69bd73baf7c02052

Fix typo in a Dockerfile

ssoltysh committed 6 years ago
Unverified
b995a4612c4da42943fbb477fb2bf09b02b923a7

Move postgresql image related scripts to patroni

ssoltysh committed 6 years ago
Unverified
680079897b38040647e622e2cc54fbf18ef3f7d5

Update README.md to describe patroni deployment

ssoltysh committed 6 years ago
Unverified
c3bcc61cb96e092108f6d124a72eeb8ad5ea643a

Final fixes for patroni deployment

ssoltysh committed 6 years ago
Unverified
578758f0d83fe53954259df1e4685193d124d902

Don't rely on a specific commit id for building postgresql image

ssoltysh committed 6 years ago
Unverified
4261122ef5de7289075298d8e993f985a9e6129c

Remove emptyDir from template

ssoltysh committed 6 years ago

README

The README file for this repository.

About

This repository contains the code allowing to deploy http://bugs.python.org on OpenShift.

Usage

  1. Download latest OpenShift client and run oc cluster up to setup a local cluster. If you encounter any problems follow the diagnostic messages that appear on the screen, it is probably missing packages (eg. docker) or necessary configuration changes.

  2. Instantiate a postgresql instance. Depending on your needs there are two possibilies here. You can either proceed with a single development instance (A) or a full HA production one (B).

    A. To deploy single development instance you can either use the web console or the following command. With the former make sure to use the exact same values as below command.

    oc new-app postgresql:9.5 \
        --name=bpo-db \
        --labels=app=bugs.python.org \
        --env=POSTGRESQL_USER=roundup \
        --env=POSTGRESQL_PASSWORD=roundup \
        --env=POSTGRESQL_DATABASE=roundup
    

    This will create the following resources:

    This deployment configuration will kick of an actual deployment of our postgresql instance which leads to creating a Replication Controller and a Pod.

    NOTE: This setup uses an ephemeral storage, if you want to save your data you should read about Persistence Volumes.

    When the postgresql instance is up we need to drop the database and allow roundup initialize it from scratch. To do so invoke the following commands, which will get you connected to bpo-db pod and drop the database and add necessary access rights to create a new one, instead:

    oc rsh $(oc get pod -l deploymentconfig=bpo-db -o jsonpath='{.items[*].metadata.name}')
    # psql
    # drop database roundup;
    # alter user roundup createdb;
    

    B. To deploy full HA PostgreSQL using patroni project invoke the following command:

    oc create -f \
      https://raw.githubusercontent.com/python/bpo-builder/master/template_patroni.yaml
    

    This will create the following resources:

    NOTE: You should copy the above template file and change superuser-password and replication-password. These are base64 encoded passwords.

    When the postgresql instance is up we need to create user roundup with appropriate password and add it rights to create a database.

    oc rsh patroni-0
    # psql -U postgres
    # create user roundup with createdb encrypted password 'changeme';
    
  3. Now it is time to prepare all the bits necessary to deploy bugs.python.org itself:

oc create -f \
  https://raw.githubusercontent.com/python/bpo-builder/master/template_bpo.yaml

This will create the following resources:

NOTE: This needs to be performed only when you're using a temporary database.

Since we need to initiate the database only once, we need to set an environment variable (INIT_DATABASE), to tell the run script to do it:

oc set env deploymentconfig/bpo INIT_DATABASE=true

After the initial rollout this value should be cleared out:

oc set env deploymentconfig/bpo INIT_DATABASE-
  1. Edit config/roundup.ini and change the line:
web = http://localhost:9999/python-dev/

So that it matches the route the app will be exposed under. You can easily check that with oc get route/bpo. Afterwards you can create the necessary configuration:

oc create secret generic config \
    --from-file=roundup=config/roundup.ini \
    --from-file=detectors=config/detectors.ini
  1. With all the pieces in place we can finally start the application. To do so we need to build the actual image that will serve bugs.python.org:
oc start-build bpo