Build from the published sources, not from git
[citadel-docker.git] / run-citadel.sh
index 398c779bd002777e2eaeab36fdc948c3811df6d4..3372da677da8c3e33f9b7e364d20bf429121758f 100755 (executable)
@@ -5,14 +5,12 @@
 # The container expects a persistent volume called "citadel-data" in which it will keep everything.
 # The remainder of the container is ephermal and can be deleted at any time.
 
-
-# Parse the command line arguments
-
 migrate_mode=false
 database_cleanup_mode=false
 volume_mode=false
 bind_mode=false
 
+# Parse the command line arguments
 while getopts ":mdv:h:" o
 do
        case "${o}" in
@@ -56,8 +54,9 @@ elif ${bind_mode} ; then
        CTDL_VOL=bind
 else
        volume_mode=true
-       CTDL_VOL=volume
-       CTDL_DIR=citadel-data
+       CTDL_VOL=bind
+       CTDL_DIR=/usr/local/citadel
+       mkdir /usr/local/citadel >/dev/null 2>/dev/null
 fi
 
 if ( ${migrate_mode} && ${database_cleanup_mode} ) ; then
@@ -65,7 +64,7 @@ if ( ${migrate_mode} && ${database_cleanup_mode} ) ; then
        exit 3
 fi
 
-docker run -it --rm $1 -c || exit 1
+docker run -i --rm citadel -c || exit 1
 
 n_args=""
 c_args=""
@@ -75,21 +74,14 @@ if ${migrate_mode} ; then
 elif ${database_cleanup_mode} ; then
        c_args="-d"                             # Tell ctdlvisor to run database_cleanup.sh
 else
-       n_args="--network host"                 # Only open ports if we're running in normal mode
+       n_args="--network=host"                 # Only open ports if we're running in normal mode
 fi
 
 exec docker run \
-       --name citadel \
-       -it \
+       --name=citadel \
+       -i \
        --rm \
        ${n_args} \
        --mount type=${CTDL_VOL},source=${CTDL_DIR},target=/citadel-data \
-       $1 ${c_args}
-
-#      Explanation of the above options:
-#
-#      --name citadel                  Create a container named "citadel"
-#      -it                             Run in the foreground
-#      --rm                            Delete the container when it exits
-#      --network host                  Bind directly to the host's network ports instead of creating a separate interface
-#      --mount                         This identifies where on the host our persistent Citadel database is found
+       citadel \
+       ${c_args}