Updated to latest generic installation process

This commit is contained in:
2019-09-08 20:46:12 +02:00
parent 9d6e646c3e
commit e0a3c3d877

View File

@@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
toolName="pixelfed" toolName="pixelfed"
toolDeps="composer jpegoptim php7.2-bcmath" toolTag="v0.10.2"
toolDeps="composer jpegoptim php7.3-bcmath"
toolPath="/var/www/pixelfed" toolPath="/var/www/pixelfed"
step_1_info() { echo "Updating apt"; } step_1_info() { echo "Updating apt"; }
@@ -15,15 +16,17 @@ step_2() {
exe apt install $toolDeps -y exe apt install $toolDeps -y
saveReturn $? saveReturn $?
endReturn endReturn
exe service php7.2-fpm restart exe service php7.3-fpm restart
} }
step_3_info() { echo -e "Get $toolName using git"; } step_3_info() { echo -e "Get $toolName using git"; }
step_3() { step_3() {
#exe git clone https://github.com/dansup/pixelfed $toolPath exe git clone -b $toolTag https://github.com/pixelfed/pixelfed.git $toolPath
exe chown -R www-data: $toolPath
cd $toolPath cd $toolPath
exe composer install --no-dev exe chown -R www-data:www-data . # change user/group to http user and http group
exe find . -type d -exec chmod 755 {} \; # set all directories to rwx by user/group
exe find . -type f -exec chmod 644 {} \; # set all files to rw by user/group
exe composer install --no-ansi --no-interaction --optimize-autoloader
saveReturn $? saveReturn $?
endReturn endReturn
} }
@@ -68,22 +71,15 @@ step_5_info() { echo "$toolName configuration"; }
step_5() { step_5() {
cd $toolPath cd $toolPath
exe cp .env.example .env exe cp .env.example .env
exe php artisan key:generate read -p "Edit database settings, hostname, email settings, IMAGE_DRIVER=imagick, etc... (Enter to continue)"
exe php artisan storage:link
read -p "Edit database settings, hostname, etc... (Enter to continue)"
exe vi .env exe vi .env
echo exe php artisan key:generate
echo "Include following changes (all occurences) to fix mysql support:" exe php artisan config:cache
echo "return $this->addColumn('json', $column);" exe php artisan storage:link
echo "to" exe php artisan migrate --force
echo "return $this->addColumn('text', $column);" exe php artisan route:cache
read -p "Enter to open $blueprintHack"
exe vi $blueprintHack
exe php artisan migrate:fresh
} }
blueprintHack="${toolPath}/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php"
step_6_info() { echo "Create admin user"; } step_6_info() { echo "Create admin user"; }
step_6() { step_6() {
cd $toolPath cd $toolPath
@@ -94,6 +90,8 @@ step_6() {
step_7_info() { echo "Create pixelfed (horzion) service"; } step_7_info() { echo "Create pixelfed (horzion) service"; }
step_7() { step_7() {
addConf -c "${horizonService}" "${horizonServiceLoc}" addConf -c "${horizonService}" "${horizonServiceLoc}"
saveReturn $?
endReturn
exe systemctl daemon-reload exe systemctl daemon-reload
exe systemctl enable pixelfed.service exe systemctl enable pixelfed.service
exe service pixelfed start exe service pixelfed start
@@ -144,7 +142,7 @@ nginxConfigLoc="/etc/nginx/sites-available/pixelfed"
nginxConfigEnable="/etc/nginx/sites-enabled/pixelfed" nginxConfigEnable="/etc/nginx/sites-enabled/pixelfed"
nginxConfig="\ nginxConfig="\
upstream php-handler-pixel { upstream php-handler-pixel {
server unix:/var/run/php/php7.2-fpm.sock; server unix:/var/run/php/php7.3-fpm.sock;
} }
map \$http_x_forwarded_proto \$proxy_https { map \$http_x_forwarded_proto \$proxy_https {
@@ -160,20 +158,23 @@ add_header X-Frame-Options \"SAMEORIGIN\";
add_header X-XSS-Protection \"1; mode=block\"; add_header X-XSS-Protection \"1; mode=block\";
add_header X-Content-Type-Options \"nosniff\"; add_header X-Content-Type-Options \"nosniff\";
# Path to the root of your installation # Path to the root of your installation
root ${toolPath}/public; root ${toolPath}/public;
index index.php index.html; index index.html index.htm index.php;
charset utf-8; charset utf-8;
client_max_body_size 64M; client_max_body_size 64M;
location / { location / {
try_files \$uri \$uri/ /\$is_args\$args; try_files \$uri \$uri/ /index.php?\$query_string;
#try_files \$uri \$uri/ /index.php?\$query_string;
} }
location ~ \\.php$ { location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \\.php$ {
try_files \$uri =404; try_files \$uri =404;
fastcgi_split_path_info ^(.+\\.php)(/.+)$; fastcgi_split_path_info ^(.+\\.php)(/.+)$;
fastcgi_pass php-handler-pixel; fastcgi_pass php-handler-pixel;
@@ -185,6 +186,10 @@ try_files \$uri \$uri/ /\$is_args\$args;
fastcgi_param REQUEST_SCHEME \$http_x_forwarded-proto; fastcgi_param REQUEST_SCHEME \$http_x_forwarded-proto;
fastcgi_param HTTPS \$proxy_https if_not_empty; fastcgi_param HTTPS \$proxy_https if_not_empty;
} }
location ~ /\\.(?!well-known).* {
deny all;
}
}" }"
step_20_info() { echo "Reload configuration (.env)"; } step_20_info() { echo "Reload configuration (.env)"; }
@@ -192,6 +197,7 @@ step_20_alias() { ALIAS="newenv"; }
step_20() { step_20() {
cd $toolPath cd $toolPath
exe php artisan config:cache exe php artisan config:cache
exe service pixelfed restart
} }
step_22_info() { echo "Create new user"; } step_22_info() { echo "Create new user"; }