Skip to content

Commit

Permalink
Merge pull request #39 from Gearonix/develop
Browse files Browse the repository at this point in the history
merge(develop): updates
  • Loading branch information
gearonix authored Oct 13, 2023
2 parents d1cdce2 + f2d65a3 commit 6df230c
Show file tree
Hide file tree
Showing 215 changed files with 5,144 additions and 3,946 deletions.
1 change: 1 addition & 0 deletions .docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.override.env
24 changes: 24 additions & 0 deletions .docker/compose/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.9'

services:
workspace:
build:
dockerfile: .docker/dockerfile/dev.Dockerfile
context: .
restart: always
profiles:
- workspace
env_file:
- .env
- .docker/.override.env
volumes:
- ./apps:/opt/app/apps
- ./packages:/opt/app/packages
- /opt/app/node_modules
container_name: workspace
networks:
- cgnet
entrypoint: sh entrypoint.sh
ports:
- 3000:3000
- 6868:6868
47 changes: 47 additions & 0 deletions .docker/compose/docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: '3.9'

services:
client:
build:
dockerfile: apps/client/Dockerfile
context: .
container_name: client
restart: always
env_file:
- .env
- .docker/.override.env
networks:
- cgnet
ports:
- 3000:80

gateway:
build:
dockerfile: apps/server/gateway/Dockerfile
context: .
container_name: gateway
depends_on:
- kafka
- mysql
networks:
- cgnet
ports:
- 6868:6868
restart: always
env_file:
- .env
- .docker/.override.env

service-code-executor:
build:
dockerfile: apps/server/service-code-executor/Dockerfile
context: .
container_name: service-code-executor
depends_on:
- kafka
networks:
- cgnet
restart: always
env_file:
- .env
- .docker/.override.env
59 changes: 59 additions & 0 deletions .docker/compose/docker-compose.services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
version: '3.9'

services:
mysql:
image: mysql:latest
restart: always
container_name: db
networks:
- cgnet
ports:
- 3306:3306
volumes:
- ./data:/var/lib/mysql
- ./tools/database:/docker-entrypoint-initdb.d
env_file:
- .env
- .docker/.override.env

zookeeper:
image: confluentinc/cp-zookeeper:latest
container_name: zookeeper
networks:
- cgnet
env_file:
- .env
- .docker/.override.env
ports:
- 22181:2181

kafka:
image: confluentinc/cp-kafka:latest
container_name: kafka
hostname: kafka
networks:
- cgnet
depends_on:
- zookeeper
ports:
- 29092:29092
env_file:
- .env
- .docker/.override.env

kafka_ui:
image: provectuslabs/kafka-ui:latest
container_name: kafka-ui
networks:
- cgnet
depends_on:
- kafka
ports:
- 8080:8080
env_file:
- .env
- .docker/.override.env

networks:
cgnet:
driver: bridge
37 changes: 37 additions & 0 deletions .docker/dockerfile/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#/**
# * This docker file is used only in development mode
# * It runs all processes, microservices and libraries
# * in one large container so as not to take up a lot of
# * space. Hot reload enabled.
# */

FROM --platform=linux/amd64 node:20.8.0-alpine as build
WORKDIR /opt/app

## Installing dependencies ##

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn .yarn

COPY packages/config/package.json packages/config/package.json

RUN yarn install

## Copying source code ##

COPY packages packages

COPY apps apps

RUN yarn install

COPY . .

## Copying entrypoint scripts ##

COPY .docker/sh/entrypoint.dev.sh entrypoint.sh


RUN chmod +x entrypoint.sh;

