1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/writefreely_ynh.git synced 2024-09-03 20:36:02 +02:00

Update to V0.70 + Installation issue solving

This commit is contained in:
Yalh 2019-01-10 08:13:21 +01:00
parent f465e05f88
commit 93d0ba25a3
11 changed files with 458 additions and 54 deletions

View file

@ -1,2 +1,70 @@
# writefreely_ynh
WriteFreely is a beautifully pared-down blogging platform that's simple on the surface, yet powerful underneath
[![Integration level](https://dash.yunohost.org/integration/writefreely.svg)](https://ci-apps.yunohost.org/jenkins/job/writefreely%20%28Community%29/lastBuild/consoleFull)
[![Install WriteFreely with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=writefreely)
> *This package allow you to install WriteFreely quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
## Overview
WriteFreely is a beautifully pared-down blogging platform that's simple on the surface, yet powerful underneath.
Can be run as Single User Blog or Multi User Instance.
Each User canbe limited from 1 to unlimited blogs.
**Shipped version:** 0.70
## Screenshots
![](Link to an screenshot for this app)
## Demo
* [Official demo](https://write.as/new)
## Configuration
How to configure this app: by an admin panel, a plain file with SSH, or any other way.
## Documentation
* [Official documentation](https://writefreely.org/start)
#### Multi-users support
No LDAP and no HTTP auth supported
Depending of the configuration, the app be used by multiple users?
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/writefreely%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/writefreely%20(Community)/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/jenkins/job/writefreely%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps-arm.yunohost.org/jenkins/job/writefreely%20(Community)%20(%7EARM%7E)/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/jenkins/job/writefreely%20(Community)/badge/icon)](https://ci-stretch.nohost.me/jenkins/job/writefreely%20(Community)/)
## Limitations
* Any known limitations.
## Links
* Report a bug: https://github.com/YunoHost-Apps/writefreely_ynh/issues
* App website: https://writefreely.org/
* GitHub website: https://github.com/writeas/writefreely
* YunoHost website: https://yunohost.org/
---
Developers info
----------------
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/writefreely_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/writefreely_ynh/tree/testing --debug
or
sudo yunohost app upgrade writefreely -u https://github.com/YunoHost-Apps/writefreely_ynh/tree/testing --debug
```

View file

@ -10,8 +10,6 @@
admin="john" (USER)
language="fr"
is_public=1 (PUBLIC|public=1|private=0)
password="pass"
port="666" (PORT)
; Checks
pkg_linter=1
setup_sub_dir=1

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/writeas/writefreely/releases/download/v0.2.1/writefreely_0.2.1_linux_amd64.tar.gz
SOURCE_SUM=b39f5ca5e959a30fd849fb92e5339530df9c169398fb6233b31c840b14e26a0a
SOURCE_URL=https://github.com/writeas/writefreely/releases/download/v0.7.0/writefreely_0.7.0_linux_amd64.tar.gz
SOURCE_SUM=8d2e1eaa5db61080b328f2d6d8677bb68859346c6920db0bd4f7e8d7fc9149b7
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false

View file

@ -1,25 +1,32 @@
[server]
hidden_host = location.datamol.org
port = 8080
hidden_host =
port = __PORT__
bind = localhost
tls_cert_path =
tls_key_path =
[database]
type = mysql
username = writefreely
password = lOuLIS6ykMOk7rUDSOGsBxFc
database = writefreely
filename =
username = __DBUSER__
password = __DBPWD__
database = __DBNAME__
host = localhost
port = 3306
[app]
site_name = Datamol
host = http://localhost:8096
site_name = __SITENAME__
site_description = __SITEDESCRIPTION__
host = https://your-writefreely-url-instance.com
theme = write
disable_js = false
webfonts = true
single_user = true
open_registration = false
single_user = __SINGLEUSER__
open_registration = __OPENREGISTRATION__
min_username_len = 3
max_blogs = 1
federation = true
public_stats = true
private = false
max_blogs = __MAXBLOGS__
federation = __FEDERATION__
public_stats = __PUBLICSTATS__
private = __PRIVATE__
local_timeline = __LOCALTIMELINE__

View file

@ -1,23 +1,31 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location ~ ^/.well-known/(webfinger|nodeinfo|host-meta) {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect off;
}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect off;
}
location ~ ^/(css|img|js|fonts)/ {
root __FINALPATH__/static;
# Optionally cache these files in the browser:
# expires 12M;
}
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect off;
}
location ~ ^/(css|img|js|fonts)/ {
root __FINALPATH__/static;
# Optionally cache these files in the browser:
# expires 12M;
}
location __PATH__/ {
proxy_pass http://localhost:__PORT__/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 10m;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -1,5 +1,5 @@
[Unit]
Description=Small description of the service
Description=Write Freely Service
After=network.target
[Service]
@ -7,7 +7,7 @@ Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/
ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1
ExecStart=__FINALPATH__/__APP__ >> /var/log/__APP__/__APP__.log 2>&1
[Install]
WantedBy=multi-user.target

View file

@ -32,14 +32,26 @@
"example": "example.com"
},
{
"name": "path",
"type": "path",
"name": "admin",
"type": "user",
"ask": {
"en": "Choose a path for WriteFreely",
"fr": "Choisissez un chemin pour WriteFreely"
"en": "Choose an admin user",
"fr": "Choisissez ladministrateur"
},
"example": "/example",
"default": "/example"
"example": "johndoe"
},
{
"name": "password",
"type": "password",
"ask": {
"en": "Set the administrator password",
"fr": "Définissez le mot de passe administrateur"
},
"help": {
"en": "Use the help field to add an information for the admin about this question.",
"fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
},
"example": "Choose a password"
},
{
"name": "is_public",
@ -49,6 +61,84 @@
"fr": "Est-ce une application publique ?"
},
"default": true
},
{
"name": "single_user",
"ask": {
"en": "Choose if you want a Single User Blog ?",
"fr": "Souhaitez vous un blog pour un seul utilisateur?"
},
"choices": ["true", "false"],
"default": "true"
},
{
"name": "site_name",
"ask": {
"en": "Choose a name for your WriteFreely instance",
"fr": "Choisissez un nom pour votre instance WriteFreely"
},
"default": "WriteFreely"
},
{
"name": "site_description",
"ask": {
"en": "Choose a description for your WriteFreely instance",
"fr": "Choisissez une description pour votre instance WriteFreely"
},
"default": "WriteFreely Blogs"
},
{
"name": "open_registration",
"ask": {
"en": "Are registrations opened to all ?",
"fr": "Les inscriptions sont t'elles ouvertes ?"
},
"choices": ["true", "false"],
"default": "true"
},
{
"name": "max_blogs",
"ask": {
"en": "How many blogs each user can create ?",
"fr": "Combien de blogs chaque utilisateur peut créer ?"
},
"default": "1"
},
{
"name": "federation",
"ask": {
"en": "Is it federation enabled ?",
"fr": "Est-ce une application publique ?"
},
"choices": ["true", "false"],
"default": "true"
},
{
"name": "public_stats",
"ask": {
"en": "Are federation stats public ?",
"fr": "Est-ce les statistiques de federation sont publiques ?"
},
"choices": ["true", "false"],
"default": "true"
},
{
"name": "private",
"ask": {
"en": "Are the instance metadata private ?",
"fr": "Est-ce les metadatas de l'instance sont privée ?"
},
"choices": ["true", "false"],
"default": "false"
},
{
"name": "local_timeline",
"ask": {
"en": "Do you want to add a local timeline ?",
"fr": "Voulez vous afficher une timeline locale ?"
},
"choices": ["true", "false"],
"default": "true"
}
]
}

View file

@ -25,8 +25,24 @@ ynh_abort_if_errors
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
#path_url=$YNH_APP_ARG_PATH
path_url="/"
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
is_public=$YNH_APP_ARG_IS_PUBLIC
#language=$YNH_APP_ARG_LANGUAGE
single_user=$YNH_APP_ARG_SINGLE_USER
site_name=$YNH_APP_ARG_SITE_NAME
site_description=$YNH_APP_ARG_SITE_DESCRIPTION
open_registration=$YNH_APP_ARG_OPEN_REGISTRATION
max_blogs=$YNH_APP_ARG_MAX_BLOGS
federation=$YNH_APP_ARG_FEDERATION
public_stats=$YNH_APP_ARG_PUBLIC_STATS
private=$YNH_APP_ARG_PRIVATE
local_timeline=$YNH_APP_ARG_LOCAL_TIMELINE
### If it's a multi-instance app, meaning it can be installed several times independently
### The id of the app as stated in the manifest is available as $YNH_APP_ID
@ -54,6 +70,7 @@ path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
@ -63,8 +80,18 @@ ynh_webpath_register $app $domain $path_url
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app admin $admin
ynh_app_setting_set $app is_public $is_public
#ynh_app_setting_set $app language $language
ynh_app_setting_set $app single_user $single_user
ynh_app_setting_set $app site_name $site_name
ynh_app_setting_set $app site_description $site_description
ynh_app_setting_set $app open_registration $open_registration
ynh_app_setting_set $app max_blogs $max_blogs
ynh_app_setting_set $app federation $federation
ynh_app_setting_set $app public_stats $public_stats
ynh_app_setting_set $app private $private
ynh_app_setting_set $app local_timeline $local_timeline
#=================================================
# STANDARD MODIFICATIONS
@ -83,6 +110,18 @@ port=$(ynh_find_port 8095)
yunohost firewall allow --no-upnp TCP $port 2>&1
ynh_app_setting_set $app port $port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
### Those deb packages will be installed as dependencies of this package.
### If you're not using this helper:
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
#ynh_install_app_dependencies mysql
#=================================================
# CREATE A MYSQL DATABASE
@ -113,9 +152,6 @@ ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
# Import database schema
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < $final_path/schema.sql
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -132,6 +168,123 @@ ynh_add_nginx_config
# Create a system user
ynh_system_user_create $app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
### `ynh_add_fpm_config` is used to set up a PHP config.
### You can remove it if your app doesn't use PHP.
### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini
### If you're not using these lines:
### - You can remove these files in conf/.
### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
### With the reload at the end of the script.
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
# Create a dedicated php-fpm config
#ynh_add_fpm_config
#=================================================
# SPECIFIC SETUP
#=================================================
# ...
#=================================================
#=================================================
# SETUP SYSTEMD
#=================================================
### `ynh_systemd_config` is used to configure a systemd script for an app.
### It can be used for apps that use sysvinit (with adaptation) or systemd.
### Have a look at the app to be sure this app needs a systemd script.
### `ynh_systemd_config` will use the file conf/systemd.service
### If you're not using these lines:
### - You can remove those files in conf/.
### - Remove the section "BACKUP SYSTEMD" in the backup script
### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script
### - As well as the section "RESTORE SYSTEMD" in the restore script
### - And the section "SETUP SYSTEMD" in the upgrade script
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# SETUP APPLICATION WITH CURL
#=================================================
### Use these lines only if the app installation needs to be finalized through
### web forms. We generally don't want to ask the final user,
### so we're going to use curl to automatically fill the fields and submit the
### forms.
# Set right permissions for curl install
#chown -R $app: $final_path
# Set the app as temporarily public for curl call
#ynh_app_setting_set $app skipped_uris "/"
# Reload SSOwat config
#yunohost app ssowatconf
# Reload Nginx
#systemctl reload nginx
# Installation with curl
#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
# Remove the public access
#if [ $is_public -eq 0 ]
#then
# ynh_app_setting_delete $app skipped_uris
#fi
# setup application config
sudo cp ../conf/config.ini $final_path/config.ini
#=================================================
# MODIFY A CONFIG FILE
#=================================================
### `ynh_replace_string` is used to replace a string in a file.
### (It's compatible with sed regular expressions syntax)
ynh_replace_string "__DBNAME__" "$db_name" "$final_path/config.ini"
ynh_replace_string "__DBUSER__" "$db_name" "$final_path/config.ini"
ynh_replace_string "__DBPWD__" "$db_pwd" "$final_path/config.ini"
ynh_replace_string "__PORT__" "$port" "$final_path/config.ini"
ynh_replace_string "https://your-writefreely-url-instance.com" "https://$domain$path_url" "$final_path/config.ini"
ynh_replace_string "__SINGLEUSER__" "$single_user" "$final_path/config.ini"
ynh_replace_string "__SITENAME__" "$site_name" "$final_path/config.ini"
ynh_replace_string "__SITEDESCRIPTION__" "$site_description" "$final_path/config.ini"
ynh_replace_string "__OPENREGISTRATION__" "$open_registration" "$final_path/config.ini"
ynh_replace_string "__MAXBLOGS__" "$max_blogs" "$final_path/config.ini"
ynh_replace_string "__FEDERATION__" "$federation" "$final_path/config.ini"
ynh_replace_string "__PUBLICSTATS__" "$public_stats" "$final_path/config.ini"
ynh_replace_string "__PRIVATE__" "$private" "$final_path/config.ini"
ynh_replace_string "__LOCALTIMELINE__" "$local_timeline" "$final_path/config.ini"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
### `ynh_store_file_checksum` is used to store the checksum of a file.
### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`,
### you can make a backup of this file before modifying it again if the admin had modified it.
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/config.ini"
#=================================================
# SPECIFIC SETUP
#=================================================
# ...
#=================================================
( cd $final_path && $final_path/writefreely --init-db )
( cd $final_path && $final_path/writefreely --gen-keys )
( cd $final_path && $final_path/writefreely --create-admin $admin:$password )
#=================================================
# GENERIC FINALIZATION
@ -146,6 +299,40 @@ ynh_system_user_create $app
# Set permissions to app files
chown -R $app: $final_path
#=================================================
# SETUP LOGROTATE
#=================================================
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
### Use this helper only if there is effectively a log file for this app.
### If you're not using this helper:
### - Remove the section "BACKUP LOGROTATE" in the backup script
### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script
### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script
### - And the section "SETUP LOGROTATE" in the upgrade script
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
chown -R $app: /var/log/$app/
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
### `yunohost service add` is a CLI yunohost command to add a service in the admin panel.
### You'll find the service in the 'services' section of YunoHost admin panel.
### This CLI command would be useless if the app does not have any services (systemd or sysvinit)
### If you're not using these lines:
### - You can remove these files in conf/.
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
yunohost service add $app --log "/var/log/$app/APP.log"
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
#yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$app/APP.log"
#=================================================
# SETUP SSOWAT
#=================================================
@ -162,3 +349,5 @@ fi
#=================================================
systemctl reload nginx
systemctl enable "$app"
systemctl start "$app"

View file

@ -24,8 +24,29 @@ final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status | grep -q $app
then
echo "Remove $app service"
yunohost service remove $app
fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
#ynh_remove_app_dependencies
#=================================================
# REMOVE THE MYSQL DATABASE
@ -48,6 +69,19 @@ ynh_secure_remove "$final_path"
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
# Remove the dedicated php-fpm config
#ynh_remove_fpm_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# CLOSE A PORT
@ -62,7 +96,17 @@ fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE CRON FILE
#=================================================
# Remove a cron file
#ynh_secure_remove "/etc/cron.d/$app"
# Remove a directory securely
#ynh_secure_remove "/etc/$app/"
# Remove the log files
ynh_secure_remove "/var/log/$app/"
#=================================================
# GENERIC FINALIZATION

View file

@ -90,7 +90,7 @@ ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
#=================================================
# Define and install dependencies
ynh_install_app_dependencies deb1 deb2
#ynh_install_app_dependencies mysql
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL

View file

@ -88,7 +88,7 @@ ynh_add_nginx_config
# UPGRADE DEPENDENCIES
#=================================================
ynh_install_app_dependencies deb1 deb2
#ynh_install_app_dependencies mysql
#=================================================
# CREATE DEDICATED USER
@ -112,9 +112,9 @@ ynh_add_fpm_config
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE"
ynh_backup_if_checksum_is_different "$final_path/config.ini"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum "$final_path/CONFIG_FILE"
ynh_store_file_checksum "$final_path/config.ini"
#=================================================
# SETUP LOGROTATE