mirror of
https://github.com/pterodactyl/development.git
synced 2025-12-11 04:38:32 -06:00
Get pterodactyl running through vagrant & docker
This commit is contained in:
parent
f7b34dfe6d
commit
d5c63f6d29
2
README
2
README
@ -8,7 +8,7 @@ You'll need the following things installed on your machine.
|
||||
* VirtualBox
|
||||
* Docker
|
||||
|
||||
You'll also need the following Vagrant plugins: `vagrant-hostmanager`, `vagrant-notify-forwarder`, and `vagrant-vbguest`
|
||||
You'll also need the following Vagrant plugins: `vagrant-hostmanager` and `vagrant-vbguest`
|
||||
|
||||
### First Run
|
||||
These commands should be run if this will be your first time running Pterodactyl and you _do not already_ have a `.env` file configured.
|
||||
|
||||
45
Vagrantfile
vendored
45
Vagrantfile
vendored
@ -1,9 +1,11 @@
|
||||
["vagrant-notify-forwarder", "vagrant-vbguest", "vagrant-hostmanager"].each do |plugin|
|
||||
["vagrant-vbguest", "vagrant-hostmanager"].each do |plugin|
|
||||
unless Vagrant.has_plugin?(plugin)
|
||||
raise plugin + " plugin is not installed. Hint: vagrant plugin install " + plugin
|
||||
end
|
||||
end
|
||||
|
||||
vagrant_root = File.dirname(__FILE__)
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.hostmanager.enabled = true
|
||||
config.hostmanager.manage_host = true
|
||||
@ -11,30 +13,31 @@ Vagrant.configure("2") do |config|
|
||||
config.hostmanager.ignore_private_ip = false
|
||||
config.hostmanager.include_offline = true
|
||||
|
||||
# config.vm.network "private_network", ip: "192.168.10.1", virtualbox__intnet: true
|
||||
|
||||
config.vm.define "app", primary: true do |app|
|
||||
app.vm.hostname = "app"
|
||||
app.vm.box = "bento/ubuntu-16.04"
|
||||
app.vm.box_check_update = true
|
||||
|
||||
app.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
app.vm.synced_folder "code/panel", "/srv/www", type: "nfs",
|
||||
mount_options: ["rw", "vers=3", "tcp", "fsc"]
|
||||
|
||||
app.vm.network "forwarded_port", guest: 80, host: 80
|
||||
app.vm.network :private_network, ip: "192.168.10.10"
|
||||
app.hostmanager.aliases = %w(pterodactyl.local)
|
||||
|
||||
app.vm.provider :virtualbox do |vb|
|
||||
vb.gui = false
|
||||
vb.memory = 1024
|
||||
vb.cpus = 2
|
||||
app.vm.network "forwarded_port", guest: 80, host: 80
|
||||
app.vm.network "forwarded_port", guest: 8080, host: 8080
|
||||
|
||||
vb.customize ["storagectl", :id, "--name", "SATA Controller", "--hostiocache", "on"]
|
||||
vb.customize ["modifyvm", :id, "--ioapic", "on"]
|
||||
app.ssh.insert_key = true
|
||||
app.ssh.username = "root"
|
||||
app.ssh.password = "vagrant"
|
||||
|
||||
app.vm.provider "docker" do |d|
|
||||
d.image = "quay.io/pterodactyl/vagrant-panel"
|
||||
d.create_args = ["-it"]
|
||||
d.volumes = ["#{vagrant_root}/code/panel:/srv/www:cached"]
|
||||
# d.ports = ["80:80", "8080:8080"]
|
||||
d.remains_running = true
|
||||
d.has_ssh = true
|
||||
end
|
||||
|
||||
app.vm.provision :file, source: "build/configs", destination: "/tmp/.deploy"
|
||||
|
||||
app.vm.provision :shell, run: "once", inline: <<-SHELL
|
||||
cat >> /etc/hosts <<EOF
|
||||
|
||||
@ -47,15 +50,6 @@ cat >> /etc/hosts <<EOF
|
||||
EOF
|
||||
SHELL
|
||||
|
||||
app.vm.provision "file", source: "scripts/configs/pteroq.service", destination: "/tmp/.deploy/pteroq.service"
|
||||
app.vm.provision "file", source: "scripts/configs/pterodactyl.local.conf", destination: "/tmp/.deploy/pterodactyl.local.conf"
|
||||
|
||||
app.vm.provision :shell, inline: <<-SHELL
|
||||
mv /tmp/.deploy/pteroq.service /etc/systemd/system/pteroq.service
|
||||
mv /tmp/.deploy/pterodactyl.local.conf /etc/nginx/sites-available/pterodactyl.local.conf
|
||||
rm -r /tmp/.deploy
|
||||
SHELL
|
||||
|
||||
app.vm.provision :shell, path: "scripts/deploy_app.sh"
|
||||
|
||||
app.vm.provision "setup", type: "shell", run: "never", inline: <<-SHELL
|
||||
@ -79,7 +73,6 @@ EOF
|
||||
mysql.vm.synced_folder ".data/mysql", "/var/lib/mysql", create: true
|
||||
|
||||
mysql.vm.network "forwarded_port", guest: 3306, host: 3306
|
||||
mysql.vm.network :private_network, ip: "192.168.10.11"
|
||||
mysql.hostmanager.aliases = %w(mysql.pterodactyl.local)
|
||||
|
||||
mysql.vm.provider "docker" do |d|
|
||||
@ -111,7 +104,6 @@ EOF
|
||||
|
||||
mh.vm.network "forwarded_port", guest: 1025, host: 1025
|
||||
mh.vm.network "forwarded_port", guest: 8025, host: 8025
|
||||
mh.vm.network :private_network, ip: "192.168.10.12"
|
||||
mh.hostmanager.aliases = %w(mailhog.pterodactyl.local)
|
||||
|
||||
mh.vm.provider "docker" do |d|
|
||||
@ -127,7 +119,6 @@ EOF
|
||||
redis.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
|
||||
redis.vm.network "forwarded_port", guest: 6379, host: 6379
|
||||
redis.vm.network :private_network, ip: "192.168.10.13"
|
||||
redis.hostmanager.aliases = %w(redis.pterodactyl.local)
|
||||
|
||||
redis.vm.provision :hostmanager
|
||||
|
||||
25
build/configs/pterodactyl.conf
Normal file
25
build/configs/pterodactyl.conf
Normal file
@ -0,0 +1,25 @@
|
||||
[program:pteroq]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=/usr/bin/php /srv/www/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=www-data
|
||||
numprocs=2
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/srv/www/storage/logs/supervisor-worker.log
|
||||
|
||||
[program:php-fpm]
|
||||
command=/usr/sbin/php-fpm7.2 -F
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=5
|
||||
stdout_events_enabled=true
|
||||
stderr_events_enabled=true
|
||||
|
||||
[program:nginx]
|
||||
command=/usr/sbin/nginx -g 'daemon off;'
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=10
|
||||
stdout_events_enabled=true
|
||||
stderr_events_enabled=true
|
||||
@ -1,11 +0,0 @@
|
||||
[Unit]
|
||||
Description=Pterodactyl Queue Worker
|
||||
|
||||
[Service]
|
||||
User=www-data
|
||||
Group=www-data
|
||||
Restart=always
|
||||
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -1,39 +1,11 @@
|
||||
#!/bin/bash
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Install the dependencies for core software.
|
||||
add-apt-repository -y ppa:ondrej/php
|
||||
apt -y update && apt -y upgrade
|
||||
apt -y install software-properties-common \
|
||||
php7.2 \
|
||||
php7.2-cli \
|
||||
php7.2-gd \
|
||||
php7.2-mysql \
|
||||
php7.2-pdo \
|
||||
php7.2-mbstring \
|
||||
php7.2-tokenizer \
|
||||
php7.2-bcmath \
|
||||
php7.2-xml \
|
||||
php7.2-fpm \
|
||||
php7.2-curl \
|
||||
php7.2-zip \
|
||||
php7.2-xdebug \
|
||||
nginx \
|
||||
curl \
|
||||
tar \
|
||||
unzip \
|
||||
git \
|
||||
cachefilesd
|
||||
cp /tmp/.deploy/pterodactyl.conf /etc/supervisor/conf.d/pterodactyl.conf
|
||||
cp /tmp/.deploy/pterodactyl.local.conf /etc/nginx/sites-available/pterodactyl.local.conf
|
||||
|
||||
sudo echo "RUN=yes" > /etc/default/cachefilesd
|
||||
|
||||
# Install yarn and NodeJS for development purposes.
|
||||
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
|
||||
curl -sL 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
|
||||
apt -y update && apt -y install nodejs yarn
|
||||
|
||||
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
|
||||
# Needed for FPM to start correctly.
|
||||
mkdir -p /run/php
|
||||
|
||||
cd /srv/www
|
||||
chmod -R 755 storage/* bootstrap/cache
|
||||
@ -55,13 +27,9 @@ php artisan config:clear
|
||||
# Configure the cronjob
|
||||
(crontab -l 2>/dev/null; echo "* * * * * php /srv/www/artisan schedule:run >> /dev/null 2>&1") | crontab -
|
||||
|
||||
# Configure the process worker
|
||||
systemctl enable pteroq.service
|
||||
systemctl start pteroq
|
||||
|
||||
# Create symlink
|
||||
rm -f /home/vagrant/app
|
||||
ln -s /srv/www /home/vagrant/app
|
||||
rm -f /root/app
|
||||
ln -s /srv/www /root/app
|
||||
|
||||
# Configure OPCache
|
||||
cat >> /etc/php/7.2/cli/conf.d/10-opcache.ini <<EOF
|
||||
@ -87,5 +55,9 @@ yarn install --no-progress
|
||||
rm -rfv /var/www
|
||||
rm -rv /etc/nginx/sites-enabled/*
|
||||
ln -s /etc/nginx/sites-available/pterodactyl.local.conf /etc/nginx/sites-enabled/pterodactyl.local.conf
|
||||
service php7.2-fpm restart
|
||||
service nginx restart
|
||||
|
||||
# Start processes
|
||||
supervisorctl reread
|
||||
supervisorctl update
|
||||
supervisorctl start pteroq:*
|
||||
supervisorctl restart nginx
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user