public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Hazmi Alfarizqi <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>
Cc: Ammar Faizi <[email protected]>,
	Hazmi Alfarizqi <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>
Subject: [PATCH server-a001 v2 4/4] Create start.sh to start the docker container
Date: Sun,  1 May 2022 00:08:38 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Create a file named start.sh. This is a script to start the container
with prepared configuration. Only run this script on the host.

Signed-off-by: Ammar Faizi <[email protected]>
---
 start.sh | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 start.sh

diff --git a/start.sh b/start.sh
new file mode 100644
index 0000000..19f1eef
--- /dev/null
+++ b/start.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# This file is run in this host, not in the container.
+#
+
+set -e;
+
+HOSTNAME="gnuweeb.org";
+CONTAINER_NAME="server-a001-ct";
+MYSQL_DATA_DIR="$(readlink -e "./storage/mysql_data")";
+
+mkdir -pv "$MYSQL_DATA_DIR";
+
+
+CMD="$1";
+
+if [[ "${CMD}" == "force-run" ]]; then
+    docker rm -f "${CONTAINER_NAME}" || true;
+    CMD="run";
+fi;
+
+if [[ "${CMD}" == "run" ]]; then
+    docker run \
+        --name "${CONTAINER_NAME}" \
+        --privileged \
+        --hostname "${HOSTNAME}" \
+        --mount "type=volume,dst=/var/lib/mysql,volume-driver=local,volume-opt=type=none,volume-opt=o=bind,volume-opt=device=${MYSQL_DATA_DIR}" \
+        --tty \
+        --interactive \
+        --detach \
+        server-a001;
+
+    exit 0;
+fi;
+
+echo "Unknown command ${CMD}!";
+exit 1;
-- 
Ammar Faizi


  parent reply	other threads:[~2022-04-30 17:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-30 17:08 [PATCH server-a001 v2 0/4] Install net-tools and MySQL server Ammar Faizi
2022-04-30 17:08 ` [PATCH server-a001 v2 1/4] Install net-tools Ammar Faizi
2022-04-30 17:08 ` [PATCH server-a001 v2 2/4] Install MySQL server Ammar Faizi
2022-04-30 17:24   ` Alviro Iskandar Setiawan
2022-04-30 17:08 ` [PATCH server-a001 v2 3/4] Create `storage` directory for saving persistent data Ammar Faizi
2022-04-30 17:30   ` Alviro Iskandar Setiawan
2022-04-30 17:39     ` Ammar Faizi
2022-04-30 17:54       ` Ammar Faizi
2022-05-01 12:13   ` Hazmi Alfarizqi
2022-04-30 17:08 ` Ammar Faizi [this message]
2022-04-30 17:32   ` [PATCH server-a001 v2 4/4] Create start.sh to start the docker container Alviro Iskandar Setiawan
2022-05-01 12:15   ` Hazmi Alfarizqi
2022-05-01 13:45     ` Ammar Faizi
2022-05-01 15:09       ` Hazmi Alfarizqi
2022-05-01 15:13         ` Ammar Faizi
2022-04-30 17:10 ` [PATCH server-a001 v2 0/4] Install net-tools and MySQL server Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox