Add Docs feature set and configure Nginx proxy for /docs endpoint

This commit is contained in:
Simon Larsen 2024-03-18 13:12:39 +00:00
parent a20be2441e
commit 1dbfea9051
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
3 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,54 @@
#!/bin/bash
# Check if this is debian based
# Check if system supports apt-get
if [ -x "$(command -v apt-get)" ]; then
# Update apt-get
sudo apt-get update
# Install build-essential
sudo apt-get install build-essential -y
fi
# Check if system supports yum
if [ -x "$(command -v yum)" ]; then
# Update yum
sudo yum update
# Install build-essential
sudo yum install gcc-c++ make -y
fi
# Check if system supports apk
if [ -x "$(command -v apk)" ]; then
# Update apk
sudo apk update
# Install build-essential
sudo apk add build-base
fi
# Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# Export to path
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Refresh bash
source ~/.bashrc
# Install latest Node.js via NVM
nvm install node
# Make this nodejs version the default
nvm alias default node
# Use the default version
nvm use default
# Now install
npm install -g ts-node
npm install -g @oneuptime/infrastructure-agent

View File

@ -12,6 +12,7 @@ import Realtime from 'CommonServer/Utils/Realtime';
// import featuresets.
import './FeatureSet/Identity/Index';
import './FeatureSet/Notification/Index';
import './FeatureSet/Docs/Index';
import './FeatureSet/BaseAPI/Index';
import './FeatureSet/ApiReference/Index';
import Workers from './FeatureSet/Workers/Index';

View File

@ -535,6 +535,19 @@ server {
proxy_pass http://app/reference;
}
location /docs {
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;
# enable WebSockets (for ws://sockjs not connected error in the accounts source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://app/docs;
}
location /file {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;