Commit c8d7c8b4 authored by insun park's avatar insun park
Browse files
parents 4c627a3d 17618ca9
# Docker 프로젝트 모음
이 디렉토리는 다양한 목적의 Docker 기반 애플리케이션 및 서비스 환경을 포함하고 있습니다. 각 하위 디렉토리는 독립적인 프로젝트이며, 자체 `README.md` 파일에 더 자세한 설명이 있습니다.
## 🚀 프로젝트 목록
| 프로젝트 디렉토리 | 설명 | 주요 기술 | 실행 방법 |
| --- | --- | --- | --- |
| **`docker_all`** | Java 웹 개발 및 협업에 필요한 모든 서비스(Tomcat, MariaDB, SVN)를 통합한 올인원 개발 서버입니다. | `Tomcat`, `MariaDB`, `SVN`, `Java 8` | `./rebuild_docker.sh` |
| **`docker_centos`** | CentOS 6 기반의 레거시 APM(Apache, PHP, MySQL) 스택을 구축하고, 대용량 SQL 덤프를 자동으로 복원합니다. | `CentOS 6`, `Apache`, `MySQL`, `PHP` | `./rebuild_docker.sh` 또는 수동 |
| **`docker_centos_desktop`** | CentOS 6.10 기반의 웹 서버 환경으로, 소스 컴파일을 통해 최신 빌드 도구(GCC 8)를 설치합니다. | `CentOS 6.10`, `Apache`, `MySQL`, `PHP` | `./rebuild_docker.sh` |
| **`docker_crowling`** | 외부 `geumdo_analysis` 디렉토리의 Python 크롤링/분석 애플리케이션을 FastAPI 서버로 실행합니다. | `FastAPI`, `Python` | `./rebuild.sh` 및 수동 설정 |
| **`docker_db`** | MariaDB 서버 환경을 구축하며, 컨테이너 시작 시 원격 접속 가능한 `root` 계정을 자동으로 설정합니다. | `MariaDB`, `Ubuntu 20.04` | `./rebuild.sh` |
| **`docker_db_new`** | MariaDB 서버 환경으로, `make_root_remote_host.sh` 스크립트를 통해 수동으로 원격 접속을 설정해야 합니다. | `MariaDB`, `Ubuntu 20.04` | `./rebuild.sh` 및 수동 설정 |
| **`docker_fastapi`** | 스마트스토어, 쿠팡 상품 정보 및 리뷰를 수집하고 AI 감성 분석을 수행하는 크롤링 시스템입니다. | `FastAPI`, `Selenium`, `TensorFlow` | `docker-compose up -d` |
| **`docker_fastapi_new`** | AI 감성 분석 및 크롤링 시스템으로, Selenium, Mecab, TensorFlow 등을 포함합니다. | `FastAPI`, `Selenium`, `Mecab`, `Java 8` | `./rebuild.sh` |
| **`docker_flask_proxy`** | 특정 URL로 요청을 전달하는 간단한 HTTPS 리버스 프록시 서버입니다. | `Flask`, `Python` | `./rebuild_docker.sh` |
| **`docker_gitlab`** | 공식 이미지를 사용하여 GitLab CE(Community Edition) 서버를 배포합니다. | `GitLab CE` | `docker-compose up -d` |
| **`docker_java`** | Java 웹 개발을 위한 완전한 환경(Tomcat, MariaDB, SSH)을 제공합니다. | `Tomcat`, `MariaDB`, `Java 8` | `./rebuild_docker.sh` |
| **`docker_jenkins`** | Jenkins CI/CD 자동화 서버를 구축하며, 데이터는 호스트에 영속적으로 저장됩니다. | `Jenkins`, `OpenJDK 8`, `MariaDB` | `./rebuild.sh` |
| **`docker_jupyter`** | GPU를 지원하는 Jupyter Lab 실행 환경으로, PyTorch가 사전 설치되어 있습니다. | `Jupyter Lab`, `PyTorch`, `GPU` | `docker-compose up -d` |
| **`docker_jupyter_gpu_docker`** | TensorFlow와 PyTorch를 모두 지원하는 범용 GPU 딥러닝 연구 환경입니다. | `Jupyter Lab`, `TensorFlow`, `PyTorch`, `CUDA` | `./rebuild_with_fix.sh` |
| **`docker_mailserver`** | Poste.io를 사용하여 SMTP, IMAP, 웹메일 등 모든 기능을 갖춘 올인원 메일 서버를 구축합니다. | `Poste.io` | `./rebuild.sh` |
| **`docker_metaverse`** | PHP와 Node.js 기반의 복합 웹 애플리케이션('노담') 서버 환경을 패키징합니다. | `PHP`, `Node.js`, `MySQL`, `Nginx` | `./rebuild_docker.sh` |
| **`docker_nginx_proxy`** | Nginx 기반 리버스 프록시 서버로, Let's Encrypt `certbot`을 통해 SSL/TLS 인증서를 관리합니다. | `Nginx`, `Certbot`, `OpenSSL` | `./rebuild_docker.sh` |
| **`docker_open_webui`** | Ollama, OpenAI 등 다양한 LLM Runner를 지원하는 사용자 친화적인 웹 UI입니다. | `Docker`, `Ollama`, `Python` | `docker run ...` |
| **`docker_posivibes`** | 'Posivibes'라는 Java 웹 애플리케이션을 실행하기 위한 Tomcat 8.5 기반의 WAS 환경입니다. | `Tomcat 8.5`, `Java 8` | `./rebuild_docker.sh` |
| **`docker_prusa_exporter`** | Prusa 3D 프린터의 상태 정보를 Prometheus로 익스포트하여 Grafana로 모니터링합니다. | `Prometheus`, `Grafana`, `Go` | `docker compose up` |
| **`docker_registry`** | Docker 이미지를 저장하고 관리할 수 있는 사설 레지스트리(Web UI 포함)를 구축합니다. | `Docker Registry`, `Web UI` | `docker-compose up -d` |
| **`docker_securedb`** | 'DBSEC' 데이터베이스 보안 솔루션을 실행하기 위한 환경을 제공합니다. | `OpenJDK 11`, `Ubuntu 20.04` | `./rebuild_docker.sh` |
| **`docker_ubuntu_ssh`** | `sudo` 권한을 가진 일반 사용자가 설정된 기본 Ubuntu 22.04 + SSH 서버 환경입니다. | `Ubuntu 22.04`, `SSH` | `./rebuild_docker.sh` |
| **`docker_vnexa_api`** | 호출 시 마크다운 텍스트를 무작위로 반환하는 간단한 Flask API 서버 예제입니다. | `Flask`, `Python`, `Ubuntu 20.04` | `./rebuild_docker.sh` |
| **`docker_was`** | `sabg.war`라는 특정 Java 웹 애플리케이션을 배포하기 위한 Tomcat 8.5 기반의 WAS 환경입니다. | `Tomcat 8.5`, `Java 8` | `./rebuild_docker.sh` |
| **`docker_was_upgrade`** | OpenJDK 11과 Tomcat 9를 기반으로 하는 업그레이드된 Java WAS 환경입니다. (복제본) | `Tomcat 9`, `Java 11` | `./rebuild_docker.sh` |
| **`docker_was_upgrade_http`** | OpenJDK 11과 Tomcat 9를 기반으로 하는 업그레이드된 Java WAS 환경입니다. | `Tomcat 9`, `Java 11` | `./rebuild_docker.sh` |
| **`docker-windows-vm`** | Docker 컨테이너 내부에 KVM을 설치하고, Vagrant를 사용해 Windows 10 VM을 구동하는 복합 가상화 환경입니다. | `KVM`, `Vagrant`, `Windows 10`, `RDP` | `docker-compose up -d` |
| **`examples`** | Spring Boot 등 내장 WAS를 사용하는 Java Maven 프로젝트를 Docker화하는 예제/템플릿입니다. | `Java`, `Maven`, `Spring Boot` | `./rebuild_docker.sh` |
| **`geumdo-rag-chat-bot`** | 사내 GitLab 코드에 대해 자연어 질의를 할 수 있는 RAG 기반 챗봇 시스템입니다. | `RAG`, `LangChain`, `FastAPI`, `Streamlit` | `docker-compose up --build -d` |
| **`gpu_cooling_monitor`** | TIG 스택(InfluxDB, Grafana)을 활용하여 서버의 GPU 및 시스템 냉각 상태를 실시간으로 모니터링합니다. | `InfluxDB`, `Grafana`, `Python`, `Slack` | `docker-compose up -d` |
| **`jupyter_geumdo_lab`** | Kubernetes(K8s) 기반의 다중 사용자 JupyterHub 서비스로, Google OAuth 인증과 동적 GPU/CPU 서버 생성을 지원합니다. | `Kubernetes`, `JupyterHub`, `NFS`, `OAuth` | `helm upgrade ...` |
| **`docker_3dp`** | Nextcloud 파일 관리, 웹 기반 원격 슬라이싱(PrusaSlicer), 프린터 제어 기능을 통합한 3D 프린팅 솔루션입니다. | `Nextcloud`, `PrusaSlicer`, `Flask`, `PHP` | `./rebuild_docker.sh` |
---
보다 자세한 내용은 각 디렉토리의 `README.md` 파일을 참고하십시오.
\ No newline at end of file
# os with ssh
# images
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
# package procedure(update&upgrade&install)
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y vim net-tools zip unzip apt-utils iputils-ping wget tar curl language-pack-ko openssh-server openjdk-17-jdk maven mariadb-server python3 python3-venv python3-pip && \
apt-get install -y libfuse2 libglu1-mesa ibwebkit2gtk-4.0-dev
#아래 쪽은 prusaSlicer를 위한 library임
# Set up configuration for SSH
RUN mkdir /var/run/sshd
RUN echo 'root:!@#gds$%^' | chpasswd
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config
# SSH login fix. Otherwise, user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
# env
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64" >> /etc/profile && \
echo "export PATH=$PATH:$JAVA_HOME/bin" >> /etc/profile && \
echo "export LANG=ko_KR.UTF-8" >> /etc/profile && \
echo "export VENV_HOME=/home/gds/printer/venv/" >> /etc/profile && \
echo "export PATH=$PATH:$VENV_HOME/bin" >> /etc/profile
#run script folder and copy script
RUN mkdir /service_script
COPY start_service.sh /service_script
COPY setting.sql /service_script
RUN chmod +x /service_script/start_service.sh
COPY PrusaSlicer /usr/bin
RUN chmod a+x /usr/bin/PrusaSlicer
# install nextcloud
RUN apt install -y nginx
RUN apt install -y software-properties-common
RUN add-apt-repository ppa:ondrej/php -y
RUN apt update -y
RUN apt-get install -y \
php7.4 \
php7.4-fpm \
php7.4-mysql \
php7.4-gd \
php7.4-curl \
php7.4-xml \
php7.4-zip \
php7.4-mbstring \
php7.4-bcmath \
php7.4-gmp \
php7.4-imagick \
php7.4-intl
RUN ln -fs /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \
dpkg-reconfigure --frontend noninteractive tzdata
WORKDIR /mnt
RUN mkdir nextcloud
RUN wget https://github.com/nextcloud/server/archive/refs/tags/v23.0.12.zip && \
unzip v23.0.12.zip -d /mnt/nextcloud && \
rm -rf v23.0.12.zip && \
chown -R www-data:www-data nextcloud && \
chmod -R 755 nextcloud
#package clean unused
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Expose port(SSH,NGINX,DB,FLASK,EMBED WAS)
EXPOSE 22 80 3000 3306 8080 8090 8060 8071
# Run SSH,NGINX,DB,FLASK,EMBED WAS
CMD ["/service_script/start_service.sh"]
# 3D 프린팅 관리 및 웹 슬라이싱 솔루션
본 프로젝트는 Docker 기반으로 패키징된 복합 3D 프린팅 관리 솔루션입니다. Nextcloud를 이용한 파일 관리, 웹 기반 원격 슬라이싱, 프린터 제어 기능을 통합하여 제공합니다.
## 기술 아키텍처
시스템은 모든 서비스가 단일 Docker 컨테이너에서 동작하는 올인원(All-in-one) 방식으로 설계되었습니다.
- **`Dockerfile`**: `ubuntu:20.04` 베이스 이미지 위에 다음과 같은 다양한 소프트웨어를 설치하여 복잡한 실행 환경을 구성합니다.
- **서버 소프트웨어**: Nginx, PHP 7.4-FPM, MariaDB, OpenSSH Server, OpenJDK 17
- **핵심 애플리케이션**:
- **Nextcloud 23.0.12**: 소스 코드를 직접 다운로드하여 설치. 파일 저장 및 관리의 중심 역할을 합니다.
- **PrusaSlicer**: AppImage 형태의 3D 프린터 슬라이서를 `/usr/bin`에 설치하여 커맨드라인으로 실행할 수 있도록 합니다.
- **Python 3 / Flask**: 슬라이싱 API 및 프린터 제어 프록시를 위한 웹 애플리케이션을 실행합니다.
- **`docker-compose.yml`**:
- **단일 서비스 `os`**: 모든 기능이 포함된 `Dockerfile`을 빌드하여 `docker_3dp`라는 이름의 컨테이너를 생성합니다.
- **포트 매핑**: Nextcloud(80), SSH(2212), Flask API(3000), MariaDB(3306), 다수의 임베디드 Tomcat(8080, 8090 등) 포트를 외부에 노출시켜 각 서비스에 접근할 수 있도록 합니다.
- **볼륨 및 권한**:
- 호스트의 `./printer` 폴더를 컨테이너의 Flask 앱 경로에, `./sites-available`을 Nginx 설정 경로에 마운트하여 외부에서 코드를 수정하고 관리할 수 있게 합니다.
- AppImage 실행에 필요한 FUSE(Filesystem in Userspace)를 사용하기 위해 `/dev/fuse` 장치를 마운트하고 `SYS_ADMIN` 권한과 `apparmor:unconfined` 설정을 부여합니다. 이는 컨테이너에 높은 수준의 권한을 부여하는 중요한 설정입니다.
### 워크플로우
1. **서비스 시작 (`start_service.sh`)**: 컨테이너가 시작되면 이 스크립트가 실행되어 SSH, MariaDB, PHP-FPM, Nginx 등 내부의 모든 데몬을 순차적으로 구동합니다. 또한, Flask 웹 애플리케이션을 실행하여 API 서비스 준비를 마칩니다.
2. **파일 관리 (Nextcloud)**: 사용자는 웹 브라우저를 통해 `http://<host-ip>`로 접속하여 Nextcloud에 3D 모델 파일(.stl)을 업로드하고 관리합니다.
3. **웹 슬라이싱 (Flask API)**:
- 외부 클라이언트는 `http://<host-ip>:3000/slice` 엔드포인트로 HTTP POST 요청을 보냅니다.
- 요청에는 슬라이싱할 STL 파일의 경로(Nextcloud 내)와 세부적인 프린팅 옵션(레이어 높이, 채우기 밀도 등)이 포함됩니다.
- Flask 앱은 `subprocess` 모듈을 사용하여 `PrusaSlicer` 커맨드라인을 실행하고, 전달받은 옵션을 적용하여 STL 파일을 G-code로 변환합니다.
- 슬라이싱 과정에서 발생하는 특정 오류를 감지하고, 이를 사용자 친화적인 한글 메시지와 코드로 변환하여 응답하는 상세한 예외 처리 기능이 포함되어 있습니다.
4. **프린터 제어 (PrusaLink Proxy)**:
- `http://<host-ip>:3000/proxy` 엔드포인트는 PrusaLink API를 중계하는 프록시 역할을 수행합니다. 이를 통해 실제 3D 프린터의 상태 조회, 출력 시작/중지 등의 원격 제어가 가능합니다.
## 기술 스택
- **오케스트레이션**: Docker, Docker Compose
- **웹 서버**: Nginx
- **애플리케이션 서버**: PHP 7.4-FPM, Flask (Python)
- **데이터베이스**: MariaDB
- **파일 공유 플랫폼**: Nextcloud 23.0.12
- **3D 슬라이서**: PrusaSlicer (AppImage)
- **주요 언어**: Python, Bash, PHP
## 실행 방법
### 사전 요구사항
- Docker 및 Docker Compose
- `3dp_dbconfig`, `3dp_dbdata` 라는 이름의 Docker 외부 볼륨이 사전에 생성되어 있어야 합니다.
```bash
docker volume create 3dp_dbconfig
docker volume create 3dp_dbdata
```
### 실행
1. **Docker 이미지 빌드 및 컨테이너 실행**:
```bash
# (선택) 재빌드 및 실행 스크립트
./rebuild_docker.sh
# 또는 docker-compose 직접 실행
docker-compose up --build -d
```
2. **애플리케이션 접근**:
- **Nextcloud**: `http://<서버_IP>`
- **슬라이싱 API**: `http://<서버_IP>:3000`
- **SSH**: `ssh root@<서버_IP> -p 2212` (초기 비밀번호는 Dockerfile 확인 필요)
### 중지
```bash
docker-compose down
```
\ No newline at end of file
version: '3'
services:
os:
build:
context: .
dockerfile: Dockerfile
container_name: docker_3dp
ports:
- "80:80" #NGINX NEXTCLOUD
- "2212:22" # SSH
- "3000:3000" #FLASK API
- "3306:3306" # DB
- "8080:8080" # EMBED TOMCAT
- "8090:8090" # EMBED TOMCAT(g3d)
- "8060:8060" # EMBED TOMCAT(rvoch3d)
- "8071:8071" # EMBED TOMCAT(g3d-test)
network_mode: bridge
restart: always
volumes:
- ./printer:/home/gds/printer
- ./data:/data
- ./sites-available:/etc/nginx/sites-available
- 3dp_dbconfig:/etc/mysql
- 3dp_dbdata:/var/lib/mysql
- /dev/fuse:/dev/fuse #App image 사용을 위한 device mount
devices:
- /dev/fuse #FUSE 디바이스 사용
cap_add:
- SYS_ADMIN #시스템 관리자 권한 추가
security_opt:
- apparmor:unconfined #AppArmor 비활성화
volumes:
3dp_dbconfig:
external: true
3dp_dbdata:
external: true
printer @ 1593600b
Subproject commit 1593600b24f7e7ab52862c2110ceace54aedb875
#!/bin/sh
# Build Docker image with explicit build context and Dockerfile path
# Check and create volumes if they don't exist
create_volume() {
docker volume inspect $1 > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Volume '$1' already exists."
else
docker volume create --name=$1
echo "Volume '$1' created."
fi
}
create_volume 3dp_dbdata
create_volume 3dp_dbconfig
docker build -t .
# Run Docker Compose with a specific container name
docker-compose up -d --build
#원하는 루트 원격 계정 password 입력
grant all privileges on *.* to root@'%' identified by '!@#gds$%^';
flush privileges;
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
#listen 80 default_server;
#listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
#root /var/www/html;
# Add index.php to the list if you are using PHP
#index index.html index.htm index.nginx-debian.html;
#server_name _;
#location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
#}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/bin/sh
# Check and create volumes if they don't exist
create_volume() {
docker volume inspect $1 > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Volume '$1' already exists."
else
docker volume create --name=$1
echo "Volume '$1' created."
fi
}
create_volume svndata
create_volume dbdata
create_volume dbconfig
create_volume wasconfig
create_volume data
create_volume wardata
create_volume securedb
# Build Docker image with explicit build context and Dockerfile path
docker build -t docker_all_os .
# Run Docker Compose with a specific container name
docker-compose up -d
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment