From 5a421bce124146c4eaddcbe680545d3796411ad6 Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Sun, 1 Sep 2024 13:08:57 +0800 Subject: [PATCH 1/4] Refactoring the README and add comments in the PostgreSQL Dockerfile Signed-off-by: Quanyi Ma --- README.md | 38 +++++++++++++++++++++++++++++++------- docker/mono-pg-dockerfile | 10 +++++++++- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7fc03d329..03cc9a175 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,37 @@ Mega will support code owners, which are a set of rules for defining who owns a For now, the entire open source community base on Git and GitHub. It's centralized model, and it's not suitable for growing speed of open source world. Mega is working on build a decentralized open source collaboration model with [ZTM](https://github.com/flomesh-io/ztm)(Zero Trust Model) and decentralized social network like [Nostr](https://nostr.com), [Matrix](https://matrix.org) and [Mastodon](https://joinmastodon.org). -## Quick Start - -### Quick Try - -For now, we are developing on the macOS and Arch Linux. And quick start manuel in the [Quick start manuel to developing or testing](docs/development.md#quick-start-manuel-to-developing-or-testing). - -### Quick Review of Architecture +## Quick Try Monorepo Engine with Docker + +For now, we are provide the run monorepo engine with docker, you can try it with the following steps: + +1. Clone the project and build the docker images +```bash +git clone https://github.com/web3infra-foundation/mega.git +cd mega +docker buildx build -t mono-pg:0.1-pre-release -f ./docker/mono-pg-dockerfile . +docker buildx build -t mono-engine:0.1-pre-release -f ./docker/mono-engine-dockerfile . +docker buildx build -t mono-ui:0.1-pre-release -f ./docker/mono-ui-dockerfile . +``` + +2. Init the volume for mono-engine and PostgreSQL +```bash +# Linux or MacOS +./docker/init-volume.sh /mnt/data ./docker/config.toml +``` + +3. Run the mono-engine and PostgreSQL with docker, and open the mono-ui in your browser with `http://localhost:3000`. +```bash +# create network +docker network create mono-network + +# run postgres +docker run --rm -it -d --name mono-pg --network mono-network -v /tmp/data/mono/pg-data:/var/lib/postgresql/data -p 5432:5432 mono-pg:0.1-pre-release +docker run --rm -it -d --name mono-engine --network mono-network -v /tmp/data/mono/mono-data:/opt/mega -p 8000:8000 mono-engine:0.1-pre-release +docker run --rm -it -d --name mono-ui --network mono-network -e MEGA_INTERNAL_HOST=http://mono-engine:8000 -e MEGA_HOST=http://localhost:8000 -e MOON_HOST=http://localhost:3000 -p 3000:3000 mono-ui:0.1-pre-release +``` + +## Quick Review of Architecture ![Mega Architect](docs/images/Mega_Bin_and_Modules.png) diff --git a/docker/mono-pg-dockerfile b/docker/mono-pg-dockerfile index 960d5732a..7a3d8875b 100644 --- a/docker/mono-pg-dockerfile +++ b/docker/mono-pg-dockerfile @@ -1,5 +1,14 @@ FROM postgres:16 +# When running the `docker buildx build` command, you may encounter the following warning: +# +# 1 warning found (use docker --debug to expand): +# - SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "POSTGRES_PASSWORD") (line 5) +# +# This warning indicates that sensitive data, such as passwords, should not be passed using ARG or ENV instructions +# in the Dockerfile. This is a security best practice to prevent accidental exposure of sensitive information. +# +# However, since this Dockerfile is intended for use in a development environment, you can choose to ignore this warning. ENV POSTGRES_DB=mono ENV POSTGRES_USER=mono ENV POSTGRES_PASSWORD=mono @@ -11,4 +20,3 @@ EXPOSE 5432 COPY ./sql/postgres/pg_20240205__init.sql /docker-entrypoint-initdb.d/ CMD ["postgres"] - From 16ab1caab4c990c04890ee50b70059c0ca433d83 Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Mon, 2 Sep 2024 09:30:18 +0800 Subject: [PATCH 2/4] Improve the README.md through hints of @TimePrinciple Signed-off-by: Eli Ma --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 03cc9a175..78dd10a6a 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ For now, the entire open source community base on Git and GitHub. It's centraliz ## Quick Try Monorepo Engine with Docker -For now, we are provide the run monorepo engine with docker, you can try it with the following steps: +For now, the monorepo engine could be deployed on your host machine or insulated into containers. For deploying through docker, follow the steps below: 1. Clone the project and build the docker images ```bash @@ -45,7 +45,7 @@ docker buildx build -t mono-engine:0.1-pre-release -f ./docker/mono-engine-docke docker buildx build -t mono-ui:0.1-pre-release -f ./docker/mono-ui-dockerfile . ``` -2. Init the volume for mono-engine and PostgreSQL +2. Expand abbreviations, use initialize for mono-engine and PostgreSQL ```bash # Linux or MacOS ./docker/init-volume.sh /mnt/data ./docker/config.toml From e77c67399768fa2d5c3179d5a5d59015786ea760 Mon Sep 17 00:00:00 2001 From: Tianxing Ye Date: Mon, 2 Sep 2024 10:56:55 +0800 Subject: [PATCH 3/4] Update docker/mono-pg-dockerfile Co-authored-by: Ruoqing --- docker/mono-pg-dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/mono-pg-dockerfile b/docker/mono-pg-dockerfile index 7a3d8875b..8211afe67 100644 --- a/docker/mono-pg-dockerfile +++ b/docker/mono-pg-dockerfile @@ -8,7 +8,7 @@ FROM postgres:16 # This warning indicates that sensitive data, such as passwords, should not be passed using ARG or ENV instructions # in the Dockerfile. This is a security best practice to prevent accidental exposure of sensitive information. # -# However, since this Dockerfile is intended for use in a development environment, you can choose to ignore this warning. +# However, since this `Dockerfile` is intended for use in a development environment, you can choose to ignore this warning, or raise a pull request to help us improving it. ENV POSTGRES_DB=mono ENV POSTGRES_USER=mono ENV POSTGRES_PASSWORD=mono From ba205e9a7e3da0b6d9d37931c0c9b3cd54cfc57e Mon Sep 17 00:00:00 2001 From: Tianxing Ye Date: Mon, 2 Sep 2024 10:57:09 +0800 Subject: [PATCH 4/4] Update README.md Co-authored-by: Ruoqing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78dd10a6a..c93a9ea69 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ docker buildx build -t mono-engine:0.1-pre-release -f ./docker/mono-engine-docke docker buildx build -t mono-ui:0.1-pre-release -f ./docker/mono-ui-dockerfile . ``` -2. Expand abbreviations, use initialize for mono-engine and PostgreSQL +2. Initialize for mono-engine and PostgreSQL ```bash # Linux or MacOS ./docker/init-volume.sh /mnt/data ./docker/config.toml