From d869a1b24155106d24eb6673f32d5c9981db0e09 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Fri, 12 Jan 2024 09:50:45 +0000 Subject: [PATCH] Partially functional elabftw implementation --- deploy | 9 +++++---- stack.yaml | 32 ++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/deploy b/deploy index df003b1..2e253dd 100755 --- a/deploy +++ b/deploy @@ -21,7 +21,8 @@ def fetch_repository_url() -> str: def docker_deploy_stack(username: str, password: str, stack_name: Optional[str] = "stack"): - """Deploys the stack using the portainer api, to allow for complete control over the stack""" + """Deploys the stack using the portainer api from the github repo. + This allows portainer to have full control over the stack""" # Create an API client client = portainer.ApiClient() client.configuration.host = "http://127.0.0.1:9000/api" @@ -43,9 +44,9 @@ def docker_deploy_stack(username: str, password: str, stack_name: Optional[str] stacks.stack_create_docker_swarm_repository( endpoint_id=endpoint_id, body = portainer.StacksSwarmStackFromGitRepositoryPayload( - auto_update=portainer.PortainerAutoUpdateSettings( - interval="60m", - ), + # auto_update=portainer.PortainerAutoUpdateSettings( + # interval="60m", + # ), name=stack_name, compose_file="stack.yaml", swarm_id=docker.from_env().swarm.id, diff --git a/stack.yaml b/stack.yaml index c35d3f5..742715c 100644 --- a/stack.yaml +++ b/stack.yaml @@ -43,6 +43,7 @@ services: - traefik:/etc/traefik - letsencrypt:/letsencrypt deploy: + replicas: 1 restart_policy: condition: on-failure networks: @@ -70,6 +71,7 @@ services: volumes: - neo4j:/data deploy: + replicas: 1 restart_policy: condition: on-failure networks: @@ -85,6 +87,7 @@ services: # tty: true # stdin_open: true # deploy: + # replicas: 1 # restart_policy: # condition: on-failure # ports: @@ -111,8 +114,14 @@ services: tty: true stdin_open: true deploy: + replicas: 1 restart_policy: condition: on-failure + # healthcheck: + # test: "/usr/bin/mysql --user=elabftw --password=test --execute 'SHOW DATABASES;'" + # interval: 5s + # timeout: 5s + # retries: 20 cap_drop: - AUDIT_WRITE - MKNOD @@ -126,8 +135,10 @@ services: environment: MYSQL_DATABASE: "elabftw" MYSQL_USER: "elabftw" - MYSQL_PASSWORD: /run/secrets/elabftw_sql_key - MYSQL_RANDOM_ROOT_PASSWORD: 1 + MYSQL_PASSWORD: "test" # MYSQL_PASSWORD_FILE: /run/secrets/elabftw_sql_key + MYSQL_ROOT_PASSWORD: "test" # MYSQL_RANDOM_ROOT_PASSWORD: 1 + MYSQL_HOST: "localhost" + MYSQL_ROOT_HOST: "localhost" # Must allow root access from any host or won't work on swarm TZ: "Europe/Paris" volumes: - elabftw_sql:/var/lib/mysql @@ -142,6 +153,7 @@ services: volumes: - grafana:/var/lib/grafana deploy: + replicas: 1 restart_policy: condition: on-failure networks: @@ -158,6 +170,7 @@ services: volumes: - web:/usr/share/nginx/html deploy: + replicas: 1 restart_policy: condition: on-failure networks: @@ -173,6 +186,7 @@ services: ports: - "5005:5005" deploy: + replicas: 1 restart_policy: condition: on-failure networks: @@ -201,6 +215,7 @@ services: # tty: true # stdin_open: true deploy: + replicas: 1 restart_policy: condition: on-failure depends_on: @@ -218,25 +233,27 @@ services: - elabftw_secret_key environment: SECRET_KEY: /run/secrets/elabftw_secret_key - DB_HOST: "mysql" + DB_HOST: "localhost" DB_PORT: "3306" DB_NAME: "elabftw" DB_USER: "elabftw" - DB_PASSWORD: "/run/secrets/elabftw_sql_key" + DB_PASSWORD: "test" # "/run/secrets/elabftw_sql_key" # - DB_PASSWORD=$$DB_PASSWORD # DB_CERT_PATH: "/mysql-cert/cert.pem" PHP_TIMEZONE: "Europe/Paris" TZ: "Europe/Paris" SERVER_NAME: "I-Form eLabFTW" - SITE_URL: "elab.i-form.ie" + SITE_URL: "127.0.0.1:443" # "elab.i-form.ie" DISABLE_HTTPS: 1 ENABLE_LETSENCRYPT: 0 ports: - - "443:443" + - "3148:443" + # - "443:443" volumes: - elabftw_uploads:/elabftw/uploads - elabftw_var:/var/elabftw - elabftw_etc:/etc/elabftw + - elabftw_sql:/var/lib/mysql # if you have enabled letsencrypt, uncomment the line below # path to the folder with TLS certificate + private key # host:container @@ -251,6 +268,7 @@ services: # solr: # image: coronawhy/solr:8.9.0 # deploy: + # replicas: 1 # restart_policy: # condition: on-failure # privileged: true @@ -300,6 +318,7 @@ services: # # All Routing is done by Traefik, just tell minio where to redirect to. # - MINIO_BROWSER_REDIRECT_URL=http://stash.localhost # deploy: + # replicas: 1 # labels: # - traefik.enable=true # - traefik.http.routers.minio.service=minio @@ -316,6 +335,7 @@ services: # tty: true # DEBUG # stdin_open: true # DEBUG # deploy: + # replicas: 1 # restart_policy: # condition: on-failure # privileged: true