* [PATCH server-a001 v2 1/4] Install net-tools
2022-04-30 17:08 [PATCH server-a001 v2 0/4] Install net-tools and MySQL server Ammar Faizi
@ 2022-04-30 17:08 ` Ammar Faizi
2022-04-30 17:08 ` [PATCH server-a001 v2 2/4] Install MySQL server Ammar Faizi
` (3 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: Ammar Faizi @ 2022-04-30 17:08 UTC (permalink / raw)
To: Hazmi Alfarizqi, GNU/Weeb Mailing List
Cc: Ammar Faizi, Hazmi Alfarizqi, Alviro Iskandar Setiawan
Install networking tools like netstat and ifconfig. We will often use
them to inspect and troubleshoot network problem.
Link: https://lore.gnuweeb.org/gwml/[email protected]
Reviewed-by: Alviro Iskandar Setiawan <[email protected]>
Reviewed-by: Hazmi Alfarizqi <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 5e59701..7d78c86 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -12,7 +12,7 @@ ARG DEBIAN_FRONTEND=noninteractive
RUN yes | unminimize
# Install base packages
-RUN apt-get update && apt-get -y --no-install-recommends install ca-certificates gnupg htop ncurses-term vim software-properties-common sudo wget
+RUN apt-get update && apt-get -y --no-install-recommends install ca-certificates gnupg htop ncurses-term vim software-properties-common sudo wget net-tools
# Change root password, and create main user
RUN echo "root:${rootPassword}" | chpasswd \
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH server-a001 v2 2/4] Install MySQL server
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 ` 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
` (2 subsequent siblings)
4 siblings, 1 reply; 16+ messages in thread
From: Ammar Faizi @ 2022-04-30 17:08 UTC (permalink / raw)
To: Hazmi Alfarizqi, GNU/Weeb Mailing List
Cc: Ammar Faizi, Hazmi Alfarizqi, Alviro Iskandar Setiawan
We will need a MySQL server as the database for: postfix, dovecot and
mail accounts. This will give us mysql-server v8.
Signed-off-by: Ammar Faizi <[email protected]>
---
Dockerfile | 2 +-
docker-entrypoint.sh | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 7d78c86..883d260 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -27,7 +27,7 @@ COPY apt-sources/* /etc/apt/sources.list.d
# Install server components
RUN apt-key adv --fetch-keys https://nginx.org/keys/nginx_signing.key \
&& apt-get update \
- && apt-get -y --no-install-recommends install openssh-server nginx
+ && apt-get -y --no-install-recommends install openssh-server nginx mysql-server
# Mark port 48589/tcp is to be exposed
EXPOSE 48589/tcp
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 1d8114d..ba9026c 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -2,5 +2,6 @@
service ssh start
service nginx start
+service mysql start
exec "$@"
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH server-a001 v2 3/4] Create `storage` directory for saving persistent data
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:08 ` Ammar Faizi
2022-04-30 17:30 ` Alviro Iskandar Setiawan
2022-05-01 12:13 ` Hazmi Alfarizqi
2022-04-30 17:08 ` [PATCH server-a001 v2 4/4] Create start.sh to start the docker container Ammar Faizi
2022-04-30 17:10 ` [PATCH server-a001 v2 0/4] Install net-tools and MySQL server Ammar Faizi
4 siblings, 2 replies; 16+ messages in thread
From: Ammar Faizi @ 2022-04-30 17:08 UTC (permalink / raw)
To: Hazmi Alfarizqi, GNU/Weeb Mailing List
Cc: Ammar Faizi, Hazmi Alfarizqi, Alviro Iskandar Setiawan
This is a directory to save persistent data across `docker run`. All
files inside this directory are ignored by git. They shouldn't be
commited to the git tree. The first use case of this directory is for
the MySQL database. The container will mount particular directories
inside this `storage` directory.
Side note: For data backup, the data inside the `storage` directory
should be backed up by another method. Not by commiting the files to
the git tree together with `server-a001` tree.
Signed-off-by: Ammar Faizi <[email protected]>
---
storage/.gitignore | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 storage/.gitignore
diff --git a/storage/.gitignore b/storage/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/storage/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 3/4] Create `storage` directory for saving persistent data
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-05-01 12:13 ` Hazmi Alfarizqi
1 sibling, 1 reply; 16+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-04-30 17:30 UTC (permalink / raw)
To: Ammar Faizi; +Cc: Hazmi Alfarizqi, GNU/Weeb Mailing List, Hazmi Alfarizqi
On Sun, May 1, 2022 at 12:08 AM Ammar Faizi <[email protected]> wrote:
> This is a directory to save persistent data across `docker run`. All
> files inside this directory are ignored by git. They shouldn't be
> commited to the git tree. The first use case of this directory is for
> the MySQL database. The container will mount particular directories
> inside this `storage` directory.
>
> Side note: For data backup, the data inside the `storage` directory
> should be backed up by another method. Not by commiting the files to
> the git tree together with `server-a001` tree.
>
> Signed-off-by: Ammar Faizi <[email protected]>
You made typos:
s/commited/committed
s/commiting/committing
Also, public-inbox is a git tree too, so the former sentence is wrong.
But I understand the point of this patch. With those fixed, please
take:
Reviewed-by: Alviro Iskandar Setiawan <[email protected]>
tq
-- Viro
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 3/4] Create `storage` directory for saving persistent data
2022-04-30 17:30 ` Alviro Iskandar Setiawan
@ 2022-04-30 17:39 ` Ammar Faizi
2022-04-30 17:54 ` Ammar Faizi
0 siblings, 1 reply; 16+ messages in thread
From: Ammar Faizi @ 2022-04-30 17:39 UTC (permalink / raw)
To: Alviro Iskandar Setiawan
Cc: Hazmi Alfarizqi, GNU/Weeb Mailing List, Hazmi Alfarizqi
On 5/1/22 12:30 AM, Alviro Iskandar Setiawan wrote:
> You made typos:
>
> s/commited/committed
> s/commiting/committing
>
> Also, public-inbox is a git tree too, so the former sentence is wrong.
> But I understand the point of this patch.
Oh yeah, you're right. When I was working on this patch I didn't think
about other services, only MySQL in my mind. I will fix them all.
Thanks!
--
Ammar Faizi
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 3/4] Create `storage` directory for saving persistent data
2022-04-30 17:39 ` Ammar Faizi
@ 2022-04-30 17:54 ` Ammar Faizi
0 siblings, 0 replies; 16+ messages in thread
From: Ammar Faizi @ 2022-04-30 17:54 UTC (permalink / raw)
To: Alviro Iskandar Setiawan
Cc: Hazmi Alfarizqi, GNU/Weeb Mailing List, Hazmi Alfarizqi
On 5/1/22 12:39 AM, Ammar Faizi wrote:
> On 5/1/22 12:30 AM, Alviro Iskandar Setiawan wrote:
>> You made typos:
>>
>> s/commited/committed
>> s/commiting/committing
>>
>> Also, public-inbox is a git tree too, so the former sentence is wrong.
>> But I understand the point of this patch.
>
> Oh yeah, you're right. When I was working on this patch I didn't think
> about other services, only MySQL in my mind. I will fix them all.
>
> Thanks!
Fixed, it looks like this now. Thanks!
---
From: Ammar Faizi <[email protected]>
Subject: [PATCH 3/4] Create `storage` directory for saving persistent data
This is a directory to save persistent data across `docker run`. All
files inside this directory are ignored by git. They shouldn't be
committed to the same git tree together with `server-a001` project.
The first use case of this directory is for the MySQL data. The
container will mount particular directories inside this `storage`
directory.
Side note: For data backup, the data inside the `storage` directory
should be backed up independently with this tree.
[ammarfaizi2: Reword the commit message]
Link: https://lore.gnuweeb.org/gwml/[email protected]
Reviewed-by: Alviro Iskandar Setiawan <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
storage/.gitignore | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 storage/.gitignore
diff --git a/storage/.gitignore b/storage/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/storage/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 3/4] Create `storage` directory for saving persistent data
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-05-01 12:13 ` Hazmi Alfarizqi
1 sibling, 0 replies; 16+ messages in thread
From: Hazmi Alfarizqi @ 2022-05-01 12:13 UTC (permalink / raw)
To: Ammar Faizi, GNU/Weeb Mailing List
Cc: Hazmi Alfarizqi, Alviro Iskandar Setiawan
On 01/05/2022 00:08, Ammar Faizi wrote:
> This is a directory to save persistent data across `docker run`. All
> files inside this directory are ignored by git. They shouldn't be
> commited to the git tree. The first use case of this directory is for
> the MySQL database. The container will mount particular directories
> inside this `storage` directory.
>
> Side note: For data backup, the data inside the `storage` directory
> should be backed up by another method. Not by commiting the files to
> the git tree together with `server-a001` tree.
>
> Signed-off-by: Ammar Faizi <[email protected]>
Bind-mounts huh, looks good.
Reviewed-by: Hazmi Alfarizqi <[email protected]>
-- hzmi
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH server-a001 v2 4/4] Create start.sh to start the docker container
2022-04-30 17:08 [PATCH server-a001 v2 0/4] Install net-tools and MySQL server Ammar Faizi
` (2 preceding siblings ...)
2022-04-30 17:08 ` [PATCH server-a001 v2 3/4] Create `storage` directory for saving persistent data Ammar Faizi
@ 2022-04-30 17:08 ` Ammar Faizi
2022-04-30 17:32 ` Alviro Iskandar Setiawan
2022-05-01 12:15 ` Hazmi Alfarizqi
2022-04-30 17:10 ` [PATCH server-a001 v2 0/4] Install net-tools and MySQL server Ammar Faizi
4 siblings, 2 replies; 16+ messages in thread
From: Ammar Faizi @ 2022-04-30 17:08 UTC (permalink / raw)
To: Hazmi Alfarizqi, GNU/Weeb Mailing List
Cc: Ammar Faizi, Hazmi Alfarizqi, Alviro Iskandar Setiawan
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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 4/4] Create start.sh to start the docker container
2022-04-30 17:08 ` [PATCH server-a001 v2 4/4] Create start.sh to start the docker container Ammar Faizi
@ 2022-04-30 17:32 ` Alviro Iskandar Setiawan
2022-05-01 12:15 ` Hazmi Alfarizqi
1 sibling, 0 replies; 16+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-04-30 17:32 UTC (permalink / raw)
To: Ammar Faizi; +Cc: Hazmi Alfarizqi, GNU/Weeb Mailing List, Hazmi Alfarizqi
On Sun, May 1, 2022 at 12:09 AM Ammar Faizi <[email protected]> wrote:
>
> 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]>
Looks good.
Reviewed-by: Alviro Iskandar Setiawan <[email protected]>
tq
-- Viro
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 4/4] Create start.sh to start the docker container
2022-04-30 17:08 ` [PATCH server-a001 v2 4/4] Create start.sh to start the docker container Ammar Faizi
2022-04-30 17:32 ` Alviro Iskandar Setiawan
@ 2022-05-01 12:15 ` Hazmi Alfarizqi
2022-05-01 13:45 ` Ammar Faizi
1 sibling, 1 reply; 16+ messages in thread
From: Hazmi Alfarizqi @ 2022-05-01 12:15 UTC (permalink / raw)
To: Ammar Faizi, GNU/Weeb Mailing List
Cc: Hazmi Alfarizqi, Alviro Iskandar Setiawan
On 01/05/2022 00:08, Ammar Faizi wrote:
> 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]>
It seems that `server-a001` gonna be the image name? I would assume we
will build the Docker image from Dockerfile directly on the host.
If not and the image will be pulled from some registry, the image name
format would look like: [registry/]Username/Image[:tag] (Example:
docker.io/username/image:latest).
The tag is optional, the default tag would be latest.
For the registry part, if it's docker.io (which is the default registry
for Docker) it will be omitted on Docker, but not on Podman.
Other than that, LGTM.
Reviewed-by: Hazmi Alfarizqi <[email protected]>
-- hzmi
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 4/4] Create start.sh to start the docker container
2022-05-01 12:15 ` Hazmi Alfarizqi
@ 2022-05-01 13:45 ` Ammar Faizi
2022-05-01 15:09 ` Hazmi Alfarizqi
0 siblings, 1 reply; 16+ messages in thread
From: Ammar Faizi @ 2022-05-01 13:45 UTC (permalink / raw)
To: Hazmi Alfarizqi, GNU/Weeb Mailing List
Cc: Hazmi Alfarizqi, Alviro Iskandar Setiawan
On 5/1/22 7:15 PM, Hazmi Alfarizqi wrote:
> On 01/05/2022 00:08, Ammar Faizi wrote:
>> 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]>
>
> It seems that `server-a001` gonna be the image name? I would assume we
> will build the Docker image from Dockerfile directly on the host.
Yes for both sentences.
> If not and the image will be pulled from some registry, the image name
> format would look like: [registry/]Username/Image[:tag] (Example:
> docker.io/username/image:latest).
>
> The tag is optional, the default tag would be latest.
> For the registry part, if it's docker.io (which is the default
> registry for Docker) it will be omitted on Docker, but not on Podman.
We don't intend to push this image.
What kind of changes do you recommend?
Keep it like this or add the "latest" tag?
--
Ammar Faizi
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 4/4] Create start.sh to start the docker container
2022-05-01 13:45 ` Ammar Faizi
@ 2022-05-01 15:09 ` Hazmi Alfarizqi
2022-05-01 15:13 ` Ammar Faizi
0 siblings, 1 reply; 16+ messages in thread
From: Hazmi Alfarizqi @ 2022-05-01 15:09 UTC (permalink / raw)
To: Ammar Faizi, GNU/Weeb Mailing List
Cc: Hazmi Alfarizqi, Alviro Iskandar Setiawan
On 01/05/2022 20:45, Ammar Faizi wrote:
> On 5/1/22 7:15 PM, Hazmi Alfarizqi wrote:
>> On 01/05/2022 00:08, Ammar Faizi wrote:
>>> 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]>
>>
>> It seems that `server-a001` gonna be the image name? I would assume we
>> will build the Docker image from Dockerfile directly on the host.
>
> Yes for both sentences.
Okay, I see.
>> If not and the image will be pulled from some registry, the image name
>> format would look like: [registry/]Username/Image[:tag] (Example:
>> docker.io/username/image:latest).
>>
>> The tag is optional, the default tag would be latest.
>> For the registry part, if it's docker.io (which is the default
>> registry for Docker) it will be omitted on Docker, but not on Podman.
>
> We don't intend to push this image.
>
> What kind of changes do you recommend?
> Keep it like this or add the "latest" tag?
>
Hmm, there's no need to add "latest" tag but for me, I prefer to add it.
So yeah up to you.
-- hzmi
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 4/4] Create start.sh to start the docker container
2022-05-01 15:09 ` Hazmi Alfarizqi
@ 2022-05-01 15:13 ` Ammar Faizi
0 siblings, 0 replies; 16+ messages in thread
From: Ammar Faizi @ 2022-05-01 15:13 UTC (permalink / raw)
To: Hazmi Alfarizqi, GNU/Weeb Mailing List
Cc: Hazmi Alfarizqi, Alviro Iskandar Setiawan
On 5/1/22 10:09 PM, Hazmi Alfarizqi wrote:
>> We don't intend to push this image.
>>
>> What kind of changes do you recommend?
>> Keep it like this or add the "latest" tag?
>>
> Hmm, there's no need to add "latest" tag but for me, I prefer to add it.
> So yeah up to you.
OK, let's use the latest tag to make it more specific.
Fast-forward merged into master branch and pushed out, thanks!
--
Ammar Faizi
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH server-a001 v2 0/4] Install net-tools and MySQL server
2022-04-30 17:08 [PATCH server-a001 v2 0/4] Install net-tools and MySQL server Ammar Faizi
` (3 preceding siblings ...)
2022-04-30 17:08 ` [PATCH server-a001 v2 4/4] Create start.sh to start the docker container Ammar Faizi
@ 2022-04-30 17:10 ` Ammar Faizi
4 siblings, 0 replies; 16+ messages in thread
From: Ammar Faizi @ 2022-04-30 17:10 UTC (permalink / raw)
To: GNU/Weeb Mailing List
Cc: Alviro Iskandar Setiawan, Hazmi Alfarizqi, Hazmi Alfarizqi
On 5/1/22 12:08 AM, Ammar Faizi wrote:
> In case you have already running or stale container, the above
Sorry, typo.
"In case you have already had a running or stale container"
--
Ammar Faizi
^ permalink raw reply [flat|nested] 16+ messages in thread