Giter Club home page Giter Club logo

bpo-builder's Introduction

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

bpo-builder's People

Contributors

soltysh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bpo-builder's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.