mirror of
https://github.com/pterodactyl/development.git
synced 2025-12-11 04:38:32 -06:00
Add support for running documentation server
This commit is contained in:
parent
5b359aa471
commit
93ea4a24bb
25
Vagrantfile
vendored
25
Vagrantfile
vendored
@ -59,6 +59,31 @@ Vagrant.configure("2") do |config|
|
||||
SHELL
|
||||
end
|
||||
|
||||
config.vm.define "docs" do |docs|
|
||||
docs.vm.hostname = "documentation"
|
||||
docs.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
|
||||
docs.hostmanager.aliases = %w(pterodocs.local)
|
||||
docs.vm.network "forwarded_port", guest: 80, host: 8088
|
||||
|
||||
docs.ssh.insert_key = true
|
||||
docs.ssh.username = "root"
|
||||
docs.ssh.password = "vagrant"
|
||||
|
||||
docs.vm.provider "docker" do |d|
|
||||
d.image = "quay.io/pterodactyl/vagrant-core"
|
||||
d.create_args = ["-it", "--add-host=host.pterodactyl.local:172.17.0.1"]
|
||||
d.ports = ["8088:80"]
|
||||
d.volumes = ["#{vagrant_root}/code/documentation:/srv/documentation:cached"]
|
||||
d.remains_running = true
|
||||
d.has_ssh = true
|
||||
end
|
||||
|
||||
docs.vm.provision "deploy_files", type: "file", source: "#{vagrant_root}/build/configs", destination: "/tmp/.deploy"
|
||||
docs.vm.provision "setup_documentation", type: "shell", path: "#{vagrant_root}/scripts/deploy_docs.sh"
|
||||
end
|
||||
|
||||
|
||||
# Configure a mysql docker container.
|
||||
config.vm.define "mysql" do |mysql|
|
||||
mysql.vm.hostname = "mysql"
|
||||
|
||||
23
build/configs/nginx/pterodocs.local.conf
Normal file
23
build/configs/nginx/pterodocs.local.conf
Normal file
@ -0,0 +1,23 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
index index.html;
|
||||
server_name pterodocs.local;
|
||||
root /srv/documentation/.vuepress/dist;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
}
|
||||
|
||||
# security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "same-origin" always;
|
||||
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||
|
||||
# . files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
7
build/configs/supervisor/pterodocs.conf
Normal file
7
build/configs/supervisor/pterodocs.conf
Normal file
@ -0,0 +1,7 @@
|
||||
[program:nginx]
|
||||
command=/usr/sbin/nginx -g 'daemon off;'
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=10
|
||||
stdout_events_enabled=true
|
||||
stderr_events_enabled=true
|
||||
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
cp /tmp/.deploy/pterodactyl.conf /etc/supervisor/conf.d/pterodactyl.conf
|
||||
cp /tmp/.deploy/pterodactyl.local.conf /etc/nginx/sites-available/pterodactyl.local.conf
|
||||
cp /tmp/.deploy/supervisor/pterodactyl.conf /etc/supervisor/conf.d/pterodactyl.conf
|
||||
cp /tmp/.deploy/nginx/pterodactyl.local.conf /etc/nginx/sites-available/pterodactyl.local.conf
|
||||
|
||||
# Needed for FPM to start correctly.
|
||||
mkdir -p /run/php
|
||||
|
||||
26
scripts/deploy_docs.sh
Normal file
26
scripts/deploy_docs.sh
Normal file
@ -0,0 +1,26 @@
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
|
||||
|
||||
# Install dependencies and start supervisor
|
||||
apt install -y --no-install-recommends nodejs yarn supervisor
|
||||
/usr/bin/supervisord
|
||||
|
||||
# Copy over deployment specific files.
|
||||
cp /tmp/.deploy/supervisor/pterodocs.conf /etc/supervisor/conf.d/pterodocs.conf
|
||||
cp /tmp/.deploy/nginx/pterodocs.local.conf /etc/nginx/sites-available/pterodocs.local.conf
|
||||
|
||||
cd /srv/documentation
|
||||
yarn add vuepress
|
||||
|
||||
rm -f ~/docs
|
||||
ln -s /srv/documentation ~/docs
|
||||
|
||||
# Configure and restart nginx
|
||||
rm -rfv /var/www
|
||||
rm -rv /etc/nginx/sites-enabled/*
|
||||
ln -s /etc/nginx/sites-available/pterodocs.local.conf /etc/nginx/sites-enabled/pterodocs.local.conf
|
||||
|
||||
supervisorctl reread
|
||||
supervisorctl update
|
||||
supervisorctl restart nginx
|
||||
Loading…
x
Reference in New Issue
Block a user