Skip to content

Commit

Permalink
Merge pull request #18 from 42Seoul-LastDance/develop
Browse files Browse the repository at this point in the history
Release v1.0
  • Loading branch information
Tolerblanc authored Oct 26, 2023
2 parents b078193 + ea1518e commit 14026f4
Show file tree
Hide file tree
Showing 172 changed files with 28,656 additions and 7,784 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'max-len': [
'warn',
{
code: 120,
},
],
},
};
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# compiled output
/dist
/node_modules
/node_modulesß
/env

# Logs
logs
Expand All @@ -14,10 +15,6 @@ lerna-debug.log*
# OS
.DS_Store
srcs/postgresql/*
*.png
*.jpeg
*.jpg
!default.png
.env

# Tests
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "env"]
path = env
url = https://github.com/42Seoul-LastDance/env
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"singleQuote": true,
"trailingComma": "all",
"useTabs": false,
"tabWidth": 4
"tabWidth": 4,
"printWidth": 160
}
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ all : $(NAME)

$(NAME) :
mkdir -p ./srcs/postgresql
@if docker info | grep -q "ERROR"; then \
@git submodule update --init --remote
@cp ./env/.env .
@bash utils/setting_ip.sh
@if docker info | grep -q "not" || docker info | grep -q "ERROR"; then \
echo "\033[0;96m--- Docker will be running soon ---"; \
echo "y" | ./utils/init_docker.sh; \
while docker info | grep -q "ERROR"; do \
Expand All @@ -15,6 +18,7 @@ $(NAME) :
echo "\033[0;96m--- Docker is already running ---"; \
docker-compose up --build; \
fi
docker-compose up --build

down :
docker-compose down
Expand Down Expand Up @@ -42,6 +46,12 @@ xtest :
docker exec next curl http://localhost:4242

exec :
docker exec -it react /bin/bash
docker exec -it next /bin/bash

.PHONY : all down clean fclean docker cntest stest xtest next
next :
docker-compose restart next

db :
docker exec -it postgresql psql

.PHONY : all down clean fclean docker cntest stest xtest next db
102 changes: 52 additions & 50 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,51 @@ services:
- next:/usr/app/srcs
networks:
- my_network
# env_file:
# - ./.env
env_file:
- ./env/.env
ports:
- '4242:4242'
restart: always
# depends_on:
# - nest
# - postgresql
depends_on:
- nest
- postgresql

# nest:
# container_name: nest
# build: ./services/nest
# image: nest:ts
# volumes:
# - nest:/usr/app/srcs
# networks:
# - my_network
# env_file:
# - ./.env
# ports:
# - '3000:3000'
# restart: always
# depends_on:
# - postgresql
nest:
container_name: nest
build: ./services/nest
image: nest:ts
volumes:
- nest:/usr/app/srcs
networks:
- my_network
env_file:
- ./env/.env
ports:
- '3000:3000'
restart: always
depends_on:
- postgresql

# postgresql:
# container_name: postgresql
# build:
# context: ./services/postgresql
# args:
# - DB_NAME=${DB_NAME}
# - POSTGRES_USER_ID=${POSTGRES_USER_ID}
# - POSTGRES_USER_PASSWORD=${POSTGRES_USER_PASSWORD}
# image: db:ts
# expose:
# - '5432'
# volumes:
# - db:/var/lib/postgresql/data
# environment:
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
# networks:
# - my_network
# restart: always
postgresql:
container_name: postgresql
build:
context: ./services/postgresql
args:
- DB_NAME=${DB_NAME}
- POSTGRES_USER_ID=${POSTGRES_USER_ID}
- POSTGRES_USER_PASSWORD=${POSTGRES_USER_PASSWORD}
image: db:ts
expose:
- '5432'
volumes:
- db:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
env_file:
- ./env/.env
networks:
- my_network
restart: always

volumes:
next:
Expand All @@ -60,18 +62,18 @@ volumes:
type: none
o: bind
device: '${PWD}/srcs/next'
# nest:
# driver: local
# driver_opts:
# type: none
# o: bind
# device: '${PWD}/srcs/nest'
# db:
# driver: local
# driver_opts:
# type: none
# o: bind
# device: '${PWD}/srcs/postgresql'
nest:
driver: local
driver_opts:
type: none
o: bind
device: '${PWD}/srcs/nest'
db:
driver: local
driver_opts:
type: none
o: bind
device: '${PWD}/srcs/postgresql'

networks:
my_network:
Expand Down
1 change: 1 addition & 0 deletions env
Submodule env added at 5267da
1 change: 0 additions & 1 deletion services/nest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ COPY ./init_nest.sh /usr/app/
RUN apt-get update \
&& apt-get install -y dumb-init \
&& npm install -g npm \
&& npm install -g @nestjs/cli \
&& chmod 777 init_nest.sh


Expand Down
10 changes: 8 additions & 2 deletions services/nest/init_nest.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
npm install --prefix srcs --save @nestjs/cli
# npm install --prefix srcs --save @nestjs/cli
# npm install --prefix srcs --save bcrypt
# npm install --prefix srcs --save @bcrypt
npm install --prefix srcs

npm run --prefix srcs start:dev --cache-clear
# npm run --prefix srcs start:dev --cache-clear
npm run --prefix srcs build
npm run --prefix srcs start
# npm run --prefix srcs start --cache-clear
1 change: 0 additions & 1 deletion services/next/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ RUN chmod 777 init.sh
ENTRYPOINT ["/usr/bin/dumb-init", "--"]

CMD ["./init.sh"]
#CMD ["tail", "-f"]
29 changes: 16 additions & 13 deletions services/next/init.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
echo "----- Start installing npm dependencies -----"

npm install --prefix srcs next
npm install --prefix srcs --save @headlessui/react
# npm install --prefix srcs --save redux react-redux @reduxjs/toolkit react-devtools
# npm install --prefix srcs --save react-router-dom react-cookie jsonwebtoken
# npm install --prefix srcs --save react-unity-webgl nextjs-unity-webgl
# npm install --prefix srcs --save axios axios-auth-refresh
# npm install --prefix srcs --save @typescript-eslint
# npm install --prefix srcs --save turbo

npm update --prefix srcs next @headlessui/react redux react-redux @reduxjs/toolkit react-devtools react-router-dom react-cookie jsonwebtoken react-unity-webgl nextjs-unity-webgl axios axios-auth-refresh @typescript-eslint turbo
echo "----- Successfully installed -----"

npm --prefix srcs run dev --cache-clear
npm install --prefix srcs
npm cache clean --force

npm install --prefix srcs --save redux react-redux @reduxjs/toolkit react-devtools react-router-dom react-cookie jsonwebtoken
npm install --prefix srcs --save react-unity-webgl nextjs-unity-webgl
npm install --prefix srcs --save axios axios-auth-refresh
npm install --prefix srcs --save ws socket.io utf-8-validate bufferutil
npm install --prefix srcs --save @typescript-eslint
npm install --prefix srcs --save babel-loader @babel/preset-react @babel/preset-env ts-loader
npm install --prefix srcs --save @mui/material @mui/styles @emotion/react @emotion/styled @fontsource/roboto @mui/icons-material

echo "----- 😎 Successfully installed -----"

npm --prefix srcs run build
npm --prefix srcs run start
# npm --prefix srcs run dev
4 changes: 1 addition & 3 deletions services/postgresql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ RUN echo "CREATE DATABASE ${DB_NAME};" > /docker-entrypoint-initdb.d/init_psql.s
echo "CREATE USER ${POSTGRES_USER_ID} WITH SUPERUSER PASSWORD '${POSTGRES_USER_PASSWORD}';" >> /docker-entrypoint-initdb.d/init_psql.sql && \
echo "GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} TO ${POSTGRES_USER_ID};" >> /docker-entrypoint-initdb.d/init_psql.sql && \
echo "\\\c ${DB_NAME};" >> /docker-entrypoint-initdb.d/init_psql.sql && \
# echo "CREATE TABLE users (id SERIAL PRIMARY KEY, name VARCHAR(255), profileUrl VARCHAR(255));" >> /docker-entrypoint-initdb.d/init_psql.sql && \
# echo "INSERT INTO users (name) VALUES ('pongmaster');" >> /docker-entrypoint-initdb.d/init_psql.sql && \
# echo "ALTER TABLE users OWNER TO ${POSTGRES_USER_ID};" >> /docker-entrypoint-initdb.d/init_psql.sql && \
echo "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO ${POSTGRES_USER_ID};" >> /docker-entrypoint-initdb.d/init_psql.sql && \
echo "GRANT ALL PRIVILEGES ON SCHEMA public TO ${POSTGRES_USER_ID};" >> /docker-entrypoint-initdb.d/init_psql.sql

RUN chown postgres:postgres /docker-entrypoint-initdb.d/init_psql.sql

USER postgres

CMD ["postgres", "-D", "/var/lib/postgresql/data"]
6 changes: 6 additions & 0 deletions srcs/nest/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'max-len': [
'warn',
{
code: 120,
},
],
},
};
5 changes: 4 additions & 1 deletion srcs/nest/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ lerna-debug.log*
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.vscode/*
.vscode/*

/profile
!/profile/default.png
3 changes: 2 additions & 1 deletion srcs/nest/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 4,
"useTabs": false
"useTabs": false,
"printWidth": 120
}
Loading

0 comments on commit 14026f4

Please sign in to comment.