RUN echo "done."
64 changes: 64 additions & 0 deletions .docker/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "docker",
"$schema": "node_modules/nx/schemas/project-schema.json",
"targets": {
"run:dev": {
"executor": "nx:run-commands",
"options": {
"command": "docker compose -f .docker/compose/docker-compose.services.yml -f .docker/compose/docker-compose.dev.yml --project-directory . up -d"
},
"dependsOn": ["update:dev"]
},
"run:dev:workspace": {
"executor": "nx:run-commands",
"options": {
"command": "docker compose -f .docker/compose/docker-compose.services.yml -f .docker/compose/docker-compose.dev.yml --project-directory . --profile workspace up -d"
},
"dependsOn": ["update:dev:workspace"]
},
"run:prod": {
"executor": "nx:run-commands",
"options": {
"command": "docker compose -f .docker/compose/docker-compose.services.yml -f .docker/compose/docker-compose.prod.yml --project-directory . up -d"
},
"dependsOn": ["update:prod"]
},
"update:dev": {
"executor": "nx:run-commands",
"options": {
"command": "docker compose -f .docker/compose/docker-compose.services.yml -f .docker/compose/docker-compose.dev.yml --project-directory . --progress plain build"
}
},
"update:dev:workspace": {
"executor": "nx:run-commands",
"options": {
"command": "docker compose -f .docker/compose/docker-compose.services.yml -f .docker/compose/docker-compose.dev.yml --project-directory . --profile workspace --progress plain build"
}
},
"update:prod": {
"executor": "nx:run-commands",
"options": {
"command": "docker compose -f .docker/compose/docker-compose.services.yml -f .docker/compose/docker-compose.prod.yml --project-directory . --progress plain build"
}
},
"down:dev": {
"executor": "nx:run-commands",
"options": {
"commands": [
"docker compose -f .docker/compose/docker-compose.services.yml -f .docker/compose/docker-compose.dev.yml --project-directory . --profile full down",
"docker ps"
]
}
},
"down:prod": {
"executor": "nx:run-commands",
"options": {
"commands": [
"docker compose -f .docker/compose/docker-compose.services.yml -f .docker/compose/docker-compose.prod.yml --project-directory . down",
"docker ps"
]
}
}
},
"tags": ["docker"]
}
5 changes: 5 additions & 0 deletions .docker/sh/entrypoint.dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

yarn nx run gateway:prisma:init

yarn nx serve --host=0.0.0.0
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dist
tmp
node_modules
.idea
.husky
.editorconfig
.lintstagedrc
commitlint.config.js
CHANGELOG.md
LICENSE
README.md
jest.config.ts
jest.preset.js
local
data
tmp
.github
.gitignore
.gitattributes
.yarn/cache
.yarn/install-state.gz
3 changes: 3 additions & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@ jobs:
branch: storybook-build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Initializing Playwright
run: npx playwright install

- name: Testing storybook in production
run: yarn nx run web-ui:storybook:test:production
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
/.idea
local
*.env
data
6 changes: 4 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
nodeLinker: node-modules

checksumBehavior: update
#checksumBehavior: update

cacheFolder: ./.yarn/cache
#cacheFolder: ./.yarn/cache

#enableImmutableInstalls: false

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
Expand Down
34 changes: 34 additions & 0 deletions apps/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM --platform=linux/amd64 node:20.8.0-alpine as build
WORKDIR /opt/app

## Installing dependencies ##

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn .yarn

COPY packages/config/package.json packages/config/package.json

RUN yarn install

## Copying source code ##

COPY apps/client apps/client

COPY packages packages

RUN yarn install

COPY . .

## Building app to produciton ##

RUN yarn nx run client:build

## Nginx setup ##

FROM nginx:1.24-alpine

COPY --from=build /opt/app/dist/apps/client /usr/share/nginx/html
COPY ./apps/client/nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80
14 changes: 14 additions & 0 deletions apps/client/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
server {
listen 80;
root /usr/share/nginx/html;

location / {
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

error_page 404 /index.html;
location = /404 {
return 404;
}
}
2 changes: 1 addition & 1 deletion apps/client/src/pages/main/ui/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Main = () => {
return (
<Page>
<div>
main <br />
maifn <br />
<Link to={RoutePaths.EDITOR}>editor</Link>
</div>
</Page>
Expand Down
4 changes: 4 additions & 0 deletions apps/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
extends: ['../../.eslintrc.js'],
ignorePatterns: ['!**/*', '.vitepress/cache']
}
1 change: 1 addition & 0 deletions apps/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vitepress/cache
Loading

0 comments on commit 6df230c

Please sign in to comment.