backup docker-compose.yml
This commit is contained in:
155
docker-compose/docker-compose.yml
Normal file
155
docker-compose/docker-compose.yml
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
networks:
|
||||||
|
default:
|
||||||
|
external:
|
||||||
|
name: my_network
|
||||||
|
|
||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
image: 'jc21/nginx-proxy-manager:latest'
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- '80:80' # Public HTTP Port
|
||||||
|
- '443:443' # Public HTTPS Port
|
||||||
|
- '81:81' # Admin Web Port
|
||||||
|
environment:
|
||||||
|
# Mysql/Maria connection parameters:
|
||||||
|
DB_MYSQL_HOST: "db"
|
||||||
|
DB_MYSQL_PORT: 3306
|
||||||
|
DB_MYSQL_USER: "npm"
|
||||||
|
DB_MYSQL_PASSWORD: "npm"
|
||||||
|
DB_MYSQL_NAME: "npm"
|
||||||
|
DISABLE_IPV6: 'true'
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker/nginx:/data
|
||||||
|
- /mnt/docker/letsencrypt:/etc/letsencrypt
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: 'jc21/mariadb-aria:latest'
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: 'npm'
|
||||||
|
MYSQL_DATABASE: 'npm'
|
||||||
|
MYSQL_USER: 'npm'
|
||||||
|
MYSQL_PASSWORD: 'npm'
|
||||||
|
MARIADB_AUTO_UPGRADE: '1'
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker/mysql:/var/lib/mysql
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis/redis-stack:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 6379:6379
|
||||||
|
- 8001:8001
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker/redis:/data
|
||||||
|
environment:
|
||||||
|
- REDIS_ARGS=--appendonly yes
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
image: mongo
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 27017:27017
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: root
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: example
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker/mongodb:/data/db
|
||||||
|
- /mnt/docker/configdb:/data/configdb
|
||||||
|
|
||||||
|
mongo-express:
|
||||||
|
image: mongo-express
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||||
|
ME_CONFIG_MONGODB_ADMINPASSWORD: example
|
||||||
|
ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
|
||||||
|
ME_CONFIG_BASICAUTH: false
|
||||||
|
|
||||||
|
hello:
|
||||||
|
image: docker.yauk.tv/streamlit
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
|
||||||
|
minio:
|
||||||
|
image: quay.io/minio/minio
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "9000:9000"
|
||||||
|
volumes:
|
||||||
|
- /mnt/ssd/.minio:/data
|
||||||
|
command: server /data --console-address ":9001"
|
||||||
|
|
||||||
|
registry:
|
||||||
|
image: registry:2
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker/registry:/var/lib/registry
|
||||||
|
|
||||||
|
cdn:
|
||||||
|
image: node:slim
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker/cdn:/app
|
||||||
|
entrypoint: sh -c
|
||||||
|
command:
|
||||||
|
- |
|
||||||
|
cd /app
|
||||||
|
cat <<"EOF" > server.js
|
||||||
|
const express = require('express');
|
||||||
|
const cors = require('cors');
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
const app = express();
|
||||||
|
const PORT = 8000;
|
||||||
|
|
||||||
|
app.use(cors());
|
||||||
|
app.use(express.static(path.join(__dirname, 'node_modules')));
|
||||||
|
|
||||||
|
// 기본 라우트
|
||||||
|
app.get('/', (req, res) => {
|
||||||
|
res.send('Hello, World! Use /<filename> to access files.');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.get('/:filename', (req, res) => {
|
||||||
|
const filePath = path.join(__dirname, req.params.filename);
|
||||||
|
fs.access(filePath, fs.constants.F_OK, (err) => {
|
||||||
|
if (err) {
|
||||||
|
return res.status(404).send('File not found');
|
||||||
|
}
|
||||||
|
res.sendFile(filePath);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
app.listen(PORT, () => { console.log('Server is running on http://localhost:' + PORT); });
|
||||||
|
EOF
|
||||||
|
|
||||||
|
npm init -y
|
||||||
|
npm i express cors pretendard @picocss/pico
|
||||||
|
node server.js
|
||||||
|
|
||||||
|
wg-easy:
|
||||||
|
image: ghcr.io/wg-easy/wg-easy
|
||||||
|
environment:
|
||||||
|
- LANG=ko
|
||||||
|
- WG_HOST=192.168.12.2
|
||||||
|
- WEBUI_HOST=wg-easy
|
||||||
|
- PASSWORD_HASH='REDACTED'
|
||||||
|
- PORT=51821
|
||||||
|
- WG_PORT=51820
|
||||||
|
- WG_DEFAULT_DNS=
|
||||||
|
- WG_PERSISTENT_KEEPALIVE=25
|
||||||
|
- WG_ALLOWED_IPS=10.8.0.0/24
|
||||||
|
volumes:
|
||||||
|
- ~/.wg-easy:/etc/wireguard
|
||||||
|
ports:
|
||||||
|
- "51820:51820/udp"
|
||||||
|
restart: unless-stopped
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- SYS_MODULE
|
||||||
|
sysctls:
|
||||||
|
- net.ipv4.ip_forward=1
|
||||||
|
- net.ipv4.conf.all.src_valid_mark=1
|
||||||
133
docker-compose/public.yml
Normal file
133
docker-compose/public.yml
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
networks:
|
||||||
|
default:
|
||||||
|
external:
|
||||||
|
name: my_network
|
||||||
|
|
||||||
|
services:
|
||||||
|
mensa:
|
||||||
|
image: python
|
||||||
|
volumes:
|
||||||
|
- /mnt/docker/mensa:/app
|
||||||
|
working_dir: /app
|
||||||
|
entrypoint: python -m http.server
|
||||||
|
|
||||||
|
yauk-net:
|
||||||
|
image: docker.yauk.tv/streamlit
|
||||||
|
restart: unless-stopped
|
||||||
|
entrypoint: bash -c
|
||||||
|
command:
|
||||||
|
- |
|
||||||
|
pip install redis openai
|
||||||
|
cat <<"EOF" > streamlit_app.py
|
||||||
|
import streamlit as st
|
||||||
|
st.set_page_config(page_title="오늘놀자", page_icon=":kr:", layout='wide')
|
||||||
|
import os, re, logging, uuid, json, time, redis, openai
|
||||||
|
|
||||||
|
def render_equation(response):
|
||||||
|
response = re.sub(r'\\\[([^\]]+?)\\\]', r'$$\1$$', response)
|
||||||
|
response = re.sub(r'\\\(([^\)]+?)\\\)', r'$\1$', response)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
r = redis.Redis('redis', db=1)
|
||||||
|
st.html("""<style>
|
||||||
|
@import url("https://cdn.yauk.net/pretendard/dist/web/variable/pretendardvariable-dynamic-subset.css");
|
||||||
|
|
||||||
|
header, ::-webkit-scrollbar { display: none !important; }
|
||||||
|
|
||||||
|
*:not(pre):not(code):not(kbd):not(.katex):not(span) {
|
||||||
|
font-family: -apple-system, "Pretendard Variable", sans-serif !important;
|
||||||
|
font-weight: 300;
|
||||||
|
strong { font-weight: 500; }
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: "Source Code Pro", "Pretendard Variable", monospace;
|
||||||
|
color: #37e0b5;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre * {
|
||||||
|
font-size: 12px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 { font-weight: 250 !important; }
|
||||||
|
|
||||||
|
|
||||||
|
.block-container {
|
||||||
|
/*max-width:46rem; */
|
||||||
|
padding-left: 1rem;
|
||||||
|
padding-right: 2rem;
|
||||||
|
@media (orientation: landscape) { padding-top: 1rem; }
|
||||||
|
}
|
||||||
|
</style>""")
|
||||||
|
|
||||||
|
|
||||||
|
logging.basicConfig(
|
||||||
|
level=logging.INFO, format='%(asctime)s - %(message)s',
|
||||||
|
handlers=[logging.FileHandler("app.log"), ]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
client = openai.OpenAI(api_key="$OPENAI_API_KEY")
|
||||||
|
|
||||||
|
# visible page starts
|
||||||
|
|
||||||
|
st.subheader('🕊️ 오늘놀자', divider='gray')
|
||||||
|
|
||||||
|
# print history
|
||||||
|
|
||||||
|
if "messages" not in st.session_state:
|
||||||
|
st.session_state.messages = []
|
||||||
|
st.session_state["session_id"] = str(uuid.uuid4())
|
||||||
|
|
||||||
|
for message in st.session_state.messages:
|
||||||
|
with st.chat_message(message["role"]):
|
||||||
|
st.markdown(render_equation(message["content"]))
|
||||||
|
|
||||||
|
# user prompt
|
||||||
|
if prompt := st.chat_input("Message ChatGTP"):
|
||||||
|
with st.chat_message("user"):
|
||||||
|
st.write(prompt)
|
||||||
|
st.session_state.messages.append({"role": "user", "content": prompt})
|
||||||
|
logging.info(f"{st.session_state['session_id']} - User: {prompt}")
|
||||||
|
|
||||||
|
|
||||||
|
# generate reseponse
|
||||||
|
with st.chat_message("assistant"):
|
||||||
|
stream = client.chat.completions.create(
|
||||||
|
model="gpt-4o-mini",
|
||||||
|
messages=[{"role": msg["role"], "content": msg["content"]}
|
||||||
|
for msg in st.session_state.messages],
|
||||||
|
temperature=0,
|
||||||
|
stream=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
response, buffer = "", ""
|
||||||
|
def wrapper():
|
||||||
|
global response, buffer
|
||||||
|
for chunk in stream:
|
||||||
|
chunk = chunk.choices[0].delta.content
|
||||||
|
if chunk is not None:
|
||||||
|
response += chunk
|
||||||
|
buffer += chunk
|
||||||
|
if buffer.count("\\[") == buffer.count("\\]") and \
|
||||||
|
buffer.count("\\(") == buffer.count("\\)") and \
|
||||||
|
not buffer.endswith("\\"):
|
||||||
|
yield render_equation(buffer)
|
||||||
|
buffer = ""
|
||||||
|
with st.empty():
|
||||||
|
st.write_stream(wrapper())
|
||||||
|
if buffer:
|
||||||
|
st.write(render_equation(response))
|
||||||
|
|
||||||
|
|
||||||
|
logging.info(f"{st.session_state['session_id']} - Model: {response}")
|
||||||
|
st.session_state.messages.append({"role": "assistant", "content": response})
|
||||||
|
|
||||||
|
r.rpush('yauk.net', json.dumps({
|
||||||
|
'timestamp': time.time(),
|
||||||
|
'session_id': st.session_state['session_id'],
|
||||||
|
'messages': st.session_state.messages,
|
||||||
|
}))
|
||||||
|
EOF
|
||||||
|
streamlit run streamlit_app.py
|
||||||
Reference in New Issue
Block a user