web dashboard in single container
This commit is contained in:
@ -8,6 +8,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
redis-server nginx \
|
||||
# Process supervisor
|
||||
supervisor \
|
||||
# Others
|
||||
net-tools \
|
||||
# Clean up
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@ -22,11 +24,12 @@ COPY cosmostat_settings.yaml /app/cosmostat_settings.yaml
|
||||
# Node on 3000
|
||||
WORKDIR /usr/src/app
|
||||
COPY web/node_server/ .
|
||||
#COPY cosmostat_settings.yaml /usr/src/app/cosmostat_settings.yaml
|
||||
RUN npm install --only=production
|
||||
|
||||
# Apache on 8080
|
||||
RUN sed -i 's/^Listen .*/Listen 8080/' /etc/apache2/ports.conf && \
|
||||
sed -i 's/<VirtualHost \*:80>/<VirtualHost \*:8080>/' /etc/apache2/sites-enabled/000-default.conf
|
||||
COPY apache_ports.conf /etc/apache2/ports.conf
|
||||
COPY apache_vhost.conf /etc/apache2/sites-available/000-default.conf
|
||||
COPY web/html/ /var/www/html/
|
||||
|
||||
# nginx on 80
|
||||
|
||||
5
files/docker/apache_ports.conf
Normal file
5
files/docker/apache_ports.conf
Normal file
@ -0,0 +1,5 @@
|
||||
# Listen on 8080 inside the container
|
||||
Listen 8080
|
||||
|
||||
# If you still want Apache to listen on 80 (rare), add it back:
|
||||
# Listen 80
|
||||
14
files/docker/apache_vhost.conf
Normal file
14
files/docker/apache_vhost.conf
Normal file
@ -0,0 +1,14 @@
|
||||
<VirtualHost *:8080>
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html
|
||||
|
||||
# Log files
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
# If you need PHP processing
|
||||
<Directory /var/www/html>
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
@ -38,7 +38,8 @@ priority=3
|
||||
# ------------------------------------------------------------------
|
||||
# NOTE: Adjust the command/path to match your app
|
||||
[program:node]
|
||||
command=npm start
|
||||
command=sh -c "npm install && node server.js"
|
||||
#command=npm start
|
||||
directory=/usr/src/app
|
||||
stdout_logfile=/dev/stdout
|
||||
stderr_logfile=/dev/stderr
|
||||
|
||||
@ -17,7 +17,8 @@ const io = new Server(server);
|
||||
/* --------------------------------------------------------------------- */
|
||||
let config = {};
|
||||
try {
|
||||
const file = fs.readFileSync(path.resolve(__dirname, 'cosmostat_settings.yaml'), 'utf8');
|
||||
const filePath = '/app/cosmostat_settings.yaml';
|
||||
const file = fs.readFileSync(filePath, 'utf8');
|
||||
config = yaml.load(file);
|
||||
} catch (e) {
|
||||
console.error('Failed to load config.yaml:', e);
|
||||
|
||||
@ -39,7 +39,7 @@ server_name localhost;
|
||||
# WebSocket endpoint
|
||||
# ---------------------------------------
|
||||
location /socket.io/ {
|
||||
proxy_pass http://192.168.37.1:3000/socket.io/;
|
||||
proxy_pass http://0.0.0.0:3000/socket.io/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
@ -53,7 +53,7 @@ server_name localhost;
|
||||
# All other paths → Apache (PHP)
|
||||
# ---------------------------------------
|
||||
location / {
|
||||
proxy_pass http://192.168.37.1:8080;
|
||||
proxy_pass http://0.0.0.0:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
Reference in New Issue
Block a user