From 0c16b80908c4a7d035965e8e20ebc14c9cec9e31 Mon Sep 17 00:00:00 2001 From: Gurulandia Date: Fri, 7 Feb 2025 11:20:29 +0200 Subject: [PATCH] flatnotes initial commit --- docker/compose/flatnotes.yaml | 21 ++++++ docker/env/.env.flatnotes | 72 +++++++++++++++++++ docker/env/.env.stack.flatnotes | 10 +++ .../behind-proxy/compose.override.yaml | 13 ++++ docker/flatnotes/behind-proxy/compose.yaml | 7 ++ docker/flatnotes/behind-proxy/dcc.sh | 1 + docker/flatnotes/compose.yaml | 7 ++ docker/flatnotes/dcc.sh | 1 + 8 files changed, 132 insertions(+) create mode 100644 docker/compose/flatnotes.yaml create mode 100644 docker/env/.env.flatnotes create mode 100644 docker/env/.env.stack.flatnotes create mode 100644 docker/flatnotes/behind-proxy/compose.override.yaml create mode 100644 docker/flatnotes/behind-proxy/compose.yaml create mode 100755 docker/flatnotes/behind-proxy/dcc.sh create mode 100644 docker/flatnotes/compose.yaml create mode 100755 docker/flatnotes/dcc.sh diff --git a/docker/compose/flatnotes.yaml b/docker/compose/flatnotes.yaml new file mode 100644 index 0000000..8168afb --- /dev/null +++ b/docker/compose/flatnotes.yaml @@ -0,0 +1,21 @@ +services: + flatnotes: + image: ${FLATNOTES_IMAGE}:${FLATNOTES_TAG} + container_name: ${FLATNOTES_CONTAINER_NAME} + restart: ${FLATNOTES_RESTART_POLICY} + security_opt: + - no-new-privileges:true + networks: + - ${FLATNOTES_NETWORk_ID} +# ports: +# - "8080:8080" + environment: + PUID: ${UID:-1000} + PGID: ${GID:-1000} + TZ: ${TZ} + env_file: + - path: ../env/.env.flatnotes + volumes: + - ${DOCKERDIR}/flatnotes/data:/data + # Optional. Allows you to save the search index in a different location: + # - "./index:/data/.flatnotes" diff --git a/docker/env/.env.flatnotes b/docker/env/.env.flatnotes new file mode 100644 index 0000000..12fe8ce --- /dev/null +++ b/docker/env/.env.flatnotes @@ -0,0 +1,72 @@ +FLATNOTES_AUTH_TYPE=none +# There are currently 3 types of authentication supported: + +# none - No authentication. +# read_only - As above but note creation, modification and deletion is disabled. +# password - A username and password is required to access flatnotes. See FLATNOTES_USERNAME and FLATNOTES_PASSWORD below. +# totp - In addition to a username and password, a time based one-time-password is also required to access flatnotes. +# Defaults to password if not provided. + +# totp +# To use the totp authentication type you will also need to supply a FLATNOTES_TOTP_KEY (see below). Upon startup, flatnotes will print a QR code which can be used to add flatnotes to an authentication app such as Authy or Google Authenticator. Docker users can view this QR code by looking at the containers logs e.g. docker logs flatnotes. +# If for any reason you are unable to scan the QR code, you can also manually enter the secret key into your authentication app. This will be printed underneath the QR code in the logs. +# When using the API with totp enabled, you'll need to append the current totp code to your password (e.g. changeMe!123456) when calling the /api/token endpoint. + +#FLATNOTES_USERNAME= +#FLATNOTES_PASSWORD= +# The username and password used to access flatnotes. +# Required when FLATNOTES_AUTH_TYPE is set to password or totp. Not applicable when FLATNOTES_AUTH_TYPE is set to none or read_only. + +FLATNOTES_SECRET_KEY=aLongRandomSeriesOfCharacters +# The secret key used to generate access tokens. Changing this will invalidate all existing access tokens. +# I recommend using a password generator to generate random 32 character string. +# Required when FLATNOTES_AUTH_TYPE is set to password or totp. Not applicable when FLATNOTES_AUTH_TYPE is set to none or read_only. + +#FLATNOTES_SESSION_EXPIRY_DAYS= +# Defines how many days an access token is valid for (before a username, password and (possibly) a totp code is required to login again). +# Defaults to 30 if not provided. + +#FLATNOTES_TOTP_KEY= +# The secret key used to generate totp codes. Changing this will invalidate the totp configuration. +# I recommend using a password generator to generate random 32 character string. +# Required when FLATNOTES_AUTH_TYPE is totp. Not applicable for other authentication types. + +#FLATNOTES_PATH_PREFIX= +# Useful if you want to host flatnotes at a sub-path on your domain (e.g. www.example.com/flatnotes). +# Value must start with a / but not end with one e.g. /flatnotes. +# Defaults to no prefix if not provided. + +#FLATNOTES_QUICK_ACCESS_HIDE= +# If set to true, hides the quick access notes on the home page. +# Defaults to false (show quick access notes). +# Note: This replaced the now deprecated FLATNOTES_HIDE_RECENTLY_MODIFIED environment variable. + +#FLATNOTES_QUICK_ACCESS_TITLE= +# The title of the quick access notes section. +# Defaults to RECENTLY MODIFIED. + +#FLATNOTES_QUICK_ACCESS_TERM= +# The search term that defines which notes to show in the quick access notes section. +# A good example is to set this to #pinned to show only notes that include the "#pinned" tag or NOT tags:work to exclude notes tagged with "#work". +# Defaults to *. + +#FLATNOTES_QUICK_ACCESS_SORT= +# The field by which to order the quick access notes section. +# Value must be one of score, title, lastModified. +# Defaults to lastModified. + +#FLATNOTES_QUICK_ACCESS_LIMIT= +#The maximum number of notes to show in the quick access notes section. +# Defaults to 4. + +#FLATNOTES_PORT= +# Applicable to the Docker image only. +# Defines the port flatnotes will bind to inside the container. +# Defaults to 8080 if not provided. + +#PUID= +#PGID= +# These are applicable to the Docker image only. +# They allow you to specify the user and group that flatnotes will run as inside the Docker container. This is useful to avoid permission issues when mounting a directory from the host. +# Both default to 1000. +# Values are ignored if the container is not run as root (e.g. when using the docker --user flag). \ No newline at end of file diff --git a/docker/env/.env.stack.flatnotes b/docker/env/.env.stack.flatnotes new file mode 100644 index 0000000..f83eb48 --- /dev/null +++ b/docker/env/.env.stack.flatnotes @@ -0,0 +1,10 @@ +COMPOSE_PROJECT_NAME=flatnotes + +FLATNOTES_NETWORk_ID=proxy +FLATNOTES_HOSTNAME=flatnotes + +##### flatnotes Container +FLATNOTES_CONTAINER_NAME=flatnotes +FLATNOTES_IMAGE=dullage/flatnotes +FLATNOTES_TAG=latest +FLATNOTES_RESTART_POLICY=unless-stopped diff --git a/docker/flatnotes/behind-proxy/compose.override.yaml b/docker/flatnotes/behind-proxy/compose.override.yaml new file mode 100644 index 0000000..f52956c --- /dev/null +++ b/docker/flatnotes/behind-proxy/compose.override.yaml @@ -0,0 +1,13 @@ +services: + flatnotes: + labels: + - "traefik.enable=true" + ## HTTP Routers + - "traefik.http.routers.${FLATNOTES_HOSTNAME}-rtr.entrypoints=https" + - "traefik.http.routers.${FLATNOTES_HOSTNAME}-rtr.rule=Host(`${FLATNOTES_HOSTNAME}.$DOMAINNAME1`)" + ## Middlewares +# - "traefik.http.routers.${FLATNOTES_HOSTNAME}-rtr.middlewares=chain-authelia@file" + - "traefik.http.routers.${FLATNOTES_HOSTNAME}-rtr.middlewares=chain-no-auth@file" + ## HTTP Services + - "traefik.http.routers.${FLATNOTES_HOSTNAME}-rtr.service=${FLATNOTES_HOSTNAME}-svc" + - "traefik.http.services.${FLATNOTES_HOSTNAME}-svc.loadbalancer.server.port=8080" diff --git a/docker/flatnotes/behind-proxy/compose.yaml b/docker/flatnotes/behind-proxy/compose.yaml new file mode 100644 index 0000000..4c0f552 --- /dev/null +++ b/docker/flatnotes/behind-proxy/compose.yaml @@ -0,0 +1,7 @@ +# Docker Compose v2.20 or greater required to use "include" +include: +#################### NETWORKS #################### + - ../../compose/networks/proxy.yaml + - ../../compose/networks/socket-proxy.yaml +#################### SERVICES #################### + - ../../compose/flatnotes.yaml diff --git a/docker/flatnotes/behind-proxy/dcc.sh b/docker/flatnotes/behind-proxy/dcc.sh new file mode 100755 index 0000000..1162571 --- /dev/null +++ b/docker/flatnotes/behind-proxy/dcc.sh @@ -0,0 +1 @@ +docker compose --env-file ../../env/.env.stack.flatnotes --env-file ../../env/.env.common config \ No newline at end of file diff --git a/docker/flatnotes/compose.yaml b/docker/flatnotes/compose.yaml new file mode 100644 index 0000000..4c0f552 --- /dev/null +++ b/docker/flatnotes/compose.yaml @@ -0,0 +1,7 @@ +# Docker Compose v2.20 or greater required to use "include" +include: +#################### NETWORKS #################### + - ../../compose/networks/proxy.yaml + - ../../compose/networks/socket-proxy.yaml +#################### SERVICES #################### + - ../../compose/flatnotes.yaml diff --git a/docker/flatnotes/dcc.sh b/docker/flatnotes/dcc.sh new file mode 100755 index 0000000..20f476e --- /dev/null +++ b/docker/flatnotes/dcc.sh @@ -0,0 +1 @@ +docker compose --env-file ../env/.env.stack.flatnotes --env-file ../env/.env.common config \ No newline at end of file