Giter Club home page Giter Club logo

rubin-usdf-butler-deploy's Introduction

This repo holds the Rubin USDF Butler Postgres infrastructure kubernetes manifests.

We use the cloudnative-pg operator in order to support a managed postgres service on our own infrastructure.

We need different kustomize overlays to present the postgres environments. For lack of imagination, we currently have a prod and dev environment.

Deployment

As we are reliant on kubernetes for the infrastructure, we assume that you already have a suitable KUBECONFIG configured.

Deployment comes in two parts:

Deploy the CNPG Operator

The cnpg operator will install into cnpg-system namespace.

CNPG_VERSION=1.18 CNPG_VERSION_MINOR=1 make update-cnpg-operator
make apply

In the above, we define through environment variables the version of the operator we wish to install/update. This will literally fetch the manifest and dump the contents into the file cnpg-operator.yaml. ``make apply will then use kustomize to apply that manifest onto kubernets to install the operator.

We use kustomize rather than helm for the operator and cnpg database installs to keep complete revision control our deployments. As such, if you make changes to the butler environment, please commit and push your changes.

Deploy the appropriate overlay

cd overlays/$ENVIRONMENT
make apply

Following a similar pattern to the operator install, we have numerous environment overlay folders that keep instances of the database - prod and dev being the obvious ones.

Note that we recommend unique namespaces as well as different cnpg cluster names for each overlay to more clearly separate instances (and to provide clearer monitoring).

Configuration Changes

To perform a configuration change or postgres image perform the following.

  • Update the cnpg-butler-database.yaml manifest in the dev or prod overlay
  • Log into the appropriate kubernetes cluster
  • Check cluster status with kubectl cnpg status usdf-butler -n prod replacing -n with the namespace. Check for status of healthy and 2 instances
Status:             Cluster in healthy state 
Instances:          2
Ready instances:    2
  • Change directory the appropriate environemnt. Replacing environment below with dev or prod. Set your environment variable for vault, login into vault if not currently logged in, and apply the configuration with make.
export VAULT_ADDR=https://vault.slac.stanford.edu
cd overlays/$ENVIRONMENT
make apply
  • Check cluster status with kubectl cnpg status usdf-butler -n prod replacing -n with the namespace.

The vault login command is vault login -method=ldap username=$USER replacing with your ldap username.

Common Tasks

Requires installation of the cnpg kubectl plugin

Get status of cluster

kubectl cnpg status usdf-butler

Promote a replica to primary

kubectl cnpg promote usdf-butler

Destroy an instance

kubectl cnpg destroy usdf-butler 1

where 1 is the ordinal number of the instance

Pg Sphere Extension

For a database that needs pgsphere enabled. Connect to database with \c lsstdb1. From database CREATE EXTENSION pg_sphere;

Monitoring

We utilise the built in prometheus monitoring of cnpg and have a live dashboard.

Link to on how to calculate work mem

rubin-usdf-butler-deploy's People

Contributors

dspeck1 avatar yee379 avatar jtrouth avatar ktlim avatar yuyiguo avatar

Stargazers

Andy Salnikov avatar

Watchers

Karl Gumerlock avatar  avatar Matt Gibbs avatar Steffen Luitz avatar Tony Johnson avatar  avatar Ryan Herbst avatar  avatar

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.