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