Giter Site home page Giter Site logo

luizalabs / teresa Goto Github PK

View Code? Open in Web Editor NEW
553.0 27.0 79.0 34.93 MB

Open source tool to deploy apps to Kubernetes clusters

License: Other

Go 98.80% Makefile 0.78% Shell 0.25% Python 0.03% Dockerfile 0.07% Mustache 0.07%
kubernetes go paas hacktoberfest

teresa's Introduction

Teresa

Release Software License Build Status codecov Go Report Card

Teresa is an extremely simple platform as a service that runs on top of Kubernetes. It uses a client-server model: the client sends high level commands (create application, deploy, etc.) to the server, which translates them to the Kubernetes API.

Client Installation

Download (recommended)

This is the best way to get the latest release.

  • Access https://github.com/luizalabs/teresa/releases
  • Download the latest release for your OS. Eg: teresa-linux-amd64
  • Rename the download file to teresa. Eg: mv teresa-linux-amd64 teresa
  • Make it an executable. Eg: chmod +x teresa
  • Move it to the bin folder. Eg: sudo mv teresa /usr/bin

Then you're good to go ๐Ÿ™‚ ! teresa should now be available to use on your terminal.

Homebrew

Run the following in your command-line:

$ brew tap luizalabs/teresa-cli
$ brew install teresa

Snap

Run the following in your command-line:

$ sudo snap install teresa-cli

Server Installation

Server requirements:

  • Kubernetes cluster (>= 1.9)

  • database backend to store users and teams (SQLite or MySQL)

  • storage for build artifacts (AWS S3 or minio)

  • rsa keys for token signing

  • (optional) TLS encryption key and certificate

The recommended installation method uses the helm package manager, for instance to install using S3 and MySQL (recommended):

$ openssl genrsa -out teresa.rsa
$ export TERESA_RSA_PRIVATE=`base64 -w0 teresa.rsa`
$ openssl rsa -in teresa.rsa -pubout > teresa.rsa.pub
$ export TERESA_RSA_PUBLIC=`base64 -w0 teresa.rsa.pub`
$ helm repo add luizalabs http://helm.k8s.magazineluiza.com
$ helm install luizalabs/teresa \
    --namespace teresa \
    --set rsa.private=$TERESA_RSA_PRIVATE \
    --set rsa.public=$TERESA_RSA_PUBLIC \
    --set aws.key.access=xxxxxxxx \
    --set aws.key.secret=xxxxxxxx \
    --set aws.region=us-east-1 \
    --set aws.s3.bucket=teresa \
    --set db.name=teresa \
    --set db.hostname=dbhostname \
    --set db.username=teresa \
    --set db.password=xxxxxxxx \
    --set rbac.enabled=true

Look here for more information about helm options.

You need to create an admin user to perform user and team management:

$ export POD_NAME=$(kubectl get pods -n teresa -l "app=teresa" -o jsonpath="{.items[0].metadata.name}")
$ kubectl exec $POD_NAME -it -n teresa -- ./teresa-server create-super-user --email [email protected] --password xxxxxxxx

QuickStart

Read the first sections of the FAQ.

teresa's People

Contributors

adlermedrado avatar aguerra avatar alanwikid avatar arnaldopereira avatar brucorreia avatar diegofernandes avatar drgarcia1986 avatar ederprado-luizalabs avatar eraldobernardino-luizalabs avatar evaporei avatar fandujar avatar gabrielguaiato-luizalabs avatar gerep avatar jairhenrique avatar jeffersonribeiro avatar kelvins avatar lucianokadoya-luizalabs avatar luizgois-luizalabs avatar rafaelgotts avatar retpolanne avatar rvalverde-luizalabs avatar yagonobre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teresa's Issues

Implement a metrics collector process

We should be able to collect a timeseries for cpu, mem, etc. from all apps in order to alert the user of possible anomalies, for instance significant increases in resource consumption.

deploy command

It would be nice if the command teresa deploy ask to me what environment I want to run the command.

.teresaignore doesn't works like .gitignore

Scenario

# .gitignore
composer.phar
vendor/
# .teresaignore
composer.phar
vendor/

When I run git status the folder vendor/ are not listed on my shell output, but when I do a deploy on Teresa, I see this message:

