First working installation with pixelfed sequence

Still some manual work to do
This commit is contained in:
2019-05-12 20:04:34 +00:00
parent a1528de93e
commit 4e88850aba

View File

@@ -1,7 +1,7 @@
#!/bin/bash
toolName="pixelfed"
toolDeps="jpegoptim"
toolDeps="composer jpegoptim php7.2-bcmath"
toolPath="/var/www/pixelfed"
step_1_info() { echo "Updating apt"; }
@@ -15,12 +15,14 @@ step_2() {
exe apt install $toolDeps -y
saveReturn $?
endReturn
exe service php7.2-fpm restart
}
step_3_info() { echo -e "Get $toolName using git"; }
step_3() {
exe git clone https://github.com/dansup/pixelfed $toolPath
exe cd $toolPath
#exe git clone https://github.com/dansup/pixelfed $toolPath
exe chown -R www-data: $toolPath
cd $toolPath
exe composer install --no-dev
saveReturn $?
endReturn
@@ -64,32 +66,42 @@ step_4() {
step_5_info() { echo "$toolName configuration"; }
step_5() {
exe cd $toolPath
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)"
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
}
blueprintHack="${toolPath}/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php"
step_6_info() { echo "Create admin user"; }
step_6() {
cd $toolPath
read -p "Create admin user. (Enter to continue)"
exe php artisan user:create
echo "Use \"php artisan user:admin 'username'\" to set admin"
}
step_7_info() { echo "Create pixelfed (horzion) service"; }
step_7() {
addConf "$horzionService" "$horzionServiceLoc"
addConf "${horizonService}" "${horizonServiceLoc}"
exe systemctl daemon-reload
exe systemctl enable pixelfed.service
exe service pixelfed start
}
horizonServiceLoc="/etc/systemd/system/pixelfed.service"
horzionService="\
[Unit]
horizonService="\
[Unit]
Description=Pixelfeds' Horizon
After=syslog.target
After=network.target
@@ -118,6 +130,77 @@ Environment=
[Install]
WantedBy=multi-user.target"
step_8_info() { echo "Nginx configuration"; }
step_8() {
addConf "$nginxConfig" "$nginxConfigLoc"
exe ln -s "$nginxConfigLoc" "$nginxConfigEnable"
exe nginx -t
saveReturn $?
endReturn
exe service nginx restart
}
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;
}
map \$http_x_forwarded_proto \$proxy_https {
default '';
https 'on';
}
server {
listen 80;
listen [::]:80;
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;
charset utf-8;
client_max_body_size 64M;
location / {
try_files \$uri \$uri/ /\$is_args\$args;
#try_files \$uri \$uri/ /index.php?\$query_string;
}
location ~ \\.php$ {
try_files \$uri =404;
fastcgi_split_path_info ^(.+\\.php)(/.+)$;
fastcgi_pass php-handler-pixel;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME \$request_filename;
fastcgi_param PATH_INFO \$fastcgi_path_info;
# fix preview problem
fastcgi_param REQUEST_SCHEME \$http_x_forwarded-proto;
fastcgi_param HTTPS \$proxy_https if_not_empty;
}
}"
step_20_info() { echo "Reload configuration (.env)"; }
step_20_alias() { ALIAS="newenv"; }
step_20() {
cd $toolPath
exe php artisan config:cache
}
step_22_info() { echo "Create new user"; }
step_22_alias() { ALIAS="createuser"; }
step_22() {
cd $toolPath
exe php artisan user:create
}
# Sequence Revision
VERSION_SEQREV=2