Update maxun-install.sh
This commit is contained in:
parent
f731b57f35
commit
b50d019d96
@ -34,7 +34,13 @@ $STD apt-get install -y \
|
||||
libxext6 \
|
||||
libxi6 \
|
||||
libxtst6 \
|
||||
netcat
|
||||
netcat \
|
||||
ca-certificates \
|
||||
libxrandr2 \
|
||||
libasound2 \
|
||||
libxss1 \
|
||||
libxinerama1 \
|
||||
nginx
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
#configure_lxc "Semantic Search requires a dedicated GPU and at least 16GB RAM. Would you like to install it?" 100 "memory" "16000"
|
||||
@ -167,6 +173,49 @@ cd /opt/maxun
|
||||
node -e "require('./server/src/db/migrate')().then(() => { console.log('Migrations completed'); })"
|
||||
msg_ok "DB Migrations completed"
|
||||
|
||||
msg_info "Setting up nginx with CORS Proxy"
|
||||
|
||||
$STD apt-get install -y nginx
|
||||
|
||||
cat <<'EOF' >/etc/nginx/sites-available/maxun
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~ ^/(api|record|workflow|storage|auth|integration|proxy|api-docs) {
|
||||
proxy_pass http://localhost:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_http_version 1.1;
|
||||
|
||||
add_header Access-Control-Allow-Origin "$http_origin" always;
|
||||
add_header Access-Control-Allow-Credentials true always;
|
||||
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS always;
|
||||
add_header Access-Control-Allow-Headers Authorization,Content-Type,X-Requested-With always;
|
||||
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 503 504 /50x.html;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
ln -sf /etc/nginx/sites-available/maxun /etc/nginx/sites-enabled/maxun
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
msg_ok "nginx with CORS Proxy set up"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/maxun.service
|
||||
[Unit]
|
||||
@ -175,7 +224,7 @@ After=network.target postgresql.service redis.service minio.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/maxun
|
||||
ExecStart=/usr/bin/npm run server
|
||||
ExecStart=/usr/bin/npm run start:server -- --host 0.0.0.0
|
||||
Restart=always
|
||||
EnvironmentFile=/opt/maxun/.env
|
||||
|
||||
@ -183,6 +232,7 @@ EnvironmentFile=/opt/maxun/.env
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now maxun
|
||||
systemctl enable -q --now nginx
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
|
Loading…
x
Reference in New Issue
Block a user