removed extra container and added new process to soketi container
This commit is contained in:
@@ -326,7 +326,7 @@ respond 404
|
|||||||
'loadBalancer' => [
|
'loadBalancer' => [
|
||||||
'servers' => [
|
'servers' => [
|
||||||
0 => [
|
0 => [
|
||||||
'url' => 'http://coolify-terminal:6002',
|
'url' => 'http://coolify-realtime:6002',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -404,7 +404,7 @@ $schema://$host {
|
|||||||
reverse_proxy coolify-realtime:6001
|
reverse_proxy coolify-realtime:6001
|
||||||
}
|
}
|
||||||
handle /terminal/* {
|
handle /terminal/* {
|
||||||
reverse_proxy coolify-terminal:6002
|
reverse_proxy coolify-realtime:6002
|
||||||
}
|
}
|
||||||
reverse_proxy coolify:80
|
reverse_proxy coolify:80
|
||||||
}";
|
}";
|
||||||
|
@@ -47,21 +47,19 @@ services:
|
|||||||
- .env
|
- .env
|
||||||
ports:
|
ports:
|
||||||
- "${FORWARD_SOKETI_PORT:-6001}:6001"
|
- "${FORWARD_SOKETI_PORT:-6001}:6001"
|
||||||
|
- "6002:6002"
|
||||||
|
volumes:
|
||||||
|
- ./docker/soketi-entrypoint/soketi-entrypoint.sh:/soketi-entrypoint.sh
|
||||||
|
- ./package.json:/terminal/package.json
|
||||||
|
- ./package-lock.json:/terminal/package-lock.json
|
||||||
|
- ./terminal-server.js:/terminal/terminal-server.js
|
||||||
|
- ./storage:/var/www/html/storage
|
||||||
|
entrypoint: ["/bin/sh", "/soketi-entrypoint.sh"]
|
||||||
environment:
|
environment:
|
||||||
SOKETI_DEBUG: "false"
|
SOKETI_DEBUG: "false"
|
||||||
SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}"
|
SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}"
|
||||||
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}"
|
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}"
|
||||||
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}"
|
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}"
|
||||||
terminal:
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
pull_policy: always
|
|
||||||
working_dir: /var/www/html
|
|
||||||
ports:
|
|
||||||
- "${FORWARD_TERMINAL_PORT:-6002}:6002"
|
|
||||||
volumes:
|
|
||||||
- .:/var/www/html:cached
|
|
||||||
command: sh -c "apk add --no-cache openssh-client && node --watch /var/www/html/terminal-server.js"
|
|
||||||
vite:
|
vite:
|
||||||
image: node:alpine
|
image: node:alpine
|
||||||
pull_policy: always
|
pull_policy: always
|
||||||
@@ -72,7 +70,7 @@ services:
|
|||||||
- "${VITE_PORT:-5173}:${VITE_PORT:-5173}"
|
- "${VITE_PORT:-5173}:${VITE_PORT:-5173}"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www/html:cached
|
- .:/var/www/html:cached
|
||||||
command: sh -c "apk add --no-cache make g++ python3 && npm install && npm run dev"
|
command: sh -c "npm install && npm run dev"
|
||||||
networks:
|
networks:
|
||||||
- coolify
|
- coolify
|
||||||
testing-host:
|
testing-host:
|
||||||
|
@@ -115,25 +115,21 @@ services:
|
|||||||
soketi:
|
soketi:
|
||||||
ports:
|
ports:
|
||||||
- "${SOKETI_PORT:-6001}:6001"
|
- "${SOKETI_PORT:-6001}:6001"
|
||||||
|
- "6002:6002"
|
||||||
|
volumes:
|
||||||
|
- ./docker/soketi-entrypoint/soketi-entrypoint.sh:/soketi-entrypoint.sh
|
||||||
|
- ./package.json:/terminal/package.json
|
||||||
|
- ./package-lock.json:/terminal/package-lock.json
|
||||||
|
- ./terminal-server.js:/terminal/terminal-server.js
|
||||||
|
- ./storage:/var/www/html/storage
|
||||||
|
entrypoint: ["/bin/sh", "/soketi-entrypoint.sh"]
|
||||||
environment:
|
environment:
|
||||||
SOKETI_DEBUG: "${SOKETI_DEBUG:-false}"
|
SOKETI_DEBUG: "${SOKETI_DEBUG:-false}"
|
||||||
SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}"
|
SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}"
|
||||||
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}"
|
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}"
|
||||||
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}"
|
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: wget -qO- http://127.0.0.1:6001/ready || exit 1
|
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:6001/ready && wget -qO- http://127.0.0.1:6002/ready || exit 1"]
|
||||||
interval: 5s
|
|
||||||
retries: 10
|
|
||||||
timeout: 2s
|
|
||||||
terminal:
|
|
||||||
working_dir: /var/www/html
|
|
||||||
ports:
|
|
||||||
- "${TERMINAL_PORT:-6002}:6002"
|
|
||||||
volumes:
|
|
||||||
- .:/var/www/html:cached
|
|
||||||
command: sh -c "apk add --no-cache openssh-client && node /var/www/html/terminal-server.js"
|
|
||||||
healthcheck:
|
|
||||||
test: wget -qO- http://localhost:6002/ready || exit 1
|
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
|
@@ -102,7 +102,7 @@ services:
|
|||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
soketi:
|
soketi:
|
||||||
image: 'quay.io/soketi/soketi:1.6-16-alpine'
|
image: 'quay.io/soketi/soketi:1.6-16-alpine'
|
||||||
pull_policy: always
|
pull_policy: always
|
||||||
container_name: coolify-realtime
|
container_name: coolify-realtime
|
||||||
@@ -111,34 +111,25 @@ services:
|
|||||||
- .env
|
- .env
|
||||||
ports:
|
ports:
|
||||||
- "${SOKETI_PORT:-6001}:6001"
|
- "${SOKETI_PORT:-6001}:6001"
|
||||||
|
- "6002:6002"
|
||||||
|
volumes:
|
||||||
|
- ./docker/soketi-entrypoint/soketi-entrypoint.sh:/soketi-entrypoint.sh
|
||||||
|
- ./package.json:/terminal/package.json
|
||||||
|
- ./package-lock.json:/terminal/package-lock.json
|
||||||
|
- ./terminal-server.js:/terminal/terminal-server.js
|
||||||
|
- ./storage:/var/www/html/storage
|
||||||
|
entrypoint: ["/bin/sh", "/soketi-entrypoint.sh"]
|
||||||
environment:
|
environment:
|
||||||
SOKETI_DEBUG: "${SOKETI_DEBUG:-false}"
|
SOKETI_DEBUG: "${SOKETI_DEBUG:-false}"
|
||||||
SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}"
|
SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}"
|
||||||
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}"
|
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}"
|
||||||
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}"
|
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: wget -qO- http://localhost:6001/ready || exit 1
|
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:6001/ready && wget -qO- http://127.0.0.1:6002/ready || exit 1"]
|
||||||
interval: 5s
|
|
||||||
retries: 10
|
|
||||||
timeout: 2s
|
|
||||||
terminal:
|
|
||||||
image: node:alpine
|
|
||||||
pull_policy: always
|
|
||||||
container_name: coolify-terminal
|
|
||||||
restart: always
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
working_dir: /var/www/html
|
|
||||||
ports:
|
|
||||||
- "${TERMINAL_PORT:-6002}:6002"
|
|
||||||
volumes:
|
|
||||||
- .:/var/www/html:cached
|
|
||||||
command: sh -c "apk add --no-cache openssh-client && node /var/www/html/terminal-server.js"
|
|
||||||
healthcheck:
|
|
||||||
test: wget -qO- http://localhost:6002/ready || exit 1
|
|
||||||
interval: 5s
|
interval: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
timeout: 2s
|
timeout: 2s
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
coolify-db:
|
coolify-db:
|
||||||
name: coolify-db
|
name: coolify-db
|
||||||
|
@@ -28,12 +28,6 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- coolify
|
- coolify
|
||||||
terminal:
|
|
||||||
image: node:alpine
|
|
||||||
container_name: coolify-terminal
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
- coolify
|
|
||||||
networks:
|
networks:
|
||||||
coolify:
|
coolify:
|
||||||
name: coolify
|
name: coolify
|
||||||
|
39
docker/soketi-entrypoint/soketi-entrypoint.sh
Normal file
39
docker/soketi-entrypoint/soketi-entrypoint.sh
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Install openssh-client
|
||||||
|
apk add --no-cache openssh-client make g++ python3
|
||||||
|
|
||||||
|
cd /terminal
|
||||||
|
|
||||||
|
# Install npm dependencies
|
||||||
|
npm ci
|
||||||
|
|
||||||
|
# Rebuild node-pty
|
||||||
|
npm rebuild node-pty --update-binary
|
||||||
|
|
||||||
|
# Function to timestamp logs
|
||||||
|
timestamp() {
|
||||||
|
date "+%Y-%m-%d %H:%M:%S"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start the terminal server in the background with logging
|
||||||
|
node --watch /terminal/terminal-server.js > >(while read line; do echo "$(timestamp) [TERMINAL] $line"; done) 2>&1 &
|
||||||
|
TERMINAL_PID=$!
|
||||||
|
|
||||||
|
# Start the Soketi process in the background with logging
|
||||||
|
node /app/bin/server.js start > >(while read line; do echo "$(timestamp) [SOKETI] $line"; done) 2>&1 &
|
||||||
|
SOKETI_PID=$!
|
||||||
|
|
||||||
|
# Function to forward signals to child processes
|
||||||
|
forward_signal() {
|
||||||
|
kill -$1 $TERMINAL_PID $SOKETI_PID
|
||||||
|
}
|
||||||
|
|
||||||
|
# Forward SIGTERM to child processes
|
||||||
|
trap 'forward_signal TERM' TERM
|
||||||
|
|
||||||
|
# Wait for any process to exit
|
||||||
|
wait -n
|
||||||
|
|
||||||
|
# Exit with status of process that exited first
|
||||||
|
exit $?
|
Reference in New Issue
Block a user