Skip to content

Commit f9fdb6a

Browse files
committed
add vagrantfile and required scripts/configs
1 parent 265b697 commit f9fdb6a

File tree

6 files changed

+211
-0
lines changed

6 files changed

+211
-0
lines changed

.dev/vagrant/.env.vagrant

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
APP_ENV=develop
2+
APP_DEBUG=true
3+
APP_KEY=SomeRandomString3232RandomString
4+
APP_THEME=pterodactyl
5+
APP_TIMEZONE=UTC
6+
APP_CLEAR_TASKLOG=720
7+
APP_DELETE_MINUTES=10
8+
APP_URL=http://192.168.50.2/
9+
10+
DB_HOST=localhost
11+
DB_PORT=3306
12+
DB_DATABASE=panel
13+
DB_USERNAME=pterodactyl
14+
DB_PASSWORD=pterodactyl
15+
16+
CACHE_DRIVER=memcached
17+
MEMCACHED_HOST=127.0.0.1
18+
SESSION_DRIVER=database
19+
20+
MAIL_DRIVER=smtp
21+
MAIL_HOST=127.0.0.1
22+
MAIL_PORT=1025
23+
MAIL_USERNAME=
24+
MAIL_PASSWORD=
25+
MAIL_ENCRYPTION=
26+
MAIL_FROM=support@pterodactyl.io
27+
28+
API_PREFIX=api
29+
API_VERSION=v1
30+
API_DEBUG=true
31+
32+
QUEUE_DRIVER=database
33+
QUEUE_HIGH=high
34+
QUEUE_STANDARD=standard
35+
QUEUE_LOW=low
36+
37+
SQS_KEY=aws-public
38+
SQS_SECRET=aws-secret
39+
SQS_QUEUE_PREFIX=aws-queue-prefix

.dev/vagrant/mailhog.service

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Mailhog
3+
4+
[Service]
5+
# On some systems the user and group might be different.
6+
# Some systems use `apache` as the user and group.
7+
User=www-data
8+
Group=www-data
9+
Restart=on-failure
10+
ExecStart=/usr/bin/mailhog
11+
12+
[Install]
13+
WantedBy=multi-user.target