!     WARNING: Your Composer vendor dir is part of your Git repository.
       This directory should not be under version control; only your
       'composer.json' and 'composer.lock' files should be added, which
       will let Composer handle installation of dependencies on deploy.
       To suppress this notice, first remove the folder from your index
       by running 'git rm -r --cached vendor/'.
       Next, edit your project's '.gitignore' file and add the folder
       '/vendor/' to the list.
       For more info, refer to the Composer FAQ: http://bit.ly/1rlCSZU

So, Teresa are including the folder vendor on tarball for deploy.


Changing .teresaignore to this:

composer.phar
vendor

vendor folder are not include and the buildpack install my dependencies.

Deployment rollback

We should automatically rollback to the latest successful deployment when the health check detects
a failure.

[PROPOSAL] List deploys in reversed order

Currently, the last revision is shown at bottom of the table.
I think in most cases, we only need to know which was the last one, and it would be more easy to see if it is displayed first. Example:

+----------+---------+-----+------------------------------------------+
| REVISION | CURRENT | AGE |               DESCRIPTION                |
+----------+---------+-----+------------------------------------------+
| 22       | true    | 4d  | 48f4553 Bump version: 1.118.0 โ†’ 1.119.0  |
+----------+---------+-----+------------------------------------------+
| 21       | false   | 5d  | v1.118.0                                 |
+----------+---------+-----+------------------------------------------+
| 20       | false   | 10d | 5290ab57 Bump version: 1.116.0 โ†’ 1.117.0 |
+----------+---------+-----+------------------------------------------+
| 19       | false   | 12d | 226868ea Bump version: 1.115.1 โ†’ 1.116.0 |
+----------+---------+-----+------------------------------------------+
| 18       | false   | 12d | c00332b Bump version: 1.115.0 โ†’ 1.115.1  |
+----------+---------+-----+------------------------------------------+
| 17       | false   | 19d | c2d00239 Bump version: 1.114.2 โ†’ 1.115.0 |
+----------+---------+-----+------------------------------------------+

Sort env vars.

It would be nice if teresa app info myapp return env vars sorted.

[PROPOSAL] Show current revision together with revision number

Currently, there is a column CURRENT with true/false values, which only one will be true.

I think would be nicer and easier to find which revision is the current if its displayed together with revision number.

Today:

+----------+---------+-----+------------------------------------------+
| REVISION | CURRENT | AGE |               DESCRIPTION                |
+----------+---------+-----+------------------------------------------+
| 17       | false   | 19d | c2d00239 Bump version: 1.114.2 โ†’ 1.115.0 |
+----------+---------+-----+------------------------------------------+
| 18       | false   | 12d | c00332b Bump version: 1.115.0 โ†’ 1.115.1  |
+----------+---------+-----+------------------------------------------+
| 19       | true    | 12d | 226868ea Bump version: 1.115.1 โ†’ 1.116.0 |
+----------+---------+-----+------------------------------------------+
| 20       | false   | 10d | 5290ab57 Bump version: 1.116.0 โ†’ 1.117.0 |
+----------+---------+-----+------------------------------------------+
| 21       | false   | 5d  | v1.118.0                                 |
+----------+---------+-----+------------------------------------------+
| 22       | false   | 4d  | 48f4553 Bump version: 1.118.0 โ†’ 1.119.0  |
+----------+---------+-----+------------------------------------------+
+--------------+-----+------------------------------------------+
| REVISION     | AGE |               DESCRIPTION                |
+--------------+-----+------------------------------------------+
| 17           | 19d | c2d00239 Bump version: 1.114.2 โ†’ 1.115.0 |
+--------------+-----+------------------------------------------+
| 18           | 12d | c00332b Bump version: 1.115.0 โ†’ 1.115.1  |
+--------------+-----+------------------------------------------+
| 19 (current) | 12d | 226868ea Bump version: 1.115.1 โ†’ 1.116.0 |
+--------------+-----+------------------------------------------+
| 20           | 10d | 5290ab57 Bump version: 1.116.0 โ†’ 1.117.0 |
+--------------+-----+------------------------------------------+
| 21           | 5d  | v1.118.0                                 |
+--------------+-----+------------------------------------------+
| 22           | 4d  | 48f4553 Bump version: 1.118.0 โ†’ 1.119.0  |
+--------------+-----+------------------------------------------+

what do you think?

Support monitoring hooks

So apps are automatically monitored. Requisites:

  • decoupled from teresa itself
  • monitoring system agnostic

Teresaignore is broken on Windows

The input files end up being encoded like this:

-rw-rw-rw- 0/0             896 2017-08-24 08:04 src\\routes.js.orig
-rw-rw-rw- 0/0             949 2017-08-24 08:04 src\\server.js
-rw-rw-rw- 0/0            3343 2016-03-12 10:44 swagger\\dist\\404.html
-rw-rw-rw- 0/0              18 2016-01-19 13:05 swagger\\dist\\CNAME
-rw-rw-rw- 0/0           34174 2015-10-28 19:28 swagger\\dist\\bower_components\\ace-builds\\src-noconflict\\ext-language_tools.js
-rw-rw-rw- 0/0            9992 2015-10-28 19:28 swagger\\dist\\bower_components\\ace-builds\\src-noconflict\\ext-searchbox.js
-rw-rw-rw- 0/0           12066 2015-10-28 19:28 swagger\\dist\\bower_components\\ace-builds\\src-noconflict\\ext-settings_menu.js
-rw-rw-rw- 0/0           24444 2015-10-28 19:28 swagger\\dist\\bower_components\\ace-builds\\src-noconflict\\keybinding-emacs.js

instead of:

-rw-rw-rw- 0/0             825 2017-08-31 08:25 /src/routes.js
-rw-rw-rw- 0/0             896 2017-08-24 08:04 /src/routes.js.orig
-rw-rw-rw- 0/0             949 2017-08-24 08:04 /src/server.js
-rw-rw-rw- 0/0            3343 2016-03-12 10:44 /swagger/dist/404.html
-rw-rw-rw- 0/0              18 2016-01-19 13:05 /swagger/dist/CNAME
-rw-rw-rw- 0/0           34174 2015-10-28 19:28 /swagger/dist/bower_components/ace-builds/src-noconflict/ext-language_tools.js
-rw-rw-rw- 0/0            9992 2015-10-28 19:28 /swagger/dist/bower_components/ace-builds/src-noconflict/ext-searchbox.js

Define DaaS implementation strategy

To implement #374, we have a few options:

  1. Teresa using helm to manage resources through teresa resource create|delete ...
    • Positive:
      • Leverage maturity and features that already exists in helm, as well as all the charts
      • Quicker implementation
    • Negative:
      • Requires helm/tiller for teresa resource ... to work and it must be a specific version
      • Can't customize everything in teresa resource as we wish
  2. Implement everything in Teresa
    • Positive:
      • Fully customizable
      • Avoid adding another dependency
    • Negative:
      • Longer implementation
      • Will have to rewrite it afterwards - as we'll most likely end up with less quality code than teresa have overall
      • Less features, less databases supported

Support the creation of databases as a service

Basically we should be able to do:

teresa resource create mysql --set foo1=bar1 --set foo2=bar2 ...

where the variables are optional customizations (disk size, mysql version, etc). We should avoid to hardcode resource templates and instead use a secure transport such as https to get them.

Tasks

  • Create the templates and the transport infra (suggestion: use helm as a starting point)
  • Create a client or adapt the current storage to get the resources templates
  • Create the resource command. Requirements:
    • create an arbitrary number of component resources in a specific order
    • sane template defaults with support for overriding values
    • interactive with user friendly messages
    • rollback all creations on any failure

[PROPOSAL] Show deploy completion date and time

The deploy list command is really useful and I'm already using it sincce v0.8.0 has come.

But I think that showing the date and time the deploy completed may be more useful, mainly in troubleshooting when the EXACT date matters and when there are multiple deploys in the same day.

This is a real output for an app of mine:

+----------+---------+-----+------------------------------------------+
| REVISION | CURRENT | AGE |               DESCRIPTION                |
+----------+---------+-----+------------------------------------------+
| 17       | false   | 19d | c2d00239 Bump version: 1.114.2 โ†’ 1.115.0 |
+----------+---------+-----+------------------------------------------+
| 18       | false   | 12d | c00332b Bump version: 1.115.0 โ†’ 1.115.1  |
+----------+---------+-----+------------------------------------------+
| 19       | false   | 12d | 226868ea Bump version: 1.115.1 โ†’ 1.116.0 |
+----------+---------+-----+------------------------------------------+
| 20       | false   | 10d | 5290ab57 Bump version: 1.116.0 โ†’ 1.117.0 |
+----------+---------+-----+------------------------------------------+
| 21       | false   | 5d  | v1.118.0                                 |
+----------+---------+-----+------------------------------------------+
| 22       | true    | 4d  | 48f4553 Bump version: 1.118.0 โ†’ 1.119.0  |
+----------+---------+-----+------------------------------------------+

