mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-11 00:54:50 +00:00
Basic vagrant setup to allow local development in a virtual machine
This commit is contained in:
parent
75b7cebb14
commit
e3ab75e908
4 changed files with 141 additions and 1 deletions
15
README.md
15
README.md
|
@ -2,3 +2,18 @@
|
||||||
Federated Image Sharing
|
Federated Image Sharing
|
||||||
|
|
||||||
> This project is still in active development and not yet ready for use.
|
> This project is still in active development and not yet ready for use.
|
||||||
|
|
||||||
|
## Creating a local dev environment using Vagrant
|
||||||
|
|
||||||
|
Prerequisits :
|
||||||
|
- version of vagrant (vagrantup.com)
|
||||||
|
- version of virtualbox 5.x
|
||||||
|
- at least 2 GB of RAM to spare
|
||||||
|
|
||||||
|
Setup :
|
||||||
|
- download and install both vagrant and virtualbox
|
||||||
|
- run 'vagrant up' from the root of te repository
|
||||||
|
- after succesfull deployment, access pixelfed at
|
||||||
|
http://127.0.0.1:8080
|
||||||
|
|
||||||
|
|
||||||
|
|
66
Vagrantfile
vendored
Normal file
66
Vagrantfile
vendored
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
|
||||||
|
# Thank You StackOverflow!
|
||||||
|
# http://stackoverflow.com/questions/26811089/vagrant-how-to-have-host-platform-specific-provisional-step
|
||||||
|
module OS
|
||||||
|
def OS.windows?
|
||||||
|
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def OS.mac?
|
||||||
|
(/darwin/ =~ RUBY_PLATFORM) != nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def OS.unix?
|
||||||
|
!OS.windows?
|
||||||
|
end
|
||||||
|
|
||||||
|
def OS.linux?
|
||||||
|
OS.unix? and not OS.mac?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Vagrant.configure("2") do |config|
|
||||||
|
config.vm.box = "ubuntu/bionic64"
|
||||||
|
|
||||||
|
#if OS.unix?
|
||||||
|
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
|
||||||
|
#end
|
||||||
|
|
||||||
|
config.vm.define "pixelfed"
|
||||||
|
config.vm.hostname = "pixelfed.local"
|
||||||
|
|
||||||
|
|
||||||
|
config.vm.provision :shell do |shell|
|
||||||
|
shell.inline = "
|
||||||
|
apt-get update && apt-get -y upgrade && \
|
||||||
|
apt-get -y install php7.2-fpm php7.2-gd php7.2-mbstring php-imagick \
|
||||||
|
php7.2-mysql mysql-server-5.7 redis-server \
|
||||||
|
graphicsmagick php-json php-services-json jpegoptim nginx-full \
|
||||||
|
optipng pngquant gifsicle composer && \
|
||||||
|
cd /vagrant && \
|
||||||
|
su vagrant -c 'composer install' && cp .env.example .env && \
|
||||||
|
mysql -e 'create database homestead' && \
|
||||||
|
mysql -e \"grant all on homestead.* to 'homestead'@'localhost' identified by 'secret'\" && \
|
||||||
|
cp /vagrant/vagrant/fpm.conf /etc/php/7.2/fpm/pool.d/pixelfed.conf && \
|
||||||
|
systemctl restart php7.2-fpm && \
|
||||||
|
cp /vagrant/vagrant/nginx.conf /etc/nginx/sites-available/pixelfed.conf && \
|
||||||
|
rm /etc/nginx/sites-enabled/default && \
|
||||||
|
ln -s /etc/nginx/sites-available/pixelfed.conf /etc/nginx/sites-enabled/ && \
|
||||||
|
systemctl restart nginx && \
|
||||||
|
php artisan key:generate && php artisan storage:link && \
|
||||||
|
php artisan migrate && php artisan horizon && \
|
||||||
|
php artisan serve --host=localhost --port=80
|
||||||
|
"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.provider "virtualbox" do |v|
|
||||||
|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||||
|
v.customize ["modifyvm", :id, "--memory", "2048"]
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.network :forwarded_port, guest: 80, host: 8080
|
||||||
|
end
|
||||||
|
|
||||||
|
|
24
vagrant/fpm.conf
Normal file
24
vagrant/fpm.conf
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
[pixelfed]
|
||||||
|
listen = 127.0.1.1:9000
|
||||||
|
listen.backlog = -1
|
||||||
|
user = vagrant
|
||||||
|
group = vagrant
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 50
|
||||||
|
pm.start_servers = 5
|
||||||
|
pm.min_spare_servers = 5
|
||||||
|
pm.max_spare_servers = 35
|
||||||
|
pm.process_idle_timeout = 10s
|
||||||
|
pm.max_requests = 0
|
||||||
|
ping.response = pong
|
||||||
|
access.log = /var/log/fpm.log
|
||||||
|
access.format = "%R - %u %t \"%m %r\" %s"
|
||||||
|
request_terminate_timeout = 0
|
||||||
|
request_slowlog_timeout = 0
|
||||||
|
slowlog = /var/log/fpm-pixelfed-slow.log
|
||||||
|
chdir = /vagrant/public
|
||||||
|
catch_workers_output = yes
|
||||||
|
php_admin_value[post_max_size] = 25M
|
||||||
|
php_admin_value[short_open_tag] = On
|
||||||
|
php_admin_value[upload_max_filesize] = 25M
|
||||||
|
|
35
vagrant/nginx.conf
Normal file
35
vagrant/nginx.conf
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
server {
|
||||||
|
listen *:80;
|
||||||
|
listen [::]:80 ;
|
||||||
|
|
||||||
|
server_name pixelfed.local;
|
||||||
|
|
||||||
|
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/pixelfed.local-plain.access.log combined;
|
||||||
|
error_log /var/log/nginx/pixelfed.local-plain.error.log;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /vagrant/public;
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
try_files $uri $uri/ /index.php?q=$uri&$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
root /vagrant/public/;
|
||||||
|
include /etc/nginx/fastcgi.conf;
|
||||||
|
|
||||||
|
fastcgi_pass 127.0.1.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_buffer_size 32k;
|
||||||
|
fastcgi_buffers 16 16k;
|
||||||
|
fastcgi_connect_timeout 3m;
|
||||||
|
fastcgi_read_timeout 3m;
|
||||||
|
fastcgi_send_timeout 3m;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue