Quickstart

Start using ManyStagings with Kubernetes

Installing Controller

Assuming here that you have a Kubernetes cluster just for staging purpose, you will need to install the controller used to manage all resources needed.

We are currently developing a helm chart to make installation easy. Currently, this pre-release step requires a manual deployment of the controller.

Creating Kubernetes Deployment

Modify and apply this YAML file to your needs:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: manystagings
  labels:
    run: manystagings
spec:
  replicas: 1
  selector:
    matchLabels:
      run: manystagings
  template:
    metadata:
      labels:
        run: manystagings
    spec:
      containers:
      - name: manystagings
        image: carlosstrand/manystagings:latest
        ports:
        - containerPort: 8000
        env:
          - name: "DB_TYPE"
            value: # Add a database type (postgres, mysql, sqlite)
          - name: "DB_URI"
            value: # Add DB_URI
          - name: "KUBERNETES_KUBECONFIG_BASE64"
            value: # Add a KUBECONFIG file encoded in base64. This kubeconfig is shared between all developers with access to ManyStagings
          - name: "SESSION_SECRET"
            value: # Add a random session token here. It's used to manage the auth sessions
---
apiVersion: v1
kind: Service
metadata:
  name: manystagings
  labels:
    run: manystagings
spec:
  ports:
  - port: 80
    targetPort: 8000
    protocol: TCP
  selector:
    run: manystagings
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: "nginx"    
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
  name: manystagings
spec:
  rules:
    - host: ms.yoursite.com
      http:
        paths:
          - backend:
              serviceName: manystagings
              servicePort: 80
            path: /
  tls:
      - hosts:
          - ms.yoursite.com
        secretName: manystagings-tls-secret

Environment Variables

Key

Description

DB_TYPE

Define the type of the database. Possible values: postgres, mysql, sqlite

DB_URI

KUBERNETES_KUBECONFIG_BASE64

A Kubeconfig file used to manage the K8s. (Note: currently it is shared between CLI clients)

SESSION_SECRET

A session secret used to manage session

Configuring Staging Environments

After install the controller you may be able to access the URL. https://ms.yoursite.com When accessing this URL, you will see a login screen. The default user/password is root/root but you can change in settings.

Now, it's time to configure your applications like Database, API, etc:

The Web UI is very simple and intuitive. It follows almost all the concepts of an application in Docker, for example. You need to configure the images, environment variables and ports. Behind the scenes, ManyStagings will manage the Kubernetes and create the resources you have configured

Installing CLI

Through the CLI, all developers will be able to manage their own staging environment. To do this, have Go 1.16.2 installed and run:

go install github.com/carlosstrand/manystagings/cli/ms

Make sure the binary was installed:

  ~ ms
ManyStagings is fast, lightweight and easy staging environment manager

Usage:
  ms [command]

Available Commands:
  configure   configure the manystagings CLI
  exec        execute a command into an application container
  help        Help about any command
  kill        kill all or an application for staging
  logs        Print the logs for an appliation
  proxy       proxy to an application inside your staging
  status      get application statuses inside your staging
  up          up all or an application for staging

Flags:
  -h, --help   help for ms

Use "ms [command] --help" for more information about a command.

Now, you can configure the CLI and choose the environment you want to work:

➜  ~ ms configure
Host URL: https://ms.carlosstrand.com
Username: root
Password: ****
Use the arrow keys to navigate: ↓ ↑ → ←
? Select an Environment:
  ▸ Pedro's Environment
    Carlos's Environment

Last updated