Compare commits
21 Commits
e4f8cbed2b
...
b0d9185229
| Author | SHA1 | Date | |
|---|---|---|---|
| b0d9185229 | |||
| 627d13df13 | |||
| 53070e9667 | |||
| b71bdcaad6 | |||
| 4e5914eb1e | |||
| 8f0393a69f | |||
| 9a488f3502 | |||
| 2026ffe2b2 | |||
| 013dd0c6b4 | |||
| bd6e8c719d | |||
| 62ee9ebc72 | |||
| 9b1a819cd1 | |||
| c5904f1be5 | |||
| 4f3552422b | |||
| 4b67514864 | |||
| 18f7dff087 | |||
| 2a71acb7b8 | |||
| 855d0f44bb | |||
| 6fe11d051b | |||
| 8053a6ca26 | |||
| a283e2cb1a |
7
LICENSE
Normal file
7
LICENSE
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright 2025 chriswin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -7,6 +7,7 @@
|
||||
include:
|
||||
- path:
|
||||
- ${DB_PATH}/adminer/adminer.yml
|
||||
- ${DB_PATH}/databasus/databasus.yml
|
||||
- ${DB_PATH}/lldap/lldap.yml
|
||||
- ${DB_PATH}/mariadb/mariadb.yml
|
||||
- ${DB_PATH}/postgres/postgres.yml
|
||||
|
||||
19
project/db/databasus/databasus.yml
Normal file
19
project/db/databasus/databasus.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
services:
|
||||
databasus:
|
||||
extends:
|
||||
file: ${TEMPLATES_PATH}
|
||||
service: default
|
||||
image: databasus/databasus:v2.21.5
|
||||
container_name: databasus
|
||||
ports:
|
||||
- 8086:4005
|
||||
networks:
|
||||
- ip4net
|
||||
volumes:
|
||||
- ${DB_PATH}/databasus/data:/databasus-data
|
||||
labels:
|
||||
# Traefik
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.databasus.rule=Host(`databasus.${LOCAL_DOMAIN}`)"
|
||||
- "traefik.http.routers.databasus.entrypoints=https"
|
||||
- "traefik.http.routers.databasus.tls=true"
|
||||
@@ -39,7 +39,6 @@ services:
|
||||
- "traefik.http.routers.lldap.rule=Host(`ldap.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.lldap.entrypoints=https"
|
||||
- "traefik.http.routers.lldap.tls=true"
|
||||
- "traefik.http.routers.lldap.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.lldap.service=lldap-service"
|
||||
- "traefik.http.services.lldap-service.loadbalancer.server.port=17170"
|
||||
- "traefik.http.services.lldap-service.loadbalancer.server.scheme=http"
|
||||
|
||||
@@ -36,7 +36,6 @@ services:
|
||||
# Traefik
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.authelia.rule=Host(`auth.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.authelia.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.authelia.entryPoints=https"
|
||||
- "traefik.http.routers.authelia.tls=true"
|
||||
- "traefik.http.routers.authelia.service=authelia-svc"
|
||||
|
||||
BIN
project/infrastructure/traefik/log-dashboard/dashboard/agents.db
Normal file
BIN
project/infrastructure/traefik/log-dashboard/dashboard/agents.db
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"/logs/traefik.log": 69278
|
||||
}
|
||||
@@ -35,6 +35,68 @@ services:
|
||||
- "traefik.http.routers.traefik.entrypoints=https"
|
||||
- "traefik.http.routers.traefik.tls=true"
|
||||
|
||||
traefik-agent:
|
||||
extends:
|
||||
file: ${TEMPLATES_PATH}
|
||||
service: default
|
||||
image: hhftechnology/traefik-log-dashboard-agent:2.4.0
|
||||
container_name: traefik-log-dashboard-agent
|
||||
networks:
|
||||
- ip4net
|
||||
ports:
|
||||
- "8078:5000"
|
||||
volumes:
|
||||
- "/var/log/crowdsec/:/logs:ro"
|
||||
- "${INFRA_PATH}/traefik/log-dashboard/positions:/data"
|
||||
environment:
|
||||
TRAEFIK_LOG_DASHBOARD_ACCESS_PATH: /logs/traefik.log
|
||||
TRAEFIK_LOG_DASHBOARD_AUTH_TOKEN: ${TRAEFIK_DASHBOARD_TOKEN}
|
||||
TRAEFIK_LOG_DASHBOARD_SYSTEM_MONITORING: true
|
||||
TRAEFIK_LOG_DASHBOARD_LOG_FORMAT: json
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD",
|
||||
"wget",
|
||||
"--no-verbose",
|
||||
"--tries=1",
|
||||
"--spider",
|
||||
"http://localhost:5000/api/logs/status",
|
||||
]
|
||||
interval: 2m
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
traefik-dashboard:
|
||||
extends:
|
||||
file: ${TEMPLATES_PATH}
|
||||
service: default
|
||||
image: hhftechnology/traefik-log-dashboard:2.4.0
|
||||
container_name: traefik-log-dashboard
|
||||
networks:
|
||||
- ip4net
|
||||
ports:
|
||||
- "8077:3000"
|
||||
volumes:
|
||||
- ./data/dashboard:/app/data
|
||||
- "${INFRA_PATH}/traefik/log-dashboard/dashboard:/app/data"
|
||||
- "${INFRA_PATH}/traefik/log-dashboard/positions:/data"
|
||||
environment:
|
||||
AGENT_API_URL: http://192.168.178.35:8078
|
||||
AGENT_API_TOKEN: ${TRAEFIK_DASHBOARD_TOKEN}
|
||||
# Display Configuration
|
||||
NEXT_PUBLIC_SHOW_DEMO_PAGE: false
|
||||
depends_on:
|
||||
traefik-agent:
|
||||
condition: service_healthy
|
||||
labels:
|
||||
# traefik
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.traefik-log-dashboard.rule=Host(`traefik-dashboard.${LOCAL_DOMAIN}`)"
|
||||
- "traefik.http.routers.traefik-log-dashboard.entrypoints=https"
|
||||
- "traefik.http.routers.traefik-log-dashboard.tls=true"
|
||||
|
||||
whoami:
|
||||
extends:
|
||||
file: ${TEMPLATES_PATH}
|
||||
|
||||
@@ -18,7 +18,6 @@ services:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.audiobookshelf.rule=Host(`audiobookshelf.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.audiobookshelf.entrypoints=https"
|
||||
- "traefik.http.routers.audiobookshelf.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.audiobookshelf.tls=true"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.audiobookshelf.middlewares=crowdsec-bouncer@file"
|
||||
|
||||
@@ -25,7 +25,6 @@ services:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.immich-server.rule=Host(`immich.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.immich-server.entrypoints=https"
|
||||
- "traefik.http.routers.immich-server.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.immich-server.tls=true"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.immich-server.middlewares=crowdsec-bouncer@file"
|
||||
@@ -43,7 +42,7 @@ services:
|
||||
|
||||
# https://github.com/Salvoxia/immich-folder-album-creator
|
||||
# one time run:
|
||||
# docker run -e -e API_URL="https://immich.crescentec.xyz/api/" -e API_KEY="qTaebdVMtph9yD0pSJRJDQJkDEpexiXNMJ5V5HBEnA" -e ROOT_PATH="/usr/src/app/external" -e LOG_LEVEL="DEBUG" salvoxia/immich-folder-album-creator:latest /script/immich_auto_album.sh
|
||||
# docker run -e -e API_URL="https://immich.${PUBLIC_DOMAIN}/api/" -e API_KEY="qTaebdVMtph9yD0pSJRJDQJkDEpexiXNMJ5V5HBEnA" -e ROOT_PATH="/usr/src/app/external" -e LOG_LEVEL="DEBUG" salvoxia/immich-folder-album-creator:latest /script/immich_auto_album.sh
|
||||
immich-folder-album-creator:
|
||||
extends:
|
||||
file: ${TEMPLATES_PATH}
|
||||
@@ -51,7 +50,7 @@ services:
|
||||
container_name: immich_folder_album_creator
|
||||
image: salvoxia/immich-folder-album-creator:0.24.0
|
||||
environment:
|
||||
API_URL: https://immich.crescentec.xyz/api
|
||||
API_URL: https://immich.${PUBLIC_DOMAIN}/api
|
||||
API_KEY: qTaebdVMtph9yD0pSJRJDQJkDEpexiXNMJ5V5HBEnA
|
||||
ROOT_PATH: /usr/src/app/external
|
||||
CRON_EXPRESSION: "0 * * * *"
|
||||
|
||||
@@ -4,7 +4,7 @@ services:
|
||||
file: ${TEMPLATES_PATH}
|
||||
service: default
|
||||
container_name: prometheus
|
||||
image: prom/prometheus:v3.9.0
|
||||
image: prom/prometheus:v3.9.1
|
||||
ports:
|
||||
- 9090:9090
|
||||
networks:
|
||||
|
||||
@@ -21,6 +21,5 @@ services:
|
||||
- "traefik.http.routers.freshrss.rule=Host(`rss.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.freshrss.entrypoints=https"
|
||||
- "traefik.http.routers.freshrss.tls=true"
|
||||
- "traefik.http.routers.freshrss.tls.certresolver=myresolver"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.freshrss.middlewares=crowdsec-bouncer@file"
|
||||
|
||||
@@ -3,7 +3,7 @@ services:
|
||||
extends:
|
||||
file: ${TEMPLATES_PATH}
|
||||
service: default
|
||||
image: ghost:6.10.3-alpine
|
||||
image: ghost:6.12.0-alpine
|
||||
container_name: ghost
|
||||
ports:
|
||||
- 4016:2368
|
||||
|
||||
@@ -41,7 +41,6 @@ services:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.gitea.rule=Host(`gitea.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.gitea.entrypoints=https"
|
||||
- "traefik.http.routers.gitea.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.gitea.tls=true"
|
||||
- "traefik.http.routers.gitea.service=gitea-service"
|
||||
- "traefik.http.services.gitea-service.loadbalancer.server.port=4002"
|
||||
|
||||
@@ -3,7 +3,7 @@ services:
|
||||
extends:
|
||||
file: ${TEMPLATES_PATH}
|
||||
service: default
|
||||
image: ghcr.io/home-assistant/home-assistant:2026.1.0
|
||||
image: ghcr.io/home-assistant/home-assistant:2026.1.1
|
||||
container_name: home-assistant
|
||||
networks:
|
||||
- ip4net
|
||||
|
||||
@@ -33,7 +33,6 @@ services:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.mealie.rule=Host(`mealie.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.mealie.entrypoints=https"
|
||||
- "traefik.http.routers.mealie.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.mealie.tls=true"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.mealie.middlewares=crowdsec-bouncer@file"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Start with the official n8n image
|
||||
FROM n8nio/n8n:2.3.0
|
||||
FROM n8nio/n8n:2.3.2
|
||||
|
||||
# Copy apk and its deps from Alpine 3.23
|
||||
COPY --from=alpine:3.23 /sbin/apk /sbin/apk
|
||||
@@ -9,7 +9,11 @@ COPY --from=alpine:3.23 /usr/lib/libapk.so* /usr/lib/
|
||||
USER root
|
||||
|
||||
# Install Chromium and necessary dependencies for Puppeteer
|
||||
RUN apk add --no-cache \
|
||||
RUN set -x \
|
||||
&& apk update \
|
||||
&& apk upgrade \
|
||||
&& apk add --no-cache \
|
||||
udev \
|
||||
chromium \
|
||||
nss \
|
||||
freetype \
|
||||
@@ -23,9 +27,25 @@ RUN apk add --no-cache \
|
||||
# Set environment variable for Puppeteer to find Chromium
|
||||
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||
ENV XDG_CONFIG_HOME=/tmp/.chromium
|
||||
ENV XDG_CACHE_HOME=/tmp/.chromium
|
||||
|
||||
# Install Puppeteer
|
||||
RUN npm install puppeteer
|
||||
|
||||
# Install restic and rclone for backups
|
||||
RUN apk add --no-cache \
|
||||
restic \
|
||||
curl \
|
||||
unzip
|
||||
|
||||
# Download and install rclone
|
||||
RUN curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip \
|
||||
&& unzip rclone-current-linux-amd64.zip \
|
||||
&& cd rclone-*-linux-amd64 \
|
||||
&& cp rclone /usr/local/bin/ \
|
||||
&& chmod 755 /usr/local/bin/rclone \
|
||||
&& cd .. && rm -rf rclone-*-linux-amd64*
|
||||
|
||||
# Revert back to non-root (default n8n user)
|
||||
USER node
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ services:
|
||||
- N8N_BLOCK_ENV_ACCESS_IN_NODE=false
|
||||
- MAM_USERNAME=${N8N_MAM_USERNAME}
|
||||
- MAM_PASSWORD=${N8N_MAM_PASSWORD}
|
||||
- RESTIC_PASSWORD=${N8N_RESTIC_PASSWORD}
|
||||
- NODES_EXCLUDE=[]
|
||||
- DB_TYPE=postgresdb
|
||||
- DB_POSTGRESDB_HOST=postgres
|
||||
@@ -25,12 +26,15 @@ services:
|
||||
- DB_POSTGRESDB_SCHEMA=public
|
||||
volumes:
|
||||
- ${SERVICE_PATH}/n8n/data:/home/node/.n8n
|
||||
- ${SERVICE_PATH}/n8n/data/rclone.conf:/home/node/.config/rclone/rclone.conf
|
||||
- ${PWD}/scripts:/home/node/.n8n/external-scripts
|
||||
- ${DB_PATH}/databasus/data/backup:/home/node/.n8n/database
|
||||
- ${EXTERNAL_STORAGE}/:/home/node/.n8n/data
|
||||
labels:
|
||||
# Traefik
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.n8n.rule=Host(`n8n.${LOCAL_DOMAIN}`)"
|
||||
- "traefik.http.routers.n8n.entrypoints=https"
|
||||
- "traefik.http.routers.n8n.tls=true"
|
||||
- "traefik.http.routers.n8n.tls.certresolver=myresolver"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.n8n.middlewares=crowdsec-bouncer@file"
|
||||
|
||||
@@ -17,6 +17,5 @@ services:
|
||||
- "traefik.http.routers.ollama.rule=Host(`ollama.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.ollama.entrypoints=https"
|
||||
- "traefik.http.routers.ollama.tls=true"
|
||||
- "traefik.http.routers.ollama.tls.certresolver=myresolver"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.ollama.middlewares=crowdsec-bouncer@file"
|
||||
|
||||
@@ -33,15 +33,14 @@ services:
|
||||
# PAPERLESS_DISABLE_REGULAR_LOGIN: true
|
||||
# PAPERLESS_ENABLE_HTTP_REMOTE_USER: true
|
||||
# PAPERLESS_HTTP_REMOTE_USER_HEADER_NAME: HTTP_REMOTE_USER
|
||||
# PAPERLESS_LOGOUT_REDIRECT_URL: https://auth.crescentec.xyz/logout
|
||||
# PAPERLESS_LOGOUT_REDIRECT_URL: https://auth.${PUBLIC_DOMAIN}/logout
|
||||
# PAPERLESS_APPS: "allauth.socialaccount.providers.openid_connect"
|
||||
# PAPERLESS_SOCIALACCOUNT_PROVIDERS: '{"openid_connect":{"SCOPE":["openid","profile","email"],"OAUTH_PKCE_ENABLED":true,"APPS":[{"provider_id":"authelia","name":"Authelia","client_id":"paperless","secret":"jzO0JYA35oOojGqxFJUaDXdgdXhuACyq4b3lvOx233wtoSyv19prQfCKah1mwyDv","settings":{"server_url":"https://auth.crescentec.xyz","token_auth_method":"client_secret_basic"}}]}}'
|
||||
# PAPERLESS_SOCIALACCOUNT_PROVIDERS: '{"openid_connect":{"SCOPE":["openid","profile","email"],"OAUTH_PKCE_ENABLED":true,"APPS":[{"provider_id":"authelia","name":"Authelia","client_id":"paperless","secret":"jzO0JYA35oOojGqxFJUaDXdgdXhuACyq4b3lvOx233wtoSyv19prQfCKah1mwyDv","settings":{"server_url":"https://auth.${PUBLIC_DOMAIN}","token_auth_method":"client_secret_basic"}}]}}'
|
||||
labels:
|
||||
# Traefik
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.paperless.rule=Host(`paperless.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.paperless.entrypoints=https"
|
||||
- "traefik.http.routers.paperless.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.paperless.tls=true"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.paperless.middlewares=crowdsec-bouncer@file"
|
||||
|
||||
@@ -14,7 +14,6 @@ services:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.pdf.rule=Host(`pdf.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.pdf.entrypoints=https"
|
||||
- "traefik.http.routers.pdf.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.pdf.tls=true"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.pdf.middlewares=crowdsec-bouncer@file, authelia@file"
|
||||
|
||||
@@ -30,7 +30,6 @@ services:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.radicale.rule=Host(`radicale.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.radicale.entrypoints=https"
|
||||
- "traefik.http.routers.radicale.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.radicale.tls=true"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.radicale.middlewares=crowdsec-bouncer@file"
|
||||
|
||||
@@ -3,7 +3,7 @@ services:
|
||||
extends:
|
||||
file: ${TEMPLATES_PATH}
|
||||
service: default
|
||||
image: vaultwarden/server:1.35.1
|
||||
image: vaultwarden/server:1.35.2
|
||||
container_name: vaultwarden
|
||||
ports:
|
||||
- 4018:80
|
||||
@@ -27,6 +27,5 @@ services:
|
||||
- "traefik.http.routers.vaultwarden.rule=Host(`vaultwarden.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.vaultwarden.entrypoints=https"
|
||||
- "traefik.http.routers.vaultwarden.tls=true"
|
||||
- "traefik.http.routers.vaultwarden.tls.certresolver=myresolver"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.vaultwarden.middlewares=crowdsec-bouncer@file"
|
||||
|
||||
@@ -27,7 +27,6 @@ services:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.vikunja.rule=Host(`vikunja.${PUBLIC_DOMAIN}`)"
|
||||
- "traefik.http.routers.vikunja.entrypoints=https"
|
||||
- "traefik.http.routers.vikunja.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.vikunja.tls=true"
|
||||
# Middlewares
|
||||
- "traefik.http.routers.vikunja.middlewares=crowdsec-bouncer@file"
|
||||
|
||||
26
scripts/certificates/generate_certificate.sh
Executable file
26
scripts/certificates/generate_certificate.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
# https://stackoverflow.com/questions/59738140/why-is-firefox-not-trusting-my-self-signed-certificate
|
||||
# generate all the certificates
|
||||
# import certificate root-ca.crt in firefox
|
||||
# in the config of traefik set the server.key and server.crt in the tls store
|
||||
|
||||
openssl req -x509 -nodes \
|
||||
-newkey RSA:2048 \
|
||||
-keyout root-ca.key \
|
||||
-days 365 \
|
||||
-out root-ca.crt \
|
||||
-subj '/C=CH/ST=Denial/L=Earth/O=Crescentec/CN=root_CA_crescentec'
|
||||
|
||||
openssl req -nodes \
|
||||
-newkey rsa:2048 \
|
||||
-keyout server.key \
|
||||
-out server.csr \
|
||||
-subj '/C=CH/ST=Denial/L=Earth/O=Crescentec/CN=server_crescentec'
|
||||
|
||||
openssl x509 -req \
|
||||
-CA root-ca.crt \
|
||||
-CAkey root-ca.key \
|
||||
-in server.csr \
|
||||
-out server.crt \
|
||||
-days 365 \
|
||||
-CAcreateserial \
|
||||
-extfile <(printf "subjectAltName = DNS:*.${LOCAL_DOMAIN}\nauthorityKeyIdentifier = keyid,issuer\nbasicConstraints = CA:FALSE\nkeyUsage = digitalSignature, keyEncipherment\nextendedKeyUsage=serverAuth")
|
||||
17
scripts/data-backup/README.md
Normal file
17
scripts/data-backup/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
Inspired by the [blog](https://www.ericbette.com/configuring-a-remote-backup-solution-using-restic-and-rclone)
|
||||
|
||||
# List of commands:
|
||||
|
||||
## Installation
|
||||
- Install restic and rclone baremetal
|
||||
|
||||
## Setting up rclone:
|
||||
- run: rclone config or follow the instructions on the provider (infomaniak in my case)
|
||||
- run: rclone listremotes to confirm the server link creation
|
||||
|
||||
## Setting up backup repository with restic
|
||||
- Save password in env variable, by running: echo export RESTIC_PASSWORD=my_password >> ~/.zshrc
|
||||
- Initialize repository: restic -r rclone:example-remote:example-repo init
|
||||
- Run the backup: restic -r rclone:example-remote:example-repo --verbose backup /path/to/backup
|
||||
- List the snapshots: restic -r rclone:example-remote:example-repo snapshots
|
||||
- Restore the backup: restic -r rclone:example-remote:example-repo restore latest --target /target --path "/target"
|
||||
5
scripts/data-backup/backup-infomaniak-calendars-contacts.sh
Executable file
5
scripts/data-backup/backup-infomaniak-calendars-contacts.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
LOG_FILE="/home/node/.n8n/external-scripts/data-backup/logs/log.log"
|
||||
echo "------------------------------------------------------------------------" >> "$LOG_FILE"
|
||||
echo "$(date) - Script for calendars-contact started" >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:calendars-contacts backup /home/node/.n8n/data/calendars-contacts >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:calendars-contacts forget --keep-last 3 --prune >> "$LOG_FILE"
|
||||
5
scripts/data-backup/backup-infomaniak-databases.sh
Executable file
5
scripts/data-backup/backup-infomaniak-databases.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
LOG_FILE="/home/node/.n8n/external-scripts/data-backup/logs/log.log"
|
||||
echo "------------------------------------------------------------------------" >> "$LOG_FILE"
|
||||
echo "$(date) - Script for databases started" >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:databases backup /home/node/.n8n/database >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:databases forget --keep-last 3 --prune >> "$LOG_FILE"
|
||||
6
scripts/data-backup/backup-infomaniak-documents.sh
Executable file
6
scripts/data-backup/backup-infomaniak-documents.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
LOG_FILE="/home/node/.n8n/external-scripts/data-backup/logs/log.log"
|
||||
echo "------------------------------------------------------------------------" >> "$LOG_FILE"
|
||||
echo "$(date) - Script for documents started" >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:documents backup /home/node/.n8n/data/documents >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:documents forget --keep-last 3 --prune >> "$LOG_FILE"
|
||||
|
||||
5
scripts/data-backup/backup-infomaniak-music.sh
Executable file
5
scripts/data-backup/backup-infomaniak-music.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
LOG_FILE="/home/node/.n8n/external-scripts/data-backup/logs/log.log"
|
||||
echo "------------------------------------------------------------------------" >> "$LOG_FILE"
|
||||
echo "$(date) - Script for music started" >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:music backup /home/node/.n8n/data/media/music >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:music forget --keep-last 3 --prune >> "$LOG_FILE"
|
||||
5
scripts/data-backup/backup-infomaniak-notes.sh
Executable file
5
scripts/data-backup/backup-infomaniak-notes.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
LOG_FILE="/home/node/.n8n/external-scripts/data-backup/logs/log.log"
|
||||
echo "------------------------------------------------------------------------" >> "$LOG_FILE"
|
||||
echo "$(date) - Script for notes started" >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:notes backup /home/node/.n8n/data/notes >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:notes forget --keep-last 3 --prune >> "$LOG_FILE"
|
||||
5
scripts/data-backup/backup-infomaniak-passwords.sh
Executable file
5
scripts/data-backup/backup-infomaniak-passwords.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
LOG_FILE="/home/node/.n8n/external-scripts/data-backup/logs/log.log"
|
||||
echo "------------------------------------------------------------------------" >> "$LOG_FILE"
|
||||
echo "$(date) - Script for passwords started" >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:passwords backup /home/node/.n8n/data/passwords >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:passwords forget --keep-last 3 --prune >> "$LOG_FILE"
|
||||
5
scripts/data-backup/backup-infomaniak-pictures.sh
Executable file
5
scripts/data-backup/backup-infomaniak-pictures.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
LOG_FILE="/home/node/.n8n/external-scripts/data-backup/logs/log.log"
|
||||
echo "------------------------------------------------------------------------" >> "$LOG_FILE"
|
||||
echo "$(date) - Script for pictures started" >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:pictures backup /home/node/.n8n/data/media/pictures >> "$LOG_FILE"
|
||||
restic -r rclone:sb_project_SBI-CW231949:pictures forget --keep-last 3 --prune >> "$LOG_FILE"
|
||||
72
scripts/database-backup/db_backup_script.sh
Normal file
72
scripts/database-backup/db_backup_script.sh
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Cron job check the logs
|
||||
|
||||
## Executing the script
|
||||
# bash db_backup_script.sh
|
||||
|
||||
## command used to back up
|
||||
# docker exec DOCKER_CONTAINER pg_dump -U postgres -Fc DATABASE_NAME > BACKUP_FILE.DUMP
|
||||
|
||||
## command used to restore
|
||||
# directory where the backup is saved in in the docker container: /var/lib/postgresql/data
|
||||
# for example: docker exec postgres pg_restore -U postgres -d vikunja-backup /var/lib/postgresql/data/backup/vikunja-2024-01-31.dump
|
||||
# docker exec DOCKER_CONTAINER pg_restore -U postgres -d DATABASE_NAME /var/lib/postgresql/data/backup/BACKUP_FILE.DUMP
|
||||
|
||||
# Date format
|
||||
YEAR=$(date +"%Y")
|
||||
MONTH=$(date +"%m")
|
||||
DAY=$(date +"%d")
|
||||
NOW=$(date +"%Y-%m-%d")
|
||||
|
||||
BACKUP_DIRECTORY="/home/debian/docker/compose/project/db/postgres/data"
|
||||
|
||||
# Docker container with DB to backup
|
||||
DB_1="postgres"
|
||||
DB_2="postgres-with-pg-vector"
|
||||
|
||||
back_up_db() {
|
||||
|
||||
# sql to list all databases
|
||||
DATABASE_NAME=$(docker exec $1 psql -U postgres -t -c 'SELECT datname FROM pg_database WHERE datistemplate = false;')
|
||||
|
||||
# pg_dump command
|
||||
PGDUMP="docker exec $1 pg_dump -U postgres -Fc"
|
||||
|
||||
for i in $DATABASE_NAME; do
|
||||
|
||||
# ignoring postgres db
|
||||
if [[ "$i" != "postgres" ]]; then
|
||||
|
||||
echo "Backing up database $i"
|
||||
# backup path to file
|
||||
BACKFILE="$BACKUP_DIRECTORY/backup/$i-$NOW.dump"
|
||||
$PGDUMP $i > $BACKFILE
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
clean_up_backups() {
|
||||
|
||||
echo "Looking for dumps to prune in folder: $BACKUP_DIRECTORY/backup/"
|
||||
|
||||
# keep one backup per year, month and last two days
|
||||
BACKUP_YEAR="*-$YEAR-02-01.dump"
|
||||
BACKUP_MONTH="*-$YEAR-$MONTH-01.dump"
|
||||
BACKUP_DAY="*-$YEAR-$MONTH-$DAY.dump"
|
||||
BACKUP_DAY_1="*-$YEAR-$MONTH-$((DAY-1)).dump"
|
||||
FILE_TO_DELETE=$(find $BACKUP_DIRECTORY/backup/ -type f \( ! -name $BACKUP_YEAR -a ! -name $BACKUP_MONTH -a ! -name $BACKUP_DAY -a ! -name $BACKUP_DAY_1 \))
|
||||
|
||||
# delete such files
|
||||
for i in $FILE_TO_DELETE; do
|
||||
echo "Pruning $i"
|
||||
rm $i
|
||||
done
|
||||
}
|
||||
|
||||
back_up_db $DB_1
|
||||
back_up_db $DB_2
|
||||
|
||||
clean_up_backups
|
||||
25
scripts/database-backup/overleaf_backup_script.sh
Normal file
25
scripts/database-backup/overleaf_backup_script.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
# Date format
|
||||
NOW=$(date +"%Y-%m-%d")
|
||||
|
||||
OVERLEAF_DIRECTORY="/home/debian/docker/compose/project/service/overleaf-toolkit"
|
||||
|
||||
# Backup config
|
||||
$OVERLEAF_DIRECTORY/bin/backup-config -m tar $OVERLEAF_DIRECTORY/backup/$NOW-overleaf-config-backup.tar
|
||||
# Backup mongo
|
||||
tar --create --file $OVERLEAF_DIRECTORY/backup/$NOW-overleaf-mongo-backup.tar $OVERLEAF_DIRECTORY/data/mongo
|
||||
# Backup sharelatex
|
||||
tar --create --file $OVERLEAF_DIRECTORY/backup/$NOW-overleaf-sharelatex-backup.tar $OVERLEAF_DIRECTORY/data/sharelatex
|
||||
|
||||
# Pruning
|
||||
clean_up_backups() {
|
||||
|
||||
# list all files older than 3 days
|
||||
FILE_TO_DELETE=$(find $OVERLEAF_DIRECTORY/backup/ -type f -mtime 3)
|
||||
|
||||
# delete such files
|
||||
for i in $FILE_TO_DELETE; do
|
||||
rm $i
|
||||
done
|
||||
}
|
||||
|
||||
clean_up_backups
|
||||
47
scripts/mam/mam-login.js
Normal file
47
scripts/mam/mam-login.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
async function loginToMAM(username, password) {
|
||||
try {
|
||||
const browser = await puppeteer.launch({
|
||||
executablePath: '/usr/bin/chromium-browser',
|
||||
headless: true,
|
||||
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu', 'diable-dev-shm-usage']
|
||||
});
|
||||
const page = await browser.newPage();
|
||||
|
||||
console.log("Navigating to MAM login...");
|
||||
await page.goto('https://www.myanonamouse.net/login.php', {
|
||||
waitUntil: 'networkidle2',
|
||||
timeout: 10000
|
||||
});
|
||||
|
||||
const pageTitle = await page.title();
|
||||
|
||||
console.log("Filling in login form...");
|
||||
await page.type('input[name="email"]', username);
|
||||
await page.type('input[name="password"]', password);
|
||||
|
||||
console.log("Submitting login form...");
|
||||
await page.click('input[type="submit"]');
|
||||
await page.waitForNavigation({
|
||||
waitUntil: 'domcontentloaded',
|
||||
timeout: 10000
|
||||
});
|
||||
|
||||
console.log("Login attempt completed.");
|
||||
const cookies = await page.cookies();
|
||||
await browser.close();
|
||||
|
||||
console.log(JSON.stringify(cookies));
|
||||
} catch (err) {
|
||||
console.error("Login failed: ", err);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
const username = process.env.MAM_USERNAME;
|
||||
const password = process.env.MAM_PASSWORD;
|
||||
|
||||
loginToMAM(username, password)
|
||||
.then(cookies => ({ result: 'Success', cookies }))
|
||||
.catch(err => ({ result: 'Error', error: err.message }));
|
||||
Reference in New Issue
Block a user