Partially functional elabftw implementation

This commit is contained in:
Cian Hughes
2024-01-12 09:50:45 +00:00
parent 2f14cb1722
commit d869a1b241
2 changed files with 31 additions and 10 deletions

9
deploy
View File

@@ -21,7 +21,8 @@ def fetch_repository_url() -> str:
def docker_deploy_stack(username: str, password: str, stack_name: Optional[str] = "stack"): 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 # Create an API client
client = portainer.ApiClient() client = portainer.ApiClient()
client.configuration.host = "http://127.0.0.1:9000/api" 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( stacks.stack_create_docker_swarm_repository(
endpoint_id=endpoint_id, endpoint_id=endpoint_id,
body = portainer.StacksSwarmStackFromGitRepositoryPayload( body = portainer.StacksSwarmStackFromGitRepositoryPayload(
auto_update=portainer.PortainerAutoUpdateSettings( # auto_update=portainer.PortainerAutoUpdateSettings(
interval="60m", # interval="60m",
), # ),
name=stack_name, name=stack_name,
compose_file="stack.yaml", compose_file="stack.yaml",
swarm_id=docker.from_env().swarm.id, swarm_id=docker.from_env().swarm.id,

View File

@@ -43,6 +43,7 @@ services:
- traefik:/etc/traefik - traefik:/etc/traefik
- letsencrypt:/letsencrypt - letsencrypt:/letsencrypt
deploy: deploy:
replicas: 1
restart_policy: restart_policy:
condition: on-failure condition: on-failure
networks: networks:
@@ -70,6 +71,7 @@ services:
volumes: volumes:
- neo4j:/data - neo4j:/data
deploy: deploy:
replicas: 1
restart_policy: restart_policy:
condition: on-failure condition: on-failure
networks: networks:
@@ -85,6 +87,7 @@ services:
# tty: true # tty: true
# stdin_open: true # stdin_open: true
# deploy: # deploy:
# replicas: 1
# restart_policy: # restart_policy:
# condition: on-failure # condition: on-failure
# ports: # ports:
@@ -111,8 +114,14 @@ services:
tty: true tty: true
stdin_open: true stdin_open: true
deploy: deploy:
replicas: 1
restart_policy: restart_policy:
condition: on-failure condition: on-failure
# healthcheck:
# test: "/usr/bin/mysql --user=elabftw --password=test --execute 'SHOW DATABASES;'"
# interval: 5s
# timeout: 5s
# retries: 20
cap_drop: cap_drop:
- AUDIT_WRITE - AUDIT_WRITE
- MKNOD - MKNOD
@@ -126,8 +135,10 @@ services:
environment: environment:
MYSQL_DATABASE: "elabftw" MYSQL_DATABASE: "elabftw"
MYSQL_USER: "elabftw" MYSQL_USER: "elabftw"
MYSQL_PASSWORD: /run/secrets/elabftw_sql_key MYSQL_PASSWORD: "test" # MYSQL_PASSWORD_FILE: /run/secrets/elabftw_sql_key
MYSQL_RANDOM_ROOT_PASSWORD: 1 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" TZ: "Europe/Paris"
volumes: volumes:
- elabftw_sql:/var/lib/mysql - elabftw_sql:/var/lib/mysql
@@ -142,6 +153,7 @@ services:
volumes: volumes:
- grafana:/var/lib/grafana - grafana:/var/lib/grafana
deploy: deploy:
replicas: 1
restart_policy: restart_policy:
condition: on-failure condition: on-failure
networks: networks:
@@ -158,6 +170,7 @@ services:
volumes: volumes:
- web:/usr/share/nginx/html - web:/usr/share/nginx/html
deploy: deploy:
replicas: 1
restart_policy: restart_policy:
condition: on-failure condition: on-failure
networks: networks:
@@ -173,6 +186,7 @@ services:
ports: ports:
- "5005:5005" - "5005:5005"
deploy: deploy:
replicas: 1
restart_policy: restart_policy:
condition: on-failure condition: on-failure
networks: networks:
@@ -201,6 +215,7 @@ services:
# tty: true # tty: true
# stdin_open: true # stdin_open: true
deploy: deploy:
replicas: 1
restart_policy: restart_policy:
condition: on-failure condition: on-failure
depends_on: depends_on:
@@ -218,25 +233,27 @@ services:
- elabftw_secret_key - elabftw_secret_key
environment: environment:
SECRET_KEY: /run/secrets/elabftw_secret_key SECRET_KEY: /run/secrets/elabftw_secret_key
DB_HOST: "mysql" DB_HOST: "localhost"
DB_PORT: "3306" DB_PORT: "3306"
DB_NAME: "elabftw" DB_NAME: "elabftw"
DB_USER: "elabftw" DB_USER: "elabftw"
DB_PASSWORD: "/run/secrets/elabftw_sql_key" DB_PASSWORD: "test" # "/run/secrets/elabftw_sql_key"
# - DB_PASSWORD=$$DB_PASSWORD # - DB_PASSWORD=$$DB_PASSWORD
# DB_CERT_PATH: "/mysql-cert/cert.pem" # DB_CERT_PATH: "/mysql-cert/cert.pem"
PHP_TIMEZONE: "Europe/Paris" PHP_TIMEZONE: "Europe/Paris"
TZ: "Europe/Paris" TZ: "Europe/Paris"
SERVER_NAME: "I-Form eLabFTW" 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 DISABLE_HTTPS: 1
ENABLE_LETSENCRYPT: 0 ENABLE_LETSENCRYPT: 0
ports: ports:
- "443:443" - "3148:443"
# - "443:443"
volumes: volumes:
- elabftw_uploads:/elabftw/uploads - elabftw_uploads:/elabftw/uploads
- elabftw_var:/var/elabftw - elabftw_var:/var/elabftw
- elabftw_etc:/etc/elabftw - elabftw_etc:/etc/elabftw
- elabftw_sql:/var/lib/mysql
# if you have enabled letsencrypt, uncomment the line below # if you have enabled letsencrypt, uncomment the line below
# path to the folder with TLS certificate + private key # path to the folder with TLS certificate + private key
# host:container # host:container
@@ -251,6 +268,7 @@ services:
# solr: # solr:
# image: coronawhy/solr:8.9.0 # image: coronawhy/solr:8.9.0
# deploy: # deploy:
# replicas: 1
# restart_policy: # restart_policy:
# condition: on-failure # condition: on-failure
# privileged: true # privileged: true
@@ -300,6 +318,7 @@ services:
# # All Routing is done by Traefik, just tell minio where to redirect to. # # All Routing is done by Traefik, just tell minio where to redirect to.
# - MINIO_BROWSER_REDIRECT_URL=http://stash.localhost # - MINIO_BROWSER_REDIRECT_URL=http://stash.localhost
# deploy: # deploy:
# replicas: 1
# labels: # labels:
# - traefik.enable=true # - traefik.enable=true
# - traefik.http.routers.minio.service=minio # - traefik.http.routers.minio.service=minio
@@ -316,6 +335,7 @@ services:
# tty: true # DEBUG # tty: true # DEBUG
# stdin_open: true # DEBUG # stdin_open: true # DEBUG
# deploy: # deploy:
# replicas: 1
# restart_policy: # restart_policy:
# condition: on-failure # condition: on-failure
# privileged: true # privileged: true