diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..c1d16c9 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,59 @@ +version: 2.1 +executors: + nodejs: + docker: + - image: cimg/node:18.17.1 + golang: + docker: + - image: cimg/go:1.20.7 + +jobs: + + build_and_deploy_controller: + executor: golang + steps: + - checkout + - run: + name: Build and Deploy Controller + command: | + cd backend/services/controller && go build -o controller cmd/oktopus/main.go + scp -o StrictHostKeyChecking=no controller $SSH_USER@$SSH_HOST:/home/$SSH_USER + ssh -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST "sudo mv controller /usr/bin/ && sudo systemctl restart controller" + + build_and_deploy_mochi: + executor: golang + steps: + - checkout + - run: + name: Build and Deploy Mochi + command: | + cd backend/services/mochi/ && go build -o mochi cmd/main.go + scp -o StrictHostKeyChecking=no mochi $SSH_USER@$SSH_HOST:/home/$SSH_USER + ssh -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST "sudo mv mochi /usr/bin/ && sudo systemctl restart mochi" + + build_and_deploy_frontend: + executor: nodejs + steps: + - checkout + - run: + name: Build and Deploy Frontend + command: | + cd frontend && npm i && npm run build + scp -o StrictHostKeyChecking=no -r .next/ $SSH_USER@$SSH_HOST:/home/$SSH_USER/oktopus/frontend + ssh -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST "pm2 restart oktopus" + +workflows: + build_and_deploy: + jobs: + - build_and_deploy_controller: + filters: + branches: + only: main + - build_and_deploy_mochi: + filters: + branches: + only: main + - build_and_deploy_frontend: + filters: + branches: + only: main \ No newline at end of file diff --git a/.gitignore b/.gitignore index 219836b..64eeb06 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,8 @@ go.work *.txt *.pwd *.acl -.idea \ No newline at end of file +.idea +.vscode +controller +main +mochi \ No newline at end of file diff --git a/README.md b/README.md index b8d81e1..c193a36 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,6 @@


-