eGovFrame MSA tutorial

Skill Set

MSA on EC2

  1. config(8888) : rabbitmq ์„œ๋ฒ„ ํ•„์š”
  2. discovery(8761) : config, rabbitmq ์„œ๋ฒ„ ํ•„์š”
  3. apigateway(8000) : discovery, rabbitmq ์„œ๋ฒ„ ํ•„์š”
  4. board-service(0) port: 0 # random port
  5. user-service(0)
  6. portal-service(0)
  7. reserve-check-service(0)
  8. reserve-item-service(0)
  9. reserve-request-service(0)

EC2 basic install

sudo dnf install zsh git util-linux-user htop maven docker -y

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/zsh-users/zsh-autosuggestions.git
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
plugins=(
    git
    zsh-autosuggestions
    zsh-syntax-highlighting
)
# node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
. ~/.zshrc
nvm i 14
sudo usermod -a -G docker ec2-user

DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.29.7/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
docker compose version
# ARM
curl -SL https://github.com/docker/compose/releases/download/v2.29.7/docker-compose-linux-aarch64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
docker compose version

msa sample

docker network create egov-network
take ~/workspace.edu
# git clone https://github.com/egovframework/egovframe-msa-edu
git clone https://github.com/kenu/egovframe-msa-edu
cd egovframe-msa-edu/docker-compose/mysql
docker compose up -d
# check db
docker exec -it mysql bash
mysql -u msaportal -p
msaportal
show databases;
exit;
ctrl + D
docker run -d -e TZ=Asia/Seoul --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:management
docker run -d -e TZ=Asia/Seoul --name zipkin -p 9411:9411 openzipkin/zipkin
# restart
docker run -d -e TZ=Asia/Seoul -p 5672:5672 -p 15672:15672 rabbitmq:management
docker run -d -e TZ=Asia/Seoul -p 9411:9411 openzipkin/zipkin
      server:
        native:
#           search-locations: ${search.location:file:///${user.home}/workspace.edu/egovframe-msa-edu/config} # Windows
          search-locations: file://${user.home}/workspace.edu/egovframe-msa-edu/config # MacOS
./gradlew build -x test
sleep 3
nohup java -jar build/libs/config-1.0.0.jar&
cd ../discovery
./gradlew build -x test

cd ../apigateway
./gradlew build -x test

cd ../board-service
./gradlew build -x test

cd ../user-service
./gradlew build -x test

cd ../portal-service
./gradlew build -x test

cd ../reserve-check-service
./gradlew build -x test

cd ../reserve-item-service
./gradlew build -x test

cd ../reserve-request-service
./gradlew build -x test
cd ../discovery
nohup java -jar build/libs/discovery-1.0.0.jar&
cd ../apigateway
nohup java -jar build/libs/apigateway-1.0.0.jar&
cd ../board-service
nohup java -jar build/libs/board-service-1.0.0.jar&
cd ../user-service
nohup java -jar build/libs/user-service-1.0.0.jar&
cd ../portal-service
nohup java -jar build/libs/portal-service-1.0.0.jar&
cd ../reserve-check-service
nohup java -jar build/libs/reserve-check-service-1.0.0.jar&
cd ../reserve-item-service
nohup java -jar build/libs/reserve-item-service-1.0.0.jar&
cd ../reserve-request-service
nohup java -jar build/libs/reserve-request-service-1.0.0.jar&
cd ../../frontend/admin
vi next.config.js
#  `localhost` to `ipaddress`
npm i
npm run build
npm run start
# http://ipaddress:3000
1@gmail.com / test1234!

cd ../portal

vi next.config.js
vi src/constants/env.ts
# `localhost` to `ipaddress`
npm i
npm run build
PORT=4000 npm run start
# http://ipaddress:4000

To be continued...

docker run -d -e TZ=Asia/Seoul -p 3000:3000 admin
docker run -d -e TZ=Asia/Seoul -p 4000:3000 portal

docker run -d -p 8888:8088 config
docker run -d -p 8761:8088 discovery
docker run -d -p 8000:8088 apigateway
What Else?
inflearn react api server -50% ํ• ์ธ์ฟ ํฐ: 15108-f2af1e086101 buy me a coffee