The Wayback Machine - https://web.archive.org/web/20201012024139/https://github.com/huginn/huginn/pull/2733
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: A helm chart for deploying huginn #2733

Open
wants to merge 3 commits into
base: master
from

Conversation

@jjasghar
Copy link
Contributor

@jjasghar jjasghar commented Apr 2, 2020

  • Deploys a basic installation of huginn.
  • Deploys mariadb/mysql as the dep for huginn.
* Deploys a basic installation of huginn.
* Deploys mariadb/mysql as the dep for huginn.

Signed-off-by: JJ Asghar <[email protected]>
Signed-off-by: JJ Asghar <[email protected]>
Co-authored-by: Paul Czarkowski <[email protected]>
@jjasghar
Copy link
Contributor Author

@jjasghar jjasghar commented Apr 3, 2020

Here's a youtube video of us putting this together: https://www.youtube.com/watch?v=s7_RcRqO7lE

jjasghar added 2 commits Apr 4, 2020
- You need SMTP settings so huginn can email you.
- Also added a note to remind you to set your settings.

Signed-off-by: JJ Asghar <[email protected]>
- Added github and twitter lines to values.yaml
- added a message in notes.txt about it
- added the env vars to the deployment.yaml

Signed-off-by: JJ Asghar <[email protected]>
@dsander
Copy link
Collaborator

@dsander dsander commented Apr 7, 2020

First of all thank you! I have to admit, I am a bit intimidated. The jokes I read about helm/kubernetes were not wrong, that is a LOT of yaml 😯 I put your video on my watch list to learn a bit about it, however can't promise that we will merge this (if we do you would effectively become a maintainer and we would direct questions about the chart in your direction 😉 ).

How is persistence handled in this setup (or with helm charts in general)? When using the huginn/huginn image one would need persistence for the /var/lib/mysql volume, for postgres it would be a volume of the database container.

I know we don't have any documentation about "best practices" on how to deploy the docker images to a "serious" production setup, however here are some points I learned over the years:

  • use the huginn/single-process image
  • use postgres as the database, not because it's better/faster/whatever but because it causes less problem or surprises (at least in my experience)
  • start one container per process
    • every setup should have one of these:
    • to scale the amount of job processing the user should be able to scale the amount of background job worker containers

As an example, here is the docker-compose.yml a customer is using (even though the postgres version is a bit dated because the setup as been running for a while):

version: "2"
services:
  nginx:
    image: nginx:1.16
    container_name: nginx
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - "/etc/nginx/conf.d"
      - "/etc/nginx/vhost.d"
      - "/usr/share/nginx/html"
      - "./certs:/etc/nginx/certs:ro"
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"

  nginx-gen:
    image: jwilder/docker-gen:0.7.0
    container_name: nginx-gen
    restart: always
    volumes_from:
      - nginx
    depends_on:
      - nginx
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
    entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf

  letsencrypt-nginx-proxy-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion:v1.12.1
    container_name: letsencrypt-nginx-proxy-companion
    restart: always
    volumes_from:
      - nginx
    depends_on:
      - nginx-gen
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./certs:/etc/nginx/certs:rw"
    environment:
      - NGINX_DOCKER_GEN_CONTAINER=nginx-gen

  postgres:
    image: postgres:10.0
    restart: always
    volumes:
      - ./postgresql-data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: myhuginnpassword
      POSTGRES_USER: huginn

  huginn_web:
    extends:
      file: base.yml
      service: huginn
    environment:
      LETSENCRYPT_EMAIL: '[email protected]'
      LETSENCRYPT_HOST: 'some-dmain.com'
      VIRTUAL_HOST: 'some-dmain.com'
    depends_on:
      - postgres
      - letsencrypt-nginx-proxy-companion
    links:
      - postgres

  huginn_agent_runner:
    extends:
      file: base.yml
      service: huginn
    links:
      - postgres
    command: /scripts/init bin/agent_runner.rb

  huginn_dj:
    extends:
      file: base.yml
      service: huginn
    links:
      - postgres
    command: /scripts/init script/delayed_job run

  huginn_dj2:
    extends:
      file: base.yml
      service: huginn
    links:
      - postgres
    command: /scripts/init script/delayed_job run

  huginn_dj3:
    extends:
      file: base.yml
      service: huginn
    links:
      - postgres
    command: /scripts/init script/delayed_job run
@jjasghar
Copy link
Contributor Author

@jjasghar jjasghar commented Apr 8, 2020

Not gonna lie @dsander it is a ton yep. If you'd want I can move this over to another repo/namespace.

I'm building while I can, so it'll be slowly building up.

You've had some really good feedback thank you, and you're right I need to break out the services, I'll start working towards that.

@jjasghar
Copy link
Contributor Author

@jjasghar jjasghar commented Apr 10, 2020

OK, so taking your advice we've moved this over to my charts repo: https://github.com/jjasghar/charts/ it's not production-ready, but it works per your suggestions/best practices.

I'll keep this PR open till it's "done" then we maybe we can point to it?

I'm hoping to get it into hub.helm.sh one day too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.