From a56af1387e886b655cb257ef3cc4276e0b25786b Mon Sep 17 00:00:00 2001 From: masnn Date: Fri, 9 Apr 2021 15:07:52 +0000 Subject: [PATCH 1/5] add Dockerfile, update gitpod workspace config --- .gitpod.Dockerfile | 9 +++++++++ .gitpod.yml | 15 +++++++++++++-- Dockerfile | 2 ++ install/centos-7.sh | 5 +++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .gitpod.Dockerfile create mode 100644 Dockerfile diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 000000000..dadae2519 --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,9 @@ +FROM gitpod/workspace-mongodb +RUN yarn global add pm2 && \ + wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/bin/minio + chmod 755 /usr/bin/minio + apt-get update && \ + apt-get install clang -y && \ + cargo install sonic-server && \ + echo '{"host":"127.0.0.1","port":"27017","name":"hydro","username":"","password":""}' >/home/gitpod/.hydro/config.json + echo "MINIO_ACCESS_KEY=hydro\nMINIO_SECRET_KEY=hydrohydro" >/home/gitpod/.hydro/env \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 7bb5f6500..c62dd11c9 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,8 +1,19 @@ -image: gitpod/workspace-mongodb +image: + file: .gitpod.Dockerfile tasks: - - init: yarn && yarn build + - init: | + yarn + npm i pm2 -g + pm2 start mongod + pm2 start "MINIO_ACCESS_KEY=hydro MINIO_SECRET_KEY=hydrohydro minio server /home/gitpod/file" --name minio + systemctl start sonic-server + yarn build + yarn build:ui + yarn debug vscode: extensions: - dbaeumer.vscode-eslint@2.1.3:1NRvj3UKNTNwmYjptmUmIw== - vscode-icons-team.vscode-icons@10.2.0:DrQUJPtFm0woSFiyitha8Q== - samuelcolvin.jinjahtml@0.12.0:lFI6zKplznEZPdWvFvRHwg== + - tabnine.tabnine-vscode + - gruntfuggly.todo-tree diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..f1930c5b7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM ubuntu:latest +RUN curl -sSL https://cdn.jsdelivr.net/gh/hydro-dev/Hydro@master/install/ubuntu-2004.sh | bash diff --git a/install/centos-7.sh b/install/centos-7.sh index d2f5eae6b..0b241273d 100644 --- a/install/centos-7.sh +++ b/install/centos-7.sh @@ -1,6 +1,11 @@ #!/bin/bash echo "Running Hydro Installer for centos 7" +echo "CENTOS IS NOT RECOMMENDED TO USE." +echo "PLEASE USE UBUNTU INSTEAD." +echo "THIS SCRIPT MAY NOT WORK PROPERLY." +echo "Will continue installation in 10 secs, press Ctrl-C to exit" +sleep 10 db_password=$(cat /dev/urandom | head -n 10 | md5sum | head -c 20) MINIO_ACCESS_KEY=$(cat /dev/urandom | head -n 10 | md5sum | head -c 20) MINIO_SECRET_KEY=$(cat /dev/urandom | head -n 10 | md5sum | head -c 20) From 1518f31f60e2b0c15820f1d3fc6b7ed3e51556bc Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 9 Apr 2021 23:11:46 +0800 Subject: [PATCH 2/5] Update .gitpod.Dockerfile --- .gitpod.Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index dadae2519..7857d4c67 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -1,9 +1,9 @@ FROM gitpod/workspace-mongodb RUN yarn global add pm2 && \ - wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/bin/minio - chmod 755 /usr/bin/minio + wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/bin/minio && \ + chmod 755 /usr/bin/minio && \ apt-get update && \ apt-get install clang -y && \ cargo install sonic-server && \ - echo '{"host":"127.0.0.1","port":"27017","name":"hydro","username":"","password":""}' >/home/gitpod/.hydro/config.json - echo "MINIO_ACCESS_KEY=hydro\nMINIO_SECRET_KEY=hydrohydro" >/home/gitpod/.hydro/env \ No newline at end of file + echo '{"host":"127.0.0.1","port":"27017","name":"hydro","username":"","password":""}' >/home/gitpod/.hydro/config.json && \ + echo "MINIO_ACCESS_KEY=hydro\nMINIO_SECRET_KEY=hydrohydro" >/home/gitpod/.hydro/env From 7412697cb8869f9c70de967c5bea13a94594c53f Mon Sep 17 00:00:00 2001 From: masnn Date: Fri, 9 Apr 2021 15:30:29 +0000 Subject: [PATCH 3/5] fix sonic installation --- .gitpod.Dockerfile | 12 ++++++------ .gitpod.yml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 7857d4c67..7f48ef92b 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -1,9 +1,9 @@ FROM gitpod/workspace-mongodb -RUN yarn global add pm2 && \ - wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/bin/minio && \ - chmod 755 /usr/bin/minio && \ - apt-get update && \ - apt-get install clang -y && \ - cargo install sonic-server && \ +RUN npm i pm2 -g && \ + sudo wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/bin/minio && \ + sudo chmod 755 /usr/bin/minio && \ + sudo apt-get update && \ + sudo apt-get install clang -y && \ + cargo install sonic-server --version 1.3.0 && \ echo '{"host":"127.0.0.1","port":"27017","name":"hydro","username":"","password":""}' >/home/gitpod/.hydro/config.json && \ echo "MINIO_ACCESS_KEY=hydro\nMINIO_SECRET_KEY=hydrohydro" >/home/gitpod/.hydro/env diff --git a/.gitpod.yml b/.gitpod.yml index c62dd11c9..d3f97cba9 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -3,9 +3,9 @@ image: tasks: - init: | yarn - npm i pm2 -g pm2 start mongod pm2 start "MINIO_ACCESS_KEY=hydro MINIO_SECRET_KEY=hydrohydro minio server /home/gitpod/file" --name minio + pm2 start "/workspace/.cargo/bin/sonic -c /workspace/.cargo/registry/src/github.com-1ecc6299db9ec823/sonic-server-1.3.0/config.cfg" --name sonic systemctl start sonic-server yarn build yarn build:ui From 172f7385ad3af6742a93d46574a7318358964b0a Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 9 Apr 2021 23:39:58 +0800 Subject: [PATCH 4/5] auto create config folder --- .gitpod.Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 7f48ef92b..2388afa49 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -5,5 +5,6 @@ RUN npm i pm2 -g && \ sudo apt-get update && \ sudo apt-get install clang -y && \ cargo install sonic-server --version 1.3.0 && \ + mkdir -p /home/gitpod/.hydro && \ echo '{"host":"127.0.0.1","port":"27017","name":"hydro","username":"","password":""}' >/home/gitpod/.hydro/config.json && \ echo "MINIO_ACCESS_KEY=hydro\nMINIO_SECRET_KEY=hydrohydro" >/home/gitpod/.hydro/env From 32967093c61b81c4bca200ec5c85c6deda33c516 Mon Sep 17 00:00:00 2001 From: masnn Date: Fri, 9 Apr 2021 15:55:57 +0000 Subject: [PATCH 5/5] auto-create user & set admin --- .gitpod.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index d3f97cba9..0a69ac0c0 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -5,10 +5,11 @@ tasks: yarn pm2 start mongod pm2 start "MINIO_ACCESS_KEY=hydro MINIO_SECRET_KEY=hydrohydro minio server /home/gitpod/file" --name minio - pm2 start "/workspace/.cargo/bin/sonic -c /workspace/.cargo/registry/src/github.com-1ecc6299db9ec823/sonic-server-1.3.0/config.cfg" --name sonic - systemctl start sonic-server + pm2 start "/home/gitpod/.cargo/bin/sonic -c /home/gitpod/.cargo/registry/src/github.com-1ecc6299db9ec823/sonic-server-1.3.0/config.cfg" --name sonic yarn build yarn build:ui + npx hydrooj cli user create root@hydro.local root rootroot + npx hydrooj cli user setSuperAdmin 2 yarn debug vscode: extensions: