-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on dockerization automatic deployment
- Loading branch information
Showing
18 changed files
with
339 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
**/.husky | ||
**/.idea | ||
**/.vscode | ||
**/node_modules | ||
**/.env | ||
.dockerignore | ||
**/.gitignore | ||
**/*.env | ||
**/.git | ||
**/.gitmodules | ||
**/.github | ||
**/Dockerfile | ||
**/docker-compose.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#Location: .github/workflows/custom_config.yml | ||
|
||
name: Build and push containers to Github Container Registry and apply rolling update | ||
on: | ||
push: | ||
branches: | ||
- staging | ||
- develop | ||
- main | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Getting image tag | ||
uses: actions/github-script@v6 | ||
id: get_image_tag | ||
with: | ||
result-encoding: string | ||
script: | | ||
return context.payload.ref.replace(/.*\//, ''); | ||
- name: Create and push docker image | ||
run: | | ||
# login to ghcr.io | ||
docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} | ||
# build with full metadata | ||
docker build \ | ||
--label "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \ | ||
--label "org.opencontainers.image.description=Deposit payment example dockerized app" \ | ||
--label "org.opencontainers.image.licenses=MIT" \ | ||
-t ghcr.io/golemfactory/deposit_example:${{ steps.get_image_tag.outputs.result }} \ | ||
--build-arg BACKEND_URL=http://deposit.dev.golem.network:5174 \ | ||
. | ||
# push one image with two tags into repository | ||
docker push --all-tags ghcr.io/golemfactory/deposit_example | ||
- name: Notify Staging | ||
continue-on-error: true | ||
if: ${{ steps.get_image_tag.outputs.result == 'staging' }} | ||
run: curl http://deposit.dev.golem.network:5000/release/pull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build docker files | ||
|
||
on: | ||
push: | ||
|
||
permissions: | ||
packages: write | ||
contents: write | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Create and push docker image | ||
run: | | ||
# login to ghcr.io | ||
docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} | ||
# build with full metadata | ||
docker build \ | ||
--label "org.opencontainers.image.source=https://github.com/${GITHUB_REPOSITORY}" \ | ||
--label "org.opencontainers.image.description=Deposit payment example dockerized app" \ | ||
--label "org.opencontainers.image.licenses=MIT" \ | ||
-t ghcr.io/golemfactory/deposit_example:latest \ | ||
--build-arg BACKEND_URL=http://deposit.dev.golem.network:5174 \ | ||
. | ||
# push one image with two tags into repository | ||
docker push --all-tags ghcr.io/golemfactory/deposit_example | ||
- name: Notify Develop Server | ||
continue-on-error: true | ||
if: ${{ steps.get_image_tag.outputs.result == 'develop' }} | ||
run: curl http://deposit.dev.golem.network.:5000/release/pull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
dist | ||
backend/.env.local | ||
temp | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
[submodule "golem-js"] | ||
path = golem-js | ||
url = git@github.com:golemfactory/golem-js.git | ||
url = https://github.com/golemfactory/golem-js.git | ||
branch = pociej/deposit | ||
[submodule "ya-ts-client"] | ||
path = ya-ts-client | ||
url = git@github.com:golemfactory/ya-ts-client.git | ||
url = https://github.com/golemfactory/ya-ts-client.git | ||
branch = pociej/deposit | ||
[submodule "golem-sdk-task-executor"] | ||
path = golem-sdk-task-executor | ||
url = git@github.com:golemfactory/golem-sdk-task-executor.git | ||
url = https://github.com/golemfactory/golem-sdk-task-executor.git | ||
branch = pociej/deposit | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
ARG BACKEND_URL=http://127.0.0.1:5174 | ||
|
||
FROM node:20-bullseye | ||
|
||
RUN apt-get update && apt-get install -y vim | ||
|
||
RUN npm install -g pnpm serve | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
COPY . /app | ||
|
||
ARG BACKEND_URL | ||
ENV VITE_BACKEND_URL=$BACKEND_URL | ||
RUN echo "The backend URL is $BACKEND_URL" | ||
RUN mkdir /app/temp | ||
|
||
RUN pnpm install | ||
RUN pnpm build:all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
services: | ||
# application service | ||
backend: | ||
image: ghcr.io/golemfactory/deposit_example:${DEPLOY_BRANCH:-latest} | ||
command: pnpm run run | ||
working_dir: /app/backend | ||
environment: | ||
- YAGNA_APPKEY=66667777888 | ||
- YAGNA_API_URL=http://yagna:7465 | ||
- JWT_SECRET=dup]a | ||
- JWT_TOKEN_EXPIRATION=1d | ||
- JWT_REFRESH_TOKEN_EXPIRATION=7d | ||
- JWT_ISSUER=golem.network | ||
- MONGO_URI=mongodb://${MONGO_ROOT_USER}:${MONGO_ROOT_PASSWORD}@mongo:27017/ | ||
- HOST=0.0.0.0 | ||
- PORT=5174 | ||
- DB_NAME=depositDB | ||
- DEPOSIT_CONTRACT_ADDRESS=0xb9919c8D8D384d93C195503064A3b303Ea8Fdbaa | ||
ports: | ||
- "5174:5174" | ||
depends_on: | ||
- yagna | ||
- mongo | ||
|
||
frontend: | ||
image: ghcr.io/golemfactory/deposit_example:${DEPLOY_BRANCH:-latest} | ||
command: pnpm run run | ||
working_dir: /app/frontend | ||
environment: | ||
- YAGNA_APPKEY=66667777888 | ||
- YAGNA_API_URL=http://yagna:7465 | ||
- JWT_SECRET=dup]a | ||
- JWT_TOKEN_EXPIRATION=1d | ||
- JWT_REFRESH_TOKEN_EXPIRATION=7d | ||
- JWT_ISSUER=golem.network | ||
- MONGO_URI=mongodb://${MONGO_ROOT_USER}:${MONGO_ROOT_PASSWORD}@mongo:27017/ | ||
- HOST=0.0.0.0 | ||
- PORT=5174 | ||
- DB_NAME=depositDB | ||
- DEPOSIT_CONTRACT_ADDRESS=0xb9919c8D8D384d93C195503064A3b303Ea8Fdbaa | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- backend | ||
# yagna service | ||
yagna: | ||
build: | ||
context: ../yagna | ||
dockerfile: Dockerfile | ||
args: | ||
- YAGNA_VERSION=pre-rel-v0.15.0-deposits-beta1 | ||
command: yagna service run | ||
environment: | ||
- YAGNA_AUTOCONF_APPKEY=66667777888 | ||
- YAGNA_AUTOCONF_ID_SECRET=0000000000000000000000000000000000000000000000000000000222222222 | ||
- YAGNA_API_URL=http://0.0.0.0:7465 | ||
- SUBNET=change_me | ||
- YA_NET_BIND_URL=udp://0.0.0.0:0 | ||
# mongo service | ||
mongo: | ||
image: mongo | ||
environment: | ||
- MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USER} | ||
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD} | ||
- MONGO_INITDB_DATABASE=project | ||
# mongo express service | ||
mongo-express: | ||
image: mongo-express | ||
environment: | ||
- ME_CONFIG_MONGODB_SERVER=mongo | ||
- ME_CONFIG_MONGODB_PORT=27017 | ||
- ME_CONFIG_MONGODB_ENABLE_ADMIN=false | ||
- ME_CONFIG_MONGODB_AUTH_DATABASE=admin | ||
- ME_CONFIG_MONGODB_AUTH_USERNAME=${MONGO_ROOT_USER} | ||
- ME_CONFIG_MONGODB_AUTH_PASSWORD=${MONGO_ROOT_PASSWORD} | ||
- ME_CONFIG_BASICAUTH_USERNAME=${MONGOEXPRESS_LOGIN} | ||
- ME_CONFIG_BASICAUTH_PASSWORD=${MONGOEXPRESS_PASSWORD} | ||
depends_on: | ||
- mongo | ||
ports: | ||
- "8888:8081" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const express = require('express'); | ||
const { spawn } = require('child_process'); | ||
|
||
const app = express(); | ||
|
||
app.get('/release/pull', (req, res) => { | ||
const deployProcess = spawn('/bin/bash', ['-c', './script.sh'], | ||
{ | ||
cwd: process.cwd(), | ||
stdio: "inherit" | ||
} | ||
); | ||
res.send('Hello World'); | ||
}); | ||
|
||
const server = app.listen(5000, '0.0.0.0', () => { | ||
console.log('Server running'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "deposit-payments-deploy-updater", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"express": "^4.17.1" | ||
}, | ||
"scripts": { | ||
"start": "node npm_server.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
for i in {1..10} | ||
do | ||
docker-compose pull | ||
# docker-compose config | ||
docker-compose up -d | ||
sleep 10 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
services: | ||
# application service | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
- BACKEND_URL=${BACKEND_URL:-http://127.0.0.1:5174} | ||
command: tail -F anything | ||
environment: | ||
- YAGNA_APPKEY=66667777888 | ||
- YAGNA_API_URL=http://yagna:7465 | ||
- JWT_SECRET=dup]a | ||
- JWT_TOKEN_EXPIRATION=1d | ||
- JWT_REFRESH_TOKEN_EXPIRATION=7d | ||
- JWT_ISSUER=golem.network | ||
- MONGO_URI=mongodb://${MONGO_ROOT_USER}:${MONGO_ROOT_PASSWORD}@mongo:27017/ | ||
- HOST=0.0.0.0 | ||
- PORT=5174 | ||
- DB_NAME=depositDB | ||
- DEPOSIT_CONTRACT_ADDRESS=0xb9919c8D8D384d93C195503064A3b303Ea8Fdbaa | ||
ports: | ||
- "3000:3000" | ||
- "5174:5174" | ||
# yagna service | ||
yagna: | ||
build: | ||
context: ./yagna | ||
dockerfile: Dockerfile | ||
args: | ||
- YAGNA_VERSION=pre-rel-v0.15.0-deposits-beta1 | ||
command: yagna service run | ||
environment: | ||
- YAGNA_AUTOCONF_APPKEY=66667777888 | ||
- YAGNA_AUTOCONF_ID_SECRET=0000000000000000000000000000000000000000000000000000000222222222 | ||
- YAGNA_API_URL=http://0.0.0.0:7465 | ||
- SUBNET=change_me | ||
- YA_NET_BIND_URL=udp://0.0.0.0:0 | ||
# mongo service | ||
mongo: | ||
image: mongo | ||
environment: | ||
- MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USER} | ||
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD} | ||
- MONGO_INITDB_DATABASE=project | ||
# mongo express service | ||
mongo-express: | ||
image: mongo-express | ||
environment: | ||
- ME_CONFIG_MONGODB_SERVER=mongo | ||
- ME_CONFIG_MONGODB_PORT=27017 | ||
- ME_CONFIG_MONGODB_ENABLE_ADMIN=false | ||
- ME_CONFIG_MONGODB_AUTH_DATABASE=admin | ||
- ME_CONFIG_MONGODB_AUTH_USERNAME=${MONGO_ROOT_USER} | ||
- ME_CONFIG_MONGODB_AUTH_PASSWORD=${MONGO_ROOT_PASSWORD} | ||
- ME_CONFIG_BASICAUTH_USERNAME=${MONGOEXPRESS_LOGIN} | ||
- ME_CONFIG_BASICAUTH_PASSWORD=${MONGOEXPRESS_PASSWORD} | ||
depends_on: | ||
- mongo | ||
ports: | ||
- "8888:8081" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.