Giter Site home page Giter Site logo

riotkit-org / riotkit-harbor Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 2.0 14.32 MB

Complete compose environment, from development to production with service discovery and health checking. Kubernetes features on Compose scale, with Compose simplicity

Home Page: https://environment.docs.riotkit.org

License: Apache License 2.0

Shell 0.52% HTML 1.07% Python 97.60% Jinja 0.81%
project-template docker-template environment-template infrastructure-as-code infrastructure-automation ansible docker-compose fabric8 environment development-environment

riotkit-harbor's Introduction

RiotKit's Harbor

Documentation Status

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Github Release

Made with Python

License

Travis CI

PRs welcome

PRs open

Issues open

docker-compose based framework for building production-like environments - developing and testing on your local computer, deploying to your server or cluster from shell or from CI.

Demo: https://asciinema.org/a/348698

Notice

This project will be in the future replaced by "Space Harbor", which is successor of Harbor. Why? We started Harbor project as lightweight and elastic replacement for Kubernetes usage in tiny scale (for smaller services like blogs, forums etc.) but recently we researched usage of a lightweight Kubernetes distribution which fits very well for tiny scale and does not require an extra development of Python code.

We will support bugfixes fixes to Harbor till 01.01.2023, please consider migration to https://github.com/riotkit-org/k3s-space-harbor as soon as it will be announced stable.

Harbor

Is Kubernetes or OKD too big overhead or not suitable for your environment?

Is standard docker-compose too primitive to use in production?

Harbor fits perfectly, while providing some of Kubernetes-like solutions in docker-compose!

Features:

  • Service discovery (pins containers into WWW domains by labelling)
  • Deployment strategies: compose's standard, recreation, and rolling-updates (zero-downtime updates)
  • Automatic Letsencrypt SSL
  • Standardized directory structures and design patterns
  • Ready to use snippets of code and solutions (one command to install database, Wordpress or other application from our repository)
  • Ansible integration to prepare your production/testing server and deploy updates in extremely intuitive way

Roadmap:

Harbor 2.1

  • Init containers support (basing on Kubernetes idea) (#5)
  • delayed-request update strategy (minimum-downtime deployment with holding all HTTP requests waiting for new application) (#11)
  • Webhook handling update daemon to trigger container and git updates (#10)

Changelog

Harbor 2.0

  • Service upgrade strategies: Compose-native, recreation, rolling-updates
  • Rewrite from Makefile to Python
  • Containers startup priority
  • Maintenance mode is now not only global, but also per domain
  • Development mode now supports not only .localhost domains, but also *.xip.io

From authors

We are grassroot activists for social change, so we created this software while we were helping those fantastic initiatives:

Special thanks to Working Class History for very powerful samples that we could use in our unit tests.

riotkit-harbor's People

Contributors

blackandred avatar

Stargazers

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

Watchers

 avatar  avatar

riotkit-harbor's Issues

Containers deployment priority

Simply allow to assign priority numbers to containers (no complex dependency management - tool for listing all of services ordered by priority should be enough to handle this easily)

Add centralized logging via rsyslog

Logging to host's rsyslog on docker daemon side is a good idea, it could be used to centralize logging and possibly passing it to external server that has kibana for logs browsing.

Compose files loading priority

This is currently unclear what is the order of loading of YAML files for compose. There must be a mechanism to apply overrides to existing services.

Need to specify order, example (later - better, to work as an override):

  • apps/conf
  • apps/conf/override
  • apps/conf.dev
  • apps/conf.prod

Delayed-request update strategy

Idea:
"delayed-request" strategy can be implemented if possible (delay current requests on gateway - extend timeout until the service is not replaced)

Notice: This is an investigation + implementation task. If the investigation would result in - "cannot do" then this feature should be cancelled.

Effect:
Users would not get 500 error or other weird errors, they would need to wait a few seconds more for page to load

Correctly handle RSA keys generated by latest OpenSSH

Issue: Not all keys begins with -----BEGIN OPENSSH PRIVATE KEY, some begins with -----BEGIN RSA PRIVATE KEY which makes Harbor not to recognize value as a properly formatted private key. The result is that key is pasted into ansible.cfg making a syntax issue.

Resolution: check only first -----BEGIN at the at least beginning of the private key string

Ability to resolve naming conflicts in docker-compose

Correctly handle case, when docker-compose says it cannot create containers because the name is already used - at least what we can do is retry the operation which usually works.

   ===> Starting "gateway_letsencrypt" (1 instances)...
[2020-07-11 08:27:34.483][info]: Doing a "rolling" deployment for "gateway_letsencrypt"
[2020-07-11 08:27:34.484][info]: Processing instance #1/1
[2020-07-11 08:27:34.484][info]: Suspending service discovery
[2020-07-11 08:27:34.971][info]: Scaling up to 2
Creating anarchist_project_gateway_letsencrypt_1 ... 
Creating anarchist_project_gateway_letsencrypt_2 ... 
Creating anarchist_project_gateway_proxy_gen_1
Creating anarchist_project_gateway_letsencrypt_1 ... done
Creating anarchist_project_gateway_letsencrypt_1

ERROR: for anarchist_project_gateway_letsencrypt_2  Cannot create container for service gateway_proxy_gen: Conflict. The container name "/anarchist_project_gateway_proxy_gen_1" is already in use by container "c6b73cdcb025091d31db78df79010819388bacf220bb42f9502da1393fc953fa". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for gateway_letsencrypt  Cannot create container for service gateway_proxy_gen: Conflict. The container name "/anarchist_project_gateway_proxy_gen_1" is already in use by container "c6b73cdcb025091d31db78df79010819388bacf220bb42f9502da1393fc953fa". You have to remove (or rename) that container to be able to reuse that name.
Encountered errors while bringing up the project.
[2020-07-11 08:27:37.405][error]: Scaling back to declared state as error happened: Command 'bash' returned non-zero exit status 1.
anarchist_project_gateway_letsencrypt_1 is up-to-date
[2020-07-11 08:27:37.960][info]: Starting service discovery
Starting anarchist_project_gateway_1 ... done
Starting anarchist_project_gateway_proxy_gen_1 ... 
Starting anarchist_project_gateway_proxy_gen_1 ... done
Traceback (most recent call last):
  File "/project/.venv/lib/python3.6/site-packages/rkd/executor.py", line 65, in execute
    env=declaration.get_env()
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/base.py", line 136, in execute
    return self.run(context)
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/service.py", line 101, in run
    return strategies[strategy]()
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/service.py", line 87, in <lambda>
    'rolling': lambda: self.deploy_rolling(service, context),
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/service.py", line 170, in deploy_rolling
    raise e
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/service.py", line 151, in deploy_rolling
    existing_containers = self.containers(ctx).scale_one_up(service)
  File "/project/.venv/lib/python3.6/site-packages/harbor/driver.py", line 372, in scale_one_up
    raise e
  File "/project/.venv/lib/python3.6/site-packages/harbor/driver.py", line 368, in scale_one_up
    capture=True
  File "/project/.venv/lib/python3.6/site-packages/harbor/driver.py", line 194, in compose
    return self.scope.sh(cmd, capture=capture)
  File "/project/.venv/lib/python3.6/site-packages/rkd/contract.py", line 282, in sh
    cmd=cmd, capture=capture, verbose=verbose, strict=strict, env=env
  File "/project/.venv/lib/python3.6/site-packages/rkd/taskutil.py", line 92, in sh
    return check_output('bash', shell=True, stdin=read).decode('utf-8')
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'bash' returned non-zero exit status 1.
Command '#!/bin/bash -eopipefail 
set -euo pipefail; export PYTHONUNBUFFERED=1;  /project/.venv/bin/harbor --no-ui --no-ui :harbor:service:up gateway_letsencrypt  --strategy=auto' returned non-zero exit status 1.Cannot start service "gateway_letsencrypt"

Steps to reproduce:
Deploy to a fresh environment - do a docker prune on containers, networks and volumes.

Update daemon

Harbor can optionally be setting up a daemon on host to listen for rolling-update of a service on UNIX socket - UNIX socket can be forwarded to inside of a docker container that takes webhooks (eg. thin-deployer)

This concept is very secure and clear.

Harbor Simple Router support

The Harbor Simple Router could be used to perform a domain redirection, or informational HTML page publication (eg. "coming soon").

Use cases:

  • Commit to repo and deploy to production for longer time
  • In case of emergency do it on production, quickly replace existing container with a Harbor Simple Router forwarding the traffic somewhere / displaying maintenance page while turning off the original service

Demo Gif is Very Distorted

I'm not sure if it works for other people, but for me the demo Gif on the README is extremely distorted:

image

If you want, you could try out my cast2gif renderer for Asciinema recordings. But unfortunately I don't have automated builds yet. 😕

[BC] Make templating more elastic

Templates should have a possibility to be rendered anywhere in the project root directory.

Expectations:

  • Rendered from ./containers/templates
  • Into directory ./

Make gateway optional

Make gateway, service discovery and SSL optional, installable via Snippet Cooperative.

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.