It would be nice if it is something like this (the COMPLETED AT column):

| ---------- | --------- | ---------------------| ------------------------------------------ |  
| REVISION   | CURRENT   | COMPLETED AT         | DESCRIPTION                                |  
| ---------- | --------- | -------------------- | ------------------------------------------ |  
| 17         | false     | 2017-09-01 01:00:00Z | c2d00239 Bump version: 1.114.2 โ†’ 1.115.0   |  
| ---------- | --------- | -----                | ------------------------------------------ |  
| 18         | false     | 2017-09-08 01:00:00Z | c00332b Bump version: 1.115.0 โ†’ 1.115.1    |  
| ---------- | --------- | -----                | ------------------------------------------ |  
| 19         | false     | 2017-09-08 01:00:00Z | 226868ea Bump version: 1.115.1 โ†’ 1.116.0   |  
| ---------- | --------- | -----                | ------------------------------------------ |  
| 20         | false     | 2017-09-10 01:00:00Z | 5290ab57 Bump version: 1.116.0 โ†’ 1.117.0   |  
| ---------- | --------- | -----                | ------------------------------------------ |  
| 21         | false     | 2017-09-14 01:00:00Z | v1.118.0                                   |  
| ---------- | --------- | -----                | ------------------------------------------ |  
| 22         | true      | 2017-09-15 01:00:00Z | 48f4553 Bump version: 1.118.0 โ†’ 1.119.0    |  
| ---------- | --------- | -------------------- | ------------------------------------------ |  

(I've changed the tabke format a bit, but it's just for formatting purpose)

The example is in iso format, but it may be formatted with local computer time.

Setup instructions unclear

  • teresa-api version: a21b7d6 (0.3.1?)
  • K8s version: 1.5.2

I've followed all steps outlined on the teresa-api readme file, however the teresa-api pod fails with the following error message:

time="2017-04-27T00:43:30Z" level=fatal msg="the server could not find the requested resource (get secrets teresa-keys)"

Even though teresa-keys exist:

$ kubectl get secrets teresa-keys -n teresa
NAME          TYPE      DATA      AGE
teresa-keys   Opaque    2         2d

This is the deployment file:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: teresa
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: teresa
    spec:
      containers:
      - name: teresa
        image: cmgvieira/teresa:latest
        ports:
        - containerPort: 8080
        env:
          - name: TERESAK8S_HOST
            value: [MY K8S HOST]
          - name: TERESAK8S_USERNAME
            value: [MY K8S USERNAME COPIED FROM ~/.kube/config]
          - name: TERESAK8S_PASSWORD
            value: [MY K8S PASSWORD COPIED FROM ~/.kube/config]
          - name: TERESAK8S_INSECURE
            value: "true"
          - name: TERESAFILESTORAGE_TYPE
            value: s3
          - name: TERESAFILESTORAGE_AWS_KEY
            value: [MY S3 AWS KEY]
          - name: TERESAFILESTORAGE_AWS_SECRET
            value: MY S3 AWS SECRET]
          - name: TERESAFILESTORAGE_AWS_REGION
            value: us-east-1
          - name: TERESAFILESTORAGE_AWS_BUCKET
            value: [MY BUCKET NAME]
          - name: TERESADEPLOY_REVISION_HISTORY_LIMIT
            value: "5"
          - name: TERESADEPLOY_START_TIMEOUT
            value: 10m
          - name: TERESADEPLOY_FINISH_TIMEOUT
            value: 30m
          - name: NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace

Unless I'm missing something from the readme, I think it should be updated with clearer instructions.

Use gRPC instead of go-swagger

Macro vision checklist:


Extras:

  • set-password command ( #185 )
  • [server] create super user command ( #198 )
  • TLS (some PRs of series)
  • Release command phase ( #226 )
  • Health Check ( #230 )
  • Version by tag (git) ( #229 )
  • minio slug storage ( #236 )

Refactorings:

  • cli configs ( #188 )
  • bash completion ( #187 )
  • delete build pods after work ( #211 )
  • standardize errors msgs format and server logs (server and client) ( #214 #218 )

Fun Stuff

  • Unit Tests
  • Travis CI (run unit tests against some golang versions ) ( #194 )

Shell

As a teresa user
I want to access the shell from a pod
To run cli commands from my app

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.