Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge(develop): updates #39

Merged
merged 25 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0bbc7df
chore: initialized mysql using docker-compose
gearonix Oct 6, 2023
f8c3a33
chore(docker): containerization implemented in `developnent` mode
gearonix Oct 7, 2023
f090a46
chore(docker): started developing production containerization
gearonix Oct 7, 2023
b962ad6
chore(docker): finished developing containerization
gearonix Oct 7, 2023
a0828be
feat(kafka): connected kafka and started developing microservices
gearonix Oct 8, 2023
6defa77
feat(kafka): communication between microservices works
gearonix Oct 8, 2023
3f3ad55
fix: small fixes
gearonix Oct 8, 2023
8db0523
feat: rewrited execute-code microservice to cqrs pattern
gearonix Oct 8, 2023
983b214
fix: small fixes
gearonix Oct 8, 2023
a1a00d2
fix: small fixes
gearonix Oct 8, 2023
0fcdf16
refactor: improving microservices
gearonix Oct 9, 2023
61af70c
refactor: removed code-executor.service
gearonix Oct 9, 2023
361ba7a
chore(docker): added the first microservice to the development versio…
gearonix Oct 9, 2023
5267023
chore(docker): added the first microservice to the production version…
gearonix Oct 9, 2023
7cc47f2
chore(docker): small fixes
gearonix Oct 9, 2023
f768b30
refactor(docker): updates
gearonix Oct 9, 2023
3e6ded3
chore: added microservice generator
gearonix Oct 9, 2023
f9e63ca
fix: small fixes
gearonix Oct 10, 2023
09802d4
feat(vitepress): initialized docs
gearonix Oct 10, 2023
9fe1799
style(`docs`): customized home page
gearonix Oct 10, 2023
7250428
docs: started writing `getting-started` page
gearonix Oct 10, 2023
e31396d
docs: completed several pages
gearonix Oct 11, 2023
85a593a
docs: updates
gearonix Oct 12, 2023
752d301
docs: updates
gearonix Oct 13, 2023
f2d65a3
fix(ci): fixes
gearonix Oct 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading