From 7b50db6f27692d3bb04bddf8d9868e0a1c76e228 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Tue, 25 Jan 2022 00:47:25 +0200 Subject: [PATCH 01/21] move volume creation before copying files to make them avilable on external volumes --- docker/Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2ceaee30..1fe74eed 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,6 +5,15 @@ LABEL maintainer="dave@force9.org" ENV NVM_DIR /root/.nvm ENV DEBIAN_FRONTEND noninteractive +# enigma storage mounts +VOLUME /enigma-bbs/art +VOLUME /enigma-bbs/config +VOLUME /enigma-bbs/db +VOLUME /enigma-bbs/filebase +VOLUME /enigma-bbs/logs +VOLUME /enigma-bbs/mods +VOLUME /mail + COPY . /enigma-bbs # Do some installing! @@ -28,15 +37,6 @@ RUN apt-get update && apt-get install -y \ # sexyz COPY docker/bin/sexyz /usr/local/bin -# enigma storage mounts -VOLUME /enigma-bbs/art -VOLUME /enigma-bbs/config -VOLUME /enigma-bbs/db -VOLUME /enigma-bbs/filebase -VOLUME /enigma-bbs/logs -VOLUME /enigma-bbs/mods -VOLUME /mail - # Enigma default port EXPOSE 8888 From bcef8b3d3e66898d47ef79fcccda235dacb78149 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Tue, 25 Jan 2022 01:08:35 +0200 Subject: [PATCH 02/21] =?UTF-8?q?node-pre-gyp@0.11.0=20requires=20python3?= =?UTF-8?q?=20to=20build=20now=20=C2=AF\=5F(=E3=83=84)=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1fe74eed..c55869e9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get update && apt-get install -y \ git \ curl \ build-essential \ + python3 \ python \ libssl-dev \ lrzsz \ From 234eef7585a82c03bb0faebcd156d70a37881891 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Tue, 25 Jan 2022 12:12:05 +0200 Subject: [PATCH 03/21] must remain in v12 for sqlite to build correctly according to lock --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c55869e9..8448ef17 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM node:lts-buster-slim +FROM node:12-buster-slim LABEL maintainer="dave@force9.org" From b791c9e9bb8c31e1ab8864045035c18ff4cdb601 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Tue, 25 Jan 2022 23:30:38 +0200 Subject: [PATCH 04/21] this looks like it does the trick - first time will issue a config procedure (I know we have redundant files in enigma-bbs-pre but that's a price for the enhanced deployment ease) --- docker/Dockerfile | 45 ++++++++++++++++++++------------- docker/bin/docker-entrypoint.sh | 16 ++++++++++++ docs/installation/docker.md | 43 ++++++++++++++++++++++--------- 3 files changed, 74 insertions(+), 30 deletions(-) create mode 100644 docker/bin/docker-entrypoint.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index 8448ef17..1784e250 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,20 +4,12 @@ LABEL maintainer="dave@force9.org" ENV NVM_DIR /root/.nvm ENV DEBIAN_FRONTEND noninteractive - -# enigma storage mounts -VOLUME /enigma-bbs/art -VOLUME /enigma-bbs/config -VOLUME /enigma-bbs/db -VOLUME /enigma-bbs/filebase -VOLUME /enigma-bbs/logs -VOLUME /enigma-bbs/mods -VOLUME /mail - COPY . /enigma-bbs -# Do some installing! -RUN apt-get update && apt-get install -y \ +# Do some installing! (and alot of cleaning up) keeping it in one step for less docker layers +# - if you need to debug i recommend to break the steps with individual RUNs) +RUN apt-get update \ + && apt-get install -y \ git \ curl \ build-essential \ @@ -29,18 +21,35 @@ RUN apt-get update && apt-get install -y \ lhasa \ unrar-free \ p7zip-full \ - && npm install -g pm2 \ - && cd /enigma-bbs && npm install --only=production \ - && apt-get remove build-essential python libssl-dev git curl -y && apt-get autoremove -y \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - && apt-get clean + && npm install -g pm2 \ + && cd /enigma-bbs && npm install --only=production \ + && pm2 start main.js \ + && mkdir -p /enigma-bbs-pre/art \ + && mkdir /enigma-bbs-pre/mods \ + && mkdir /enigma-bbs-pre/config \ + && cp -rp art/* ../enigma-bbs-pre/art/ \ + && cp -rp mods/* ../enigma-bbs-pre/mods/ \ + && cp -rp config/* ../enigma-bbs-pre/config/ \ + && apt-get remove build-essential python libssl-dev git curl -y \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && apt-get clean # sexyz COPY docker/bin/sexyz /usr/local/bin +# enigma storage mounts +VOLUME /enigma-bbs/art +VOLUME /enigma-bbs/config +VOLUME /enigma-bbs/db +VOLUME /enigma-bbs/filebase +VOLUME /enigma-bbs/logs +VOLUME /enigma-bbs/mods +VOLUME /mail + # Enigma default port EXPOSE 8888 WORKDIR /enigma-bbs -CMD ["pm2-runtime", "main.js"] +ENTRYPOINT ["/enigma-bbs/docker/bin/docker-entrypoint.sh"] \ No newline at end of file diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh new file mode 100644 index 00000000..1e0927d2 --- /dev/null +++ b/docker/bin/docker-entrypoint.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +prepopvols=("config" "mods" "art") +bbspath=/enigma-bbs +bbsstgp=/enigma-bbs-pre +if [[ ! -f $bbspath/config/config.hjson ]]; then + for dir in "${prepopvols[@]}" + do + if [ -n "$(find "$bbspath/$dir" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then + cp -rp $bbsstgp/$dir/* $bbspath/$dir/ + else + echo "WARN skipped $bbspath/$dir - vol Not empty/not a new setup - possible bad state" + fi + done + ./oputil.js config new +fi +pm2-runtime main.js \ No newline at end of file diff --git a/docs/installation/docker.md b/docs/installation/docker.md index 5510bc6c..39ce70df 100644 --- a/docs/installation/docker.md +++ b/docs/installation/docker.md @@ -6,20 +6,39 @@ title: Docker for every operating system on the [Docker website](https://docs.docker.com/engine/install/).** ## Quick Start +prepare a folder where you are going to save your bbs files. +- Generate some config for your BBS: \ +you can perform this step from anywhere - but make sure to consistently run it from the same place to retain your config inside the docker guest +``` +docker run -it --rm -p 8888:8888 \ +--name "EnigmaBBS" \ +-v "$(pwd)/config:/enigma-bbs/config" \ +-v "$(pwd)/db:/enigma-bbs/db" \ +-v "$(pwd)/logs:/enigma-bbs/logs" \ +-v "$(pwd)/filebase:/enigma-bbs/filebase" \ +-v "$(pwd)/art:/enigma-bbs/art" \ +-v "$(pwd)/mods:/enigma-bbs/mods" \ +-v "$(pwd)/mail:/mail" \ +enigmabbs:latest +``` +- Run it: \ +you can use the same command as above, just daemonize and drop interactiveness (we needed it for config but most of the time docker will run in the background) +```` +docker run -d --rm -p 8888:8888 \ +--name "EnigmaBBS" \ +-v "$(pwd)/config:/enigma-bbs/config" \ +-v "$(pwd)/db:/enigma-bbs/db" \ +-v "$(pwd)/logs:/enigma-bbs/logs" \ +-v "$(pwd)/filebase:/enigma-bbs/filebase" \ +-v "$(pwd)/art:/enigma-bbs/art" \ +-v "$(pwd)/mods:/enigma-bbs/mods" \ +-v "$(pwd)/mail:/mail" \ +enigmabbs:latest +``` -- Generate some config for your BBS: - ``` - docker run -it -v "${HOME}/enigma-bbs/config:/enigma-bbs/config" enigmabbs/enigma-bbs:latest oputil.js config new - ``` +:bulb: Configuration will be stored in `$(pwd)/enigma-bbs/config`. -- Run it: - ``` - docker run -p 8888:8888 -v "${HOME}/enigma-bbs/config:/enigma-bbs/config" enigmabbs/enigma-bbs:latest - ``` - -:bulb: Configuration will be stored in `${HOME}/enigma-bbs/config`. - -:bulb: Windows users - you'll need to switch out `${HOME}/enigma-bbs/config` for a Windows-style path. +:bulb: Windows users - you'll need to switch out `$(pwd)/enigma-bbs/config` for a Windows-style path. ## Volumes From d63db9acc27c2428a603e7b4e0ab387918e23896 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Wed, 26 Jan 2022 00:44:39 +0200 Subject: [PATCH 05/21] removed python3 - not needed when running 12-buster-slim also prep entrypoint even if it was shipped with no execution attrib and prevent restart loop since pm2-runtime always exits with 0 --- docker/Dockerfile | 2 +- docker/bin/docker-entrypoint.sh | 20 +++++++++++++++----- docs/installation/docker.md | 6 +++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1784e250..f143d0d6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -13,7 +13,6 @@ RUN apt-get update \ git \ curl \ build-essential \ - python3 \ python \ libssl-dev \ lrzsz \ @@ -37,6 +36,7 @@ RUN apt-get update \ # sexyz COPY docker/bin/sexyz /usr/local/bin +RUN chmod +x /enigma-bbs/docker/bin/docker-entrypoint.sh # enigma storage mounts VOLUME /enigma-bbs/art diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index 1e0927d2..1a6c6e3d 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -1,8 +1,13 @@ #!/usr/bin/env bash -prepopvols=("config" "mods" "art") -bbspath=/enigma-bbs -bbsstgp=/enigma-bbs-pre -if [[ ! -f $bbspath/config/config.hjson ]]; then + +# Set some vars +prepopvols=("config" "mods" "art") # these are folders which contain runtime needed files, and need to be represented in the host +bbspath=/enigma-bbs # install location +bbsstgp=/enigma-bbs-pre # staging location for prepopvals +configname=config.hjson # this is the default name, this script is intended for easy get-go - make changes as needed + +# Setup happens when there is no existing config file +if [[ ! -f $bbspath/config/$configname ]]; then for dir in "${prepopvols[@]}" do if [ -n "$(find "$bbspath/$dir" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then @@ -13,4 +18,9 @@ if [[ ! -f $bbspath/config/config.hjson ]]; then done ./oputil.js config new fi -pm2-runtime main.js \ No newline at end of file +if [[ ! -f $bbspath/config/$configname ]]; then #make sure once more, otherwise pm2-runtime will loop if missing the config + echo "for some reason you have skipped configuration - enigma will not work. please run config" + exit 1 +else + pm2-runtime main.js +fi diff --git a/docs/installation/docker.md b/docs/installation/docker.md index 39ce70df..13cf0985 100644 --- a/docs/installation/docker.md +++ b/docs/installation/docker.md @@ -19,7 +19,7 @@ docker run -it --rm -p 8888:8888 \ -v "$(pwd)/art:/enigma-bbs/art" \ -v "$(pwd)/mods:/enigma-bbs/mods" \ -v "$(pwd)/mail:/mail" \ -enigmabbs:latest +enigmabbs/enigmabbs:latest ``` - Run it: \ you can use the same command as above, just daemonize and drop interactiveness (we needed it for config but most of the time docker will run in the background) @@ -33,8 +33,8 @@ docker run -d --rm -p 8888:8888 \ -v "$(pwd)/art:/enigma-bbs/art" \ -v "$(pwd)/mods:/enigma-bbs/mods" \ -v "$(pwd)/mail:/mail" \ -enigmabbs:latest -``` +enigmabbs/enigmabbs:latest +```` :bulb: Configuration will be stored in `$(pwd)/enigma-bbs/config`. From 48893576151de68cffe58d5c30c571fa565446bf Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Wed, 26 Jan 2022 01:39:07 +0200 Subject: [PATCH 06/21] no need to --rm unless there's issues really. (or upgrade ---- tbd) --- docs/installation/docker.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/installation/docker.md b/docs/installation/docker.md index 13cf0985..f2255efb 100644 --- a/docs/installation/docker.md +++ b/docs/installation/docker.md @@ -10,7 +10,7 @@ prepare a folder where you are going to save your bbs files. - Generate some config for your BBS: \ you can perform this step from anywhere - but make sure to consistently run it from the same place to retain your config inside the docker guest ``` -docker run -it --rm -p 8888:8888 \ +docker run -it -p 8888:8888 \ --name "EnigmaBBS" \ -v "$(pwd)/config:/enigma-bbs/config" \ -v "$(pwd)/db:/enigma-bbs/db" \ @@ -24,7 +24,7 @@ enigmabbs/enigmabbs:latest - Run it: \ you can use the same command as above, just daemonize and drop interactiveness (we needed it for config but most of the time docker will run in the background) ```` -docker run -d --rm -p 8888:8888 \ +docker run -d -p 8888:8888 \ --name "EnigmaBBS" \ -v "$(pwd)/config:/enigma-bbs/config" \ -v "$(pwd)/db:/enigma-bbs/db" \ From 4957d7ea0d50bb44444ea6b38c01caed79726ad3 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Wed, 26 Jan 2022 01:43:11 +0200 Subject: [PATCH 07/21] no need to --rm unless there's issues really. (or upgrade ---- tbd) --- docs/installation/docker.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/installation/docker.md b/docs/installation/docker.md index f2255efb..4b618ddb 100644 --- a/docs/installation/docker.md +++ b/docs/installation/docker.md @@ -35,6 +35,10 @@ docker run -d -p 8888:8888 \ -v "$(pwd)/mail:/mail" \ enigmabbs/enigmabbs:latest ```` +- Restarting and Making changes\ +if you make any changes to your host config folder they will persist, and you can just restart EnigmaBBS container to load any changes you've made. + +```docker restart EnigmaBBS``` :bulb: Configuration will be stored in `$(pwd)/enigma-bbs/config`. From 0f6db152f38153769258ebeafaedb84077b237ab Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Wed, 26 Jan 2022 00:44:39 +0200 Subject: [PATCH 08/21] python3 needed after all. --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index f143d0d6..3271f088 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,6 +14,7 @@ RUN apt-get update \ curl \ build-essential \ python \ + python 3 \ libssl-dev \ lrzsz \ arj \ From c3b7d897653ffcd15f50795b25ded27bc276158d Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Wed, 26 Jan 2022 12:13:41 +0200 Subject: [PATCH 09/21] clean up after py3 --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 3271f088..c9ac8135 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -30,7 +30,7 @@ RUN apt-get update \ && cp -rp art/* ../enigma-bbs-pre/art/ \ && cp -rp mods/* ../enigma-bbs-pre/mods/ \ && cp -rp config/* ../enigma-bbs-pre/config/ \ - && apt-get remove build-essential python libssl-dev git curl -y \ + && apt-get remove build-essential python python3 libssl-dev git curl -y \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && apt-get clean From 0240a130434b0563fdea8f9294ee93fc93cc9785 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Wed, 26 Jan 2022 13:08:58 +0200 Subject: [PATCH 10/21] clean up after py3 --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c9ac8135..aa8047b0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get update \ curl \ build-essential \ python \ - python 3 \ + python3 \ libssl-dev \ lrzsz \ arj \ From 8f56b7e48c9c2875c77932ac4f653978f52e3bef Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Wed, 26 Jan 2022 13:10:03 +0200 Subject: [PATCH 11/21] indentation --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index aa8047b0..1e5b1711 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -22,9 +22,9 @@ RUN apt-get update \ unrar-free \ p7zip-full \ && npm install -g pm2 \ - && cd /enigma-bbs && npm install --only=production \ + && cd /enigma-bbs && npm install --only=production \ && pm2 start main.js \ - && mkdir -p /enigma-bbs-pre/art \ + && mkdir -p /enigma-bbs-pre/art \ && mkdir /enigma-bbs-pre/mods \ && mkdir /enigma-bbs-pre/config \ && cp -rp art/* ../enigma-bbs-pre/art/ \ From 50cdf693da4d6dc18619263b37c3b4dc75af8bb8 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 19:17:16 +0200 Subject: [PATCH 12/21] no clobber after additional testing. in case existing files but no config hjson there could be data overwritten due to copy being a big bully will not overwrite any files with -n and should be safe again . --- docker/bin/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index 1a6c6e3d..3ee86be0 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -11,7 +11,7 @@ if [[ ! -f $bbspath/config/$configname ]]; then for dir in "${prepopvols[@]}" do if [ -n "$(find "$bbspath/$dir" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then - cp -rp $bbsstgp/$dir/* $bbspath/$dir/ + cp -rpn $bbsstgp/$dir/* $bbspath/$dir/ else echo "WARN skipped $bbspath/$dir - vol Not empty/not a new setup - possible bad state" fi From 7b2e478ca6182a5bafce1f31aca9272d8bbadbf1 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 19:42:37 +0200 Subject: [PATCH 13/21] Update docker-entrypoint.sh does not work recursively --- docker/bin/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index 3ee86be0..1a6c6e3d 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -11,7 +11,7 @@ if [[ ! -f $bbspath/config/$configname ]]; then for dir in "${prepopvols[@]}" do if [ -n "$(find "$bbspath/$dir" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then - cp -rpn $bbsstgp/$dir/* $bbspath/$dir/ + cp -rp $bbsstgp/$dir/* $bbspath/$dir/ else echo "WARN skipped $bbspath/$dir - vol Not empty/not a new setup - possible bad state" fi From 65b9c570ee53e2da5884894fa0c818992696b783 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 20:17:30 +0200 Subject: [PATCH 14/21] updating according to PR --- docker/bin/docker-entrypoint.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index 1a6c6e3d..29e4d917 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -1,25 +1,28 @@ #!/usr/bin/env bash +set -e # Set some vars -prepopvols=("config" "mods" "art") # these are folders which contain runtime needed files, and need to be represented in the host -bbspath=/enigma-bbs # install location -bbsstgp=/enigma-bbs-pre # staging location for prepopvals -configname=config.hjson # this is the default name, this script is intended for easy get-go - make changes as needed +PRE_POP_VOLS=("config" "mods" "art") # these are folders which contain runtime needed files, and need to be represented in the host +BBS_ROOT=/enigma-bbs # install location +BBS_STG_P=/enigma-bbs-pre # staging location for pre populated volumes (PRE_POP_VOLS) +CONFIG_NAME=config.hjson # this is the default name, this script is intended for easy get-go - make changes as needed # Setup happens when there is no existing config file -if [[ ! -f $bbspath/config/$configname ]]; then - for dir in "${prepopvols[@]}" +if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then + for DIR in "${PRE_POP_VOLS[@]}" do - if [ -n "$(find "$bbspath/$dir" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then - cp -rp $bbsstgp/$dir/* $bbspath/$dir/ + if [ -n "$(find "$BBS_ROOT/$DIR" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then + cp -rp $BBS_STG_P/$DIR/* $BBS_ROOT/$DIR/ else - echo "WARN skipped $bbspath/$dir - vol Not empty/not a new setup - possible bad state" + printf "WARN: skipped $BBS_ROOT/$DIR: Volume not empty or not a new setup; Files required to run ENiGMA 1/2 may be missing.\n Possible bad state\n" + printf "INFO:you have mounted folders with existing data - but no existing config json.\n\nPossible solutions:\n1. Make sure all volumes are set correctly specifically config volume... \n2. Check your configuration name if non-default\n\n\n" fi done ./oputil.js config new fi -if [[ ! -f $bbspath/config/$configname ]]; then #make sure once more, otherwise pm2-runtime will loop if missing the config - echo "for some reason you have skipped configuration - enigma will not work. please run config" +if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then #make sure once more, otherwise pm2-runtime will loop if missing the config + printf "ERROR: Missing configuration - ENiGMA 1/2 will not work. please run config\n" + exit 1 else pm2-runtime main.js From 7d56ee3cc6d4fb67cc68481ae77bd5aac407d145 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 21:16:02 +0200 Subject: [PATCH 15/21] s/you/ You --- docker/bin/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index 29e4d917..575b104d 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -15,7 +15,7 @@ if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then cp -rp $BBS_STG_P/$DIR/* $BBS_ROOT/$DIR/ else printf "WARN: skipped $BBS_ROOT/$DIR: Volume not empty or not a new setup; Files required to run ENiGMA 1/2 may be missing.\n Possible bad state\n" - printf "INFO:you have mounted folders with existing data - but no existing config json.\n\nPossible solutions:\n1. Make sure all volumes are set correctly specifically config volume... \n2. Check your configuration name if non-default\n\n\n" + printf "INFO: You have mounted folders with existing data - but no existing config json.\n\nPossible solutions:\n1. Make sure all volumes are set correctly specifically config volume... \n2. Check your configuration name if non-default\n\n\n" fi done ./oputil.js config new From e814ccce31ff8e3f29f2295125e2e981890c1fb2 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 21:19:58 +0200 Subject: [PATCH 16/21] ENiGMA<3 --- docs/installation/docker.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/installation/docker.md b/docs/installation/docker.md index 4b618ddb..0acd5d85 100644 --- a/docs/installation/docker.md +++ b/docs/installation/docker.md @@ -11,7 +11,7 @@ prepare a folder where you are going to save your bbs files. you can perform this step from anywhere - but make sure to consistently run it from the same place to retain your config inside the docker guest ``` docker run -it -p 8888:8888 \ ---name "EnigmaBBS" \ +--name " ENiGMABBS" \ -v "$(pwd)/config:/enigma-bbs/config" \ -v "$(pwd)/db:/enigma-bbs/db" \ -v "$(pwd)/logs:/enigma-bbs/logs" \ @@ -25,7 +25,7 @@ enigmabbs/enigmabbs:latest you can use the same command as above, just daemonize and drop interactiveness (we needed it for config but most of the time docker will run in the background) ```` docker run -d -p 8888:8888 \ ---name "EnigmaBBS" \ +--name "ENiGMABBS" \ -v "$(pwd)/config:/enigma-bbs/config" \ -v "$(pwd)/db:/enigma-bbs/db" \ -v "$(pwd)/logs:/enigma-bbs/logs" \ @@ -36,9 +36,9 @@ docker run -d -p 8888:8888 \ enigmabbs/enigmabbs:latest ```` - Restarting and Making changes\ -if you make any changes to your host config folder they will persist, and you can just restart EnigmaBBS container to load any changes you've made. +if you make any changes to your host config folder they will persist, and you can just restart ENiGMABBS container to load any changes you've made. -```docker restart EnigmaBBS``` +```docker restart ENiGMABBS``` :bulb: Configuration will be stored in `$(pwd)/enigma-bbs/config`. From d46adfc74362e50c8f3ff50fe009a6ece11d0933 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 21:21:38 +0200 Subject: [PATCH 17/21] comments --- docker/bin/docker-entrypoint.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index 575b104d..d2b33dc0 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -2,10 +2,10 @@ set -e # Set some vars -PRE_POP_VOLS=("config" "mods" "art") # these are folders which contain runtime needed files, and need to be represented in the host -BBS_ROOT=/enigma-bbs # install location -BBS_STG_P=/enigma-bbs-pre # staging location for pre populated volumes (PRE_POP_VOLS) -CONFIG_NAME=config.hjson # this is the default name, this script is intended for easy get-go - make changes as needed +PRE_POP_VOLS=("config" "mods" "art") # These are folders which contain runtime needed files, and need to be represented in the host +BBS_ROOT=/enigma-bbs # Install location +BBS_STG_P=/enigma-bbs-pre # Staging location for pre populated volumes (PRE_POP_VOLS) +CONFIG_NAME=config.hjson # This is the default name, this script is intended for easy get-go - make changes as needed # Setup happens when there is no existing config file if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then @@ -20,7 +20,7 @@ if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then done ./oputil.js config new fi -if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then #make sure once more, otherwise pm2-runtime will loop if missing the config +if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then # Make sure once more, otherwise pm2-runtime will loop if missing the config printf "ERROR: Missing configuration - ENiGMA 1/2 will not work. please run config\n" exit 1 From 39efa79743262e08bfa323e19b86e64a1a4de3ec Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 21:24:20 +0200 Subject: [PATCH 18/21] verbose vars --- docker/bin/docker-entrypoint.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index d2b33dc0..34ff8cfa 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -2,25 +2,25 @@ set -e # Set some vars -PRE_POP_VOLS=("config" "mods" "art") # These are folders which contain runtime needed files, and need to be represented in the host -BBS_ROOT=/enigma-bbs # Install location -BBS_STG_P=/enigma-bbs-pre # Staging location for pre populated volumes (PRE_POP_VOLS) +PRE_POPULATED_VOLUMES=("config" "mods" "art") # These are folders which contain runtime needed files, and need to be represented in the host +BBS_ROOT_DIR=/enigma-bbs # Install location +BBS_STAGING_PATH=/enigma-bbs-pre # Staging location for pre populated volumes (PRE_POPULATED_VOLUMES) CONFIG_NAME=config.hjson # This is the default name, this script is intended for easy get-go - make changes as needed # Setup happens when there is no existing config file -if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then - for DIR in "${PRE_POP_VOLS[@]}" +if [[ ! -f $BBS_ROOT_DIR/config/$CONFIG_NAME ]]; then + for DIR in "${PRE_POPULATED_VOLUMES[@]}" do - if [ -n "$(find "$BBS_ROOT/$DIR" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then - cp -rp $BBS_STG_P/$DIR/* $BBS_ROOT/$DIR/ + if [ -n "$(find "$BBS_ROOT_DIR/$DIR" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then + cp -rp $BBS_STAGING_PATH/$DIR/* $BBS_ROOT_DIR/$DIR/ else - printf "WARN: skipped $BBS_ROOT/$DIR: Volume not empty or not a new setup; Files required to run ENiGMA 1/2 may be missing.\n Possible bad state\n" + printf "WARN: skipped $BBS_ROOT_DIR/$DIR: Volume not empty or not a new setup; Files required to run ENiGMA 1/2 may be missing.\n Possible bad state\n" printf "INFO: You have mounted folders with existing data - but no existing config json.\n\nPossible solutions:\n1. Make sure all volumes are set correctly specifically config volume... \n2. Check your configuration name if non-default\n\n\n" fi done ./oputil.js config new fi -if [[ ! -f $BBS_ROOT/config/$CONFIG_NAME ]]; then # Make sure once more, otherwise pm2-runtime will loop if missing the config +if [[ ! -f $BBS_ROOT_DIR/config/$CONFIG_NAME ]]; then # Make sure once more, otherwise pm2-runtime will loop if missing the config printf "ERROR: Missing configuration - ENiGMA 1/2 will not work. please run config\n" exit 1 From 6e2cf64843a69d79dfebd3d043a1e89f728767f5 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 21:28:14 +0200 Subject: [PATCH 19/21] varexpansion --- docker/bin/docker-entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index 34ff8cfa..c17dc8b2 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -9,12 +9,12 @@ CONFIG_NAME=config.hjson # This is the default name, this script is intended for # Setup happens when there is no existing config file if [[ ! -f $BBS_ROOT_DIR/config/$CONFIG_NAME ]]; then - for DIR in "${PRE_POPULATED_VOLUMES[@]}" + for VOLUME in "${PRE_POPULATED_VOLUMES[@]}" do - if [ -n "$(find "$BBS_ROOT_DIR/$DIR" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then - cp -rp $BBS_STAGING_PATH/$DIR/* $BBS_ROOT_DIR/$DIR/ + if [ -n "$(find "$BBS_ROOT_DIR/$VOLUME" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then + cp -rp $BBS_STAGING_PATH/$VOLUME/* $BBS_ROOT_DIR/$VOLUME/ else - printf "WARN: skipped $BBS_ROOT_DIR/$DIR: Volume not empty or not a new setup; Files required to run ENiGMA 1/2 may be missing.\n Possible bad state\n" + printf "WARN: skipped $BBS_ROOT_DIR/$VOLUME: Volume not empty or not a new setup; Files required to run ENiGMA 1/2 may be missing.\n Possible bad state\n" printf "INFO: You have mounted folders with existing data - but no existing config json.\n\nPossible solutions:\n1. Make sure all volumes are set correctly specifically config volume... \n2. Check your configuration name if non-default\n\n\n" fi done From 7bbb2104b9644097a06959d32eb8775fc0981cb7 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 21:59:20 +0200 Subject: [PATCH 20/21] I learn fast, but need slow explaining --- docker/bin/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index c17dc8b2..5f83581c 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -25,5 +25,5 @@ if [[ ! -f $BBS_ROOT_DIR/config/$CONFIG_NAME ]]; then # Make sure once more, oth exit 1 else - pm2-runtime main.js + exec pm2-runtime main.js fi From a5128a504b844fbb29f782f3a561df225e788424 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Sat, 29 Jan 2022 23:04:29 +0200 Subject: [PATCH 21/21] exec again --- docker/bin/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index 5f83581c..e96eeed9 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -25,5 +25,5 @@ if [[ ! -f $BBS_ROOT_DIR/config/$CONFIG_NAME ]]; then # Make sure once more, oth exit 1 else - exec pm2-runtime main.js + exec pm2-runtime main.js fi