mirror of
https://github.com/kodxana/madiator-docker-runpod.git
synced 2024-11-09 21:25:17 +01:00
Add files via upload
This commit is contained in:
parent
782e2191ed
commit
24a8925c93
7 changed files with 359 additions and 0 deletions
175
container-template/proxy/nginx.conf
Normal file
175
container-template/proxy/nginx.conf
Normal file
|
@ -0,0 +1,175 @@
|
|||
events { worker_connections 2048; }
|
||||
|
||||
http {
|
||||
client_max_body_size 1024M;
|
||||
|
||||
|
||||
# invokeai
|
||||
server {
|
||||
listen 9091;
|
||||
|
||||
location / {
|
||||
add_header Cache-Control no-cache;
|
||||
proxy_pass http://localhost:9090;
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 =200 @502;
|
||||
}
|
||||
|
||||
location /README.md{
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location @502 {
|
||||
add_header Cache-Control no-cache;
|
||||
root /usr/share/nginx/html;
|
||||
rewrite ^(.*)$ /readme.html break;
|
||||
}
|
||||
}
|
||||
|
||||
# Fast Stable Diffusion + web UI + Comfy UI
|
||||
server {
|
||||
listen 3001;
|
||||
|
||||
location /ws {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Accept-Encoding gzip;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
add_header Cache-Control no-cache;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass http://localhost:3000;
|
||||
}
|
||||
|
||||
location /queue/join {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Accept-Encoding gzip;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
add_header Cache-Control no-cache;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass http://localhost:3000;
|
||||
}
|
||||
|
||||
location / {
|
||||
add_header Cache-Control no-cache;
|
||||
proxy_pass http://localhost:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Accept-Encoding gzip;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 =200 @502;
|
||||
}
|
||||
|
||||
location /README.md{
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location @502 {
|
||||
add_header Cache-Control no-cache;
|
||||
root /usr/share/nginx/html;
|
||||
rewrite ^(.*)$ /readme.html break;
|
||||
}
|
||||
}
|
||||
|
||||
# Oobabooga
|
||||
server {
|
||||
listen 7861;
|
||||
|
||||
location / {
|
||||
add_header Cache-Control no-cache;
|
||||
proxy_pass http://localhost:7860;
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 =200 @502;
|
||||
}
|
||||
|
||||
location /README.md{
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location @502 {
|
||||
add_header Cache-Control no-cache;
|
||||
root /usr/share/nginx/html;
|
||||
rewrite ^(.*)$ /readme.html break;
|
||||
}
|
||||
}
|
||||
|
||||
# code-server
|
||||
server {
|
||||
listen 8081;
|
||||
|
||||
location / {
|
||||
add_header Cache-Control no-cache;
|
||||
proxy_pass http://localhost:8080;
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 =200 @502;
|
||||
}
|
||||
|
||||
location /README.md{
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location @502 {
|
||||
add_header Cache-Control no-cache;
|
||||
root /usr/share/nginx/html;
|
||||
rewrite ^(.*)$ /readme.html break;
|
||||
}
|
||||
}
|
||||
|
||||
# vscode server
|
||||
server {
|
||||
listen 8001;
|
||||
|
||||
location / {
|
||||
add_header Cache-Control no-cache;
|
||||
proxy_pass http://localhost:8000;
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 =200 @502;
|
||||
}
|
||||
|
||||
location /README.md{
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location @502 {
|
||||
add_header Cache-Control no-cache;
|
||||
root /usr/share/nginx/html;
|
||||
rewrite ^(.*)$ /readme.html break;
|
||||
}
|
||||
}
|
||||
|
||||
# Dockerless CLI FastAPI Server
|
||||
server {
|
||||
listen 7270; # "rp" in Hex ASCII
|
||||
|
||||
location / {
|
||||
add_header Cache-Control no-cache;
|
||||
proxy_pass http://localhost:7271;
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 =200 @502;
|
||||
}
|
||||
|
||||
location /README.md{
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location @502 {
|
||||
add_header Cache-Control no-cache;
|
||||
root /usr/share/nginx/html;
|
||||
rewrite ^(.*)$ /readme.html break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
59
container-template/proxy/readme.html
Normal file
59
container-template/proxy/readme.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>502 | README | RunPod </title>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"></script>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
line-height: 1.5;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#content {
|
||||
width: 80%;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
color: #444;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #1e90ff;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
|
||||
<script>
|
||||
// Instantiate Showdown
|
||||
var converter = new showdown.Converter();
|
||||
|
||||
fetch('/README.md')
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
// Convert markdown to HTML
|
||||
var html = converter.makeHtml(text);
|
||||
|
||||
// Insert HTML into the page
|
||||
document.getElementById('content').innerHTML = html;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
6
container-template/runpod.txt
Normal file
6
container-template/runpod.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
______ ______ _
|
||||
(_____ \ (_____ \ | |
|
||||
_____) ) _ _ ____ _____) )___ __| |
|
||||
| __ / | | | || _ \ | ____// _ \ / _ |
|
||||
| | \ \ | |_| || | | || | | |_| |( (_| |
|
||||
|_| |_||____/ |_| |_||_| \___/ \____|
|
83
container-template/start.sh
Normal file
83
container-template/start.sh
Normal file
|
@ -0,0 +1,83 @@
|
|||
#!/bin/bash
|
||||
set -e # Exit the script if any statement returns a non-true return value
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Function Definitions #
|
||||
# ---------------------------------------------------------------------------- #
|
||||
|
||||
# Start nginx service
|
||||
start_nginx() {
|
||||
echo "Starting Nginx service..."
|
||||
service nginx start
|
||||
}
|
||||
|
||||
# Execute script if exists
|
||||
execute_script() {
|
||||
local script_path=$1
|
||||
local script_msg=$2
|
||||
if [[ -f ${script_path} ]]; then
|
||||
echo "${script_msg}"
|
||||
bash ${script_path}
|
||||
fi
|
||||
}
|
||||
|
||||
# Setup SSH
|
||||
setup_ssh() {
|
||||
if [[ $PUBLIC_KEY ]]; then
|
||||
echo "Setting up SSH..."
|
||||
mkdir -p ~/.ssh
|
||||
echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys
|
||||
chmod 700 -R ~/.ssh
|
||||
|
||||
for key_type in rsa dsa ecdsa ed25519; do
|
||||
key_path="/etc/ssh/ssh_host_${key_type}_key"
|
||||
if [ ! -f ${key_path} ]; then
|
||||
ssh-keygen -t ${key_type} -f ${key_path} -q -N ''
|
||||
echo "${key_type^^} key fingerprint:"
|
||||
ssh-keygen -lf ${key_path}.pub
|
||||
fi
|
||||
done
|
||||
|
||||
service ssh start
|
||||
|
||||
echo "SSH host keys:"
|
||||
for key in /etc/ssh/*.pub; do
|
||||
echo "Key: $key"
|
||||
ssh-keygen -lf $key
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Export environment variables
|
||||
export_env_vars() {
|
||||
echo "Exporting environment variables..."
|
||||
printenv | grep -E '^RUNPOD_|^PATH=|^_=' | awk -F = '{ print "export " $1 "=\"" $2 "\"" }' >> /etc/rp_environment
|
||||
echo 'source /etc/rp_environment' >> ~/.bashrc
|
||||
}
|
||||
|
||||
# Start code-server
|
||||
start_code_server() {
|
||||
echo "Starting code-server..."
|
||||
nohup code-server --bind-addr 0.0.0.0:7777 --auth none --disable-telemetry /workspace &> /code-server.log &
|
||||
echo "code-server started"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Main Program #
|
||||
# ---------------------------------------------------------------------------- #
|
||||
|
||||
start_nginx
|
||||
|
||||
execute_script "/pre_start.sh" "Running pre-start script..."
|
||||
|
||||
echo "Pod Started"
|
||||
|
||||
setup_ssh
|
||||
start_code_server
|
||||
export_env_vars
|
||||
|
||||
execute_script "/post_start.sh" "Running post-start script..."
|
||||
|
||||
echo "Start script(s) finished, pod is ready to use."
|
||||
|
||||
sleep infinity
|
21
helper-templates/verify-nccl/Dockerfile
Normal file
21
helper-templates/verify-nccl/Dockerfile
Normal file
|
@ -0,0 +1,21 @@
|
|||
FROM runpod/pytorch:2.0.1-py3.10-cuda11.8.0-devel
|
||||
|
||||
ENV NCCL_DEBUG=TRACE
|
||||
|
||||
WORKDIR /verify-nccl
|
||||
|
||||
# Install additional packages
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
nano \
|
||||
pciutils \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN git clone https://github.com/NVIDIA/cuda-samples.git && \
|
||||
cd cuda-samples/Samples/0_Introduction/simpleP2P && \
|
||||
make
|
||||
|
||||
COPY check_nccl.sh .
|
||||
RUN chmod +x check_nccl.sh
|
||||
|
||||
# Start Container
|
||||
CMD tail -f /dev/null
|
10
helper-templates/verify-nccl/README.md
Normal file
10
helper-templates/verify-nccl/README.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Verify NCCL
|
||||
|
||||
|
||||
## Running Test
|
||||
|
||||
SSH into the pod and then run the following command:
|
||||
|
||||
```bash
|
||||
./check_nccl.sh
|
||||
```
|
5
helper-templates/verify-nccl/check_nccl.sh
Normal file
5
helper-templates/verify-nccl/check_nccl.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Run Simple P2P
|
||||
echo "Running Simple P2P"
|
||||
/verify-nccl/cuda-samples/Samples/0_Introduction/simpleP2P/simpleP2P
|
Loading…
Reference in a new issue