Skip to content

ITJEONGBO/okestro-demo

Repository files navigation

okestro-demo

favicon

(현) 아이티클라우드


What's included?

Java (11) Spring (5.3.20) / Boot (2.7.0) shield-spring-security Node.js (11.0.23) React.js (18.3.x) Storybook (8.2.x) PostgreSQL (?.?.x) Swagger (2.9.x) shield-kotlin shield-gradle shield-tomcat


🚀Quickstart

🧰Prerequisite(s)

  • 🛠Intellij IDEA
  • ☕JDK (OpenJDK 1.8_201)
  • 🍃Spring (5.3.20) / Boot (2.7.0)
  • 🐘Gradle (7.4.2)
  • 🧶Node.js (11.0.23)
  • ⚛️React.js (18.3.x)
  • 😺Apache Tomcat (9.0.63)
  • 🐳Docker
    • tomcat:8.5.38-jre8-alpine (ssl port: 8443)
    • postgres:10.12-alpine (jdbc port: 5432)
    • gradle:7.4.2-jdk11-focal
    • eclipse-temurin:11-jdk-focal
  • Grafana (ovirt안에 내장)

React.js (18.3.x)React.js

Important

npm이 없을 경우 설치 권고

npm start  # React 앱 실행
npm build # React 앱 빌드

🐘Gradle

Important

#
# 프로퍼티 `profile` 유형
# - local: 로컬 (개발환경)
# - staging
#
# 스프링부트 프로젝트 실행 (개발)
./gradlew itcloud:bootRun -Pprofile=staging -PskipNpm=true

# 아티팩트 생성 (운영)
./gradlew itcloud:bootJar -Pprofile=staging -PskipNpm=true

# back+front
./gradlew itcloud:bootRun -Pprofile=staging -PskipNpm=false

itcloud:bootRun


🐳Docker

Important

🛠Build

# Running on macOS M1
docker build -t itinfo/itcloud:0.1.0 .

# Okestro
docker build -t itinfo/okestro:0.0.5 .

Note

▶️Run

On Linux

# itcloud
docker run -d -it --name itcloud \
  -e ITCLOUD_PORT_HTTP=8080 \
  -e ITCLOUD_PORT_HTTPS=8443 \
  -e ITCLOUD_OVIRT_IP=192.168.0.70 \
  -e POSTGRES_JDBC_URL=192.168.0.70 \
  -e POSTGRES_JDBC_PORT=5432 \
  -e POSTGRES_DATASOURCE_JDBC_ID=<rutil> \
  -e POSTGRES_DATASOURCE_JDBC_PW=<rutil1!> \
  -p 8080:8080 -p 8443:8443 \
  itinfo/itcloud:0.1.0

# postgres
docker run -d -it \
  --name cst_postgres \
  -e POSTGRES_PASSWORD=mysecretpassword \
  -e PGDATA=/var/lib/postgresql/data/pgdata \
  -v where/to/mount:/var/lib/postgresql/data \
  postgres:10.12-alpine

On Windows

:: iotcloud
docker run -d -it --name itcloud ^
  -e ITCLOUD_PORT_HTTP=8080 ^
  -e ITCLOUD_PORT_HTTPS=8443 ^
  -e ITCLOUD_OVIRT_IP=192.168.0.70 ^
  -e POSTGRES_JDBC_URL=192.168.0.70 ^
  -e POSTGRES_JDBC_PORT=5432 ^
  -e POSTGRES_DATASOURCE_JDBC_ID=<rutil> ^
  -e POSTGRES_DATASOURCE_JDBC_PW=<rutil1!> ^
  -p 8080:8080 -p 8443:8443 ^
  itinfo/itcloud:0.1.0

:: postgres
docker run -d -it ^
  --name cst_postgres ^
  -e POSTGRES_PASSWORD=mysecretpassword ^
  -e PGDATA=/var/lib/pgsql/data ^
  -v where/to/mount:/var/lib/pgsql/data ^
  postgres:12.12-alpine

(사용자 정보 접근을 위한) PostgresDB 초기 구성

Postgres 관리자 권한으로 로그인

su - postgres # postgres 사용자로 su 로그인
psql -U postgres -d engine # postgres 사용자로 engine 테이블스페이스에 로그인 (비밀번호X)
GRANT ALL ON SCHEMA aaa_jdbc TO okestro;
#
# GRANT

유용한 쿼리

# DESCRIBE 테이블
SELECT table_name, column_name, data_type FROM information_schema.columns WHERE 1=1
AND table_schema = 'aaa_jdbc'
AND table_name = 'users';
cd /etc/pki/ovirt-engine/certs

🎯TODO


🩺Troubleshooting

admin 계정 잠김

ssh로 해당 서버 접근하여 아래 커맨드 실행

ssh [email protected] -p 22
# ...
# [email protected]'s password:
# Web console: https://ovirt.ititinfo.local:9090/ or https://192.168.0.70:9090/
# 
# Last login: Mon Sep  2 11:08:15 2024 from 192.168.0.218
sudo ovirt-aaa-jdbc-tool user show admin # admin 계정 확인
#
# Picked up JAVA_TOOL_OPTIONS: -Dcom.redhat.fips=false
# -- User admin(<고유아이디>) --
# Namespace: *
# Name: admin
# ID: <고유아이디>
# Display Name:
# Email: admin@localhost
# First Name: admin
# Last Name:
# Department:
# Title:
# Description:
# Account Disabled: false
# Account Locked: false
# Account Unlocked At: 2024-09-02 02:45:20Z
# Account Valid From: 2024-08-27 09:48:37Z
# Account Valid To: 2224-08-27 09:48:37Z
# Account Without Password: false
# Last successful Login At: 2024-09-02 02:45:31Z
# Last unsuccessful Login At: 2024-09-02 02:44:51Z
# Password Valid To: 2025-03-01 01:07:15Z
#
sudo ovirt-aaa-jdbc-tool user password-reset admin --password-valid-to="2029-12-31 23:59:59Z"
#
# Picked up JAVA_TOOL_OPTIONS: -Dcom.redhat.fips=false
# Password:
# Reenter password:
# new password already used 
# 
# >>> 비밀번호 변경실패... 이미 사용했던 비밀번호
# 
sudo ovirt-aaa-jdbc-tool user password-reset admin --password-valid-to="2029-12-31 23:59:59Z" --force # 강제 변경
# 
# Picked up JAVA_TOOL_OPTIONS: -Dcom.redhat.fips=false
# Password:
# Reenter password:
# updating user admin...
# user updated successfully
#
# >>> 비밀번호 변경성공!
# 
sudo ovirt-aaa-jdbc-tool user unlock admin # admin 계정 잠금 풀기
# Picked up JAVA_TOOL_OPTIONS: -Dcom.redhat.fips=false
# updating user admin...
# user updated successfully

Swagger 3

  • 접속URL: /swagger-ui/

Dependencies 주입

https://medium.com/@tericcabrel/implement-jwt-authentication-in-a-spring-boot-3-application-5839e4fd8fac https://hoestory.tistory.com/70