.dev/vagrant/provision.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
3+
echo "Provisioning development environment for Pterodactyl Panel."
4+
5+
apt-get install -y software-properties-common > /dev/null
6+
7+
echo "Add the ondrej/php ppa repository"
8+
add-apt-repository -y ppa:ondrej/php > /dev/null
9+
echo "Add the mariadb repository"
10+
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash > /dev/null
11+
12+
apt-get update > /dev/null
13+
14+
echo "Install the dependencies"
15+
export DEBIAN_FRONTEND=noninteractive
16+
# set the mariadb root password because mariadb asks for it
17+
debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password password pterodactyl'
18+
debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password_again password pterodactyl'
19+
# actually install
20+
apt-get install -y php7.1 php7.1-cli php7.1-gd php7.1-mysql php7.1-pdo php7.1-mbstring php7.1-tokenizer php7.1-bcmath php7.1-xml php7.1-fpm php7.1-memcached php7.1-curl php7.1-zip mariadb-server nginx curl tar unzip git memcached > /dev/null
21+
22+
echo "Install composer"
23+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
24+
25+
echo "Install and run mailhog"
26+
curl -sL -o /usr/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
27+
chmod +x /usr/bin/mailhog
28+
cp /var/www/html/pterodactyl/.dev/vagrant/mailhog.service /etc/systemd/system/
29+
systemctl enable mailhog.service
30+
systemctl start mailhog
31+
32+
echo "Configure nginx"
33+
cp /var/www/html/pterodactyl/.dev/vagrant/pterodactyl.conf /etc/nginx/sites-available/
34+
rm /etc/nginx/sites-available/default
35+
ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf
36+
service nginx restart
37+
38+
echo "Setup database"
39+
mysql -u root -ppterodactyl << SQL
40+
CREATE USER 'pterodactyl'@'localhost' IDENTIFIED BY 'pterodactyl';
41+
CREATE DATABASE panel;
42+
GRANT ALL PRIVILEGES ON panel.* TO 'pterodactyl'@'localhost';
43+
FLUSH PRIVILEGES;
44+
SQL
45+
46+
echo "Setup pterodactyl queue worker service"
47+
cp /var/www/html/pterodactyl/.dev/vagrant/pteroq.service /etc/systemd/system/
48+
systemctl enable pteroq.service
49+
50+
51+
echo "Setup panel with base settings"
52+
cp /var/www/html/pterodactyl/.dev/vagrant/.env.vagrant /var/www/html/pterodactyl/.env
53+
cd /var/www/html/pterodactyl
54+
chmod -R 755 storage/* bootstrap/cache
55+
composer install --no-progress
56+
php artisan key:generate --force
57+
php artisan migrate
58+
php artisan db:seed
59+
php artisan pterodactyl:user --firstname Test --lastname Admin --username admin --email testadmin@pterodactyl.io --password Ptero123 --admin 1
60+
php artisan pterodactyl:user --firstname Test --lastname User --username user --email testuser@pterodactyl.io --password Ptero123 --admin 0
61+
62+
echo "Add queue cronjob and start queue worker"
63+
(crontab -l 2>/dev/null; echo "* * * * * php /var/www/html/pterodactyl/artisan schedule:run >> /dev/null 2>&1") | crontab -
64+
systemctl start pteroq
65+
66+
echo " ----------------"
67+
echo "Provisioning is completed."
68+
echo "The panel should be available at http://localhost:50080/"
69+
echo "You may use the default admin user to login: admin/Ptero123"
70+
echo "A normal user has also been created: user/Ptero123"
71+
echo "MailHog is available at http://localhost:58025/"

.dev/vagrant/pterodactyl.conf

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# If using Ubuntu this file should be placed in:
2+
# /etc/nginx/sites-available/
3+
#
4+
# If using CentOS this file should be placed in:
5+
# /etc/nginx/conf.d/
6+
#
7+
server {
8+
listen 80;
9+
server_name 0.0.0.0;
10+
11+
root /var/www/html/pterodactyl/public;
12+
index index.html index.htm index.php;
13+
charset utf-8;
14+
15+
location / {
16+
try_files $uri $uri/ /index.php?$query_string;
17+
}
18+
19+
location = /favicon.ico { access_log off; log_not_found off; }
20+
location = /robots.txt { access_log off; log_not_found off; }
21+
22+
access_log off;
23+
error_log /var/log/nginx/pterodactyl.app-error.log error;
24+
25+
# allow larger file uploads and longer script runtimes
26+
client_max_body_size 100m;
27+
client_body_timeout 120s;
28+
29+
sendfile off;
30+
31+
location ~ \.php$ {
32+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
33+
# the fastcgi_pass path needs to be changed accordingly when using CentOS
34+
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
35+
fastcgi_index index.php;
36+
include fastcgi_params;
37+
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
38+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
39+
fastcgi_param HTTP_PROXY "";
40+
fastcgi_intercept_errors off;
41+
fastcgi_buffer_size 16k;
42+
fastcgi_buffers 4 16k;
43+
fastcgi_connect_timeout 300;
44+
fastcgi_send_timeout 300;
45+
fastcgi_read_timeout 300;
46+
}
47+
48+
location ~ /\.ht {
49+
deny all;
50+
}
51+
}

.dev/vagrant/pteroq.service

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Pterodactyl Queue Worker File
2+
# ----------------------------------
3+
# File should be placed in:
4+
# /etc/systemd/system
5+
#
6+
# nano /etc/systemd/system/pteroq.service
7+
8+
[Unit]
9+
Description=Pterodactyl Queue Worker
10+
11+
[Service]
12+
# On some systems the user and group might be different.
13+
# Some systems use `apache` as the user and group.
14+
User=www-data
15+
Group=www-data
16+
Restart=on-failure
17+
ExecStart=/usr/bin/php /var/www/html/pterodactyl/artisan queue:work database --queue=high,standard,low --sleep=3 --tries=3
18+
19+
[Install]
20+
WantedBy=multi-user.target

Vagrantfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Vagrant.configure("2") do |config|
2+
config.vm.box = "ubuntu/xenial64"
3+
4+
config.vm.synced_folder "./", "/var/www/html/pterodactyl",
5+
owner: "www-data", group: "www-data"
6+
7+
#config.vm.provision :file, source: ".dev/vagrant/pterdactyl.conf", destination: "/etc/nginx/sites-available/pterodactyl.conf"
8+
#config.vm.provision :file, source: ".dev/vagrant/pteroq.service", destination: "/etc/systemd/system/pteroq.service"
9+
#config.vm.provision :file, source: ".dev/vagrant/mailhog.service", destination: "/etc/systemd/system/mailhog.service"
10+
#config.vm.provision :file, source: ".dev/vagrant/.env", destination: "/var/www/html/pterodactyl/.env"
11+
config.vm.provision :shell, path: ".dev/vagrant/provision.sh"
12+
13+
config.vm.network :private_network, ip: "192.168.50.2"
14+
config.vm.network :forwarded_port, guest: 80, host: 50080
15+
config.vm.network :forwarded_port, guest: 8025, host: 58025
16+
17+
end

0 commit comments

Comments
 (0)