mirror of
https://github.com/YunoHost-Apps/mobilizon_ynh.git
synced 2024-09-03 19:46:19 +02:00
Merge branch '1.0.0-rc1_improved' into 1.0.0-rc.4
This commit is contained in:
commit
771256c9c2
11 changed files with 136 additions and 57 deletions
15
README.md
15
README.md
|
@ -17,22 +17,7 @@ Mobilizon is a tool designed to create platforms for managing communities and ev
|
|||
|
||||
## Important points to read before installing
|
||||
|
||||
1. **Mobilizon** is in early development, like an Alpha, all functionalities are not available
|
||||
1. **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld
|
||||
1. Even if requested during installation: admin, language and password variables are not used
|
||||
1. Admin Dashboard is still not implemented
|
||||
1. When your mobilizon instance is installed, you need to register.
|
||||
1. When registered, to be admin you have to manually goes in PostgreSQL, database $app, table users, and change the role value to `administrator` instead of `user` (other role available: `moderator`)
|
||||
|
||||
Example to manually put user with id=1 as administrator:
|
||||
```bash
|
||||
su -l postgres
|
||||
psql
|
||||
\c mobilizon
|
||||
UPDATE public.users SET role='administrator' where id=1;
|
||||
\q
|
||||
exit
|
||||
```
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
|
11
conf/ldap.exs
Normal file
11
conf/ldap.exs
Normal file
|
@ -0,0 +1,11 @@
|
|||
config :mobilizon, Mobilizon.Service.Auth.Authenticator, Mobilizon.Service.Auth.LDAPAuthenticator
|
||||
config :mobilizon, :ldap,
|
||||
enabled: true,
|
||||
host: "localhost",
|
||||
port: 389,
|
||||
ssl: false,
|
||||
# sslopts: [],
|
||||
tls: false,
|
||||
# tlsopts: [],
|
||||
base: "ou=users,dc=yunohost,dc=org",
|
||||
uid: "uid"
|
|
@ -4,30 +4,49 @@ location / {
|
|||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
gzip off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
|
||||
|
||||
# For Websocket support
|
||||
# the nginx default is 1m, not enough for large media uploads
|
||||
client_max_body_size 16m;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
proxy_redirect off;
|
||||
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;
|
||||
|
||||
proxy_pass http://localhost:__PORT__;
|
||||
|
||||
client_max_body_size 16m;
|
||||
|
||||
location ~* \.(css|js)$ {
|
||||
root __FINALPATH__/mobilizon/priv/static;
|
||||
etag off;
|
||||
expires 1y;
|
||||
access_log off;
|
||||
add_header Cache-Control public;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
}
|
||||
|
||||
location ~ ^/(media|proxy) {
|
||||
etag off;
|
||||
access_log off;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
proxy_pass http://localhost:__PORT__;
|
||||
}
|
||||
|
||||
error_page 500 501 502 503 504 @error;
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
||||
location @error {
|
||||
root __FINALPATH__/mobilizon/priv/errors;
|
||||
try_files /error.html 502;
|
||||
}
|
|
@ -1,22 +1,24 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all.
|
||||
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
|
||||
|
||||
---
|
||||
|
||||
**How to post a meaningful bug report**
|
||||
1. *Read this whole template first.*
|
||||
2. *Determine if you are on the right place:*
|
||||
2. *Make sure you are on the right place:*
|
||||
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
|
||||
- *Otherwise, the issue may be due to Mobilizon itself. Refer to its documentation or repository for help.*
|
||||
- *If you have a doubt, post here, we will figure it out together.*
|
||||
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
||||
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
|
||||
- *In doubt, ask here and we will figure it out together.*
|
||||
3. *Delete these italic comments as you write over them below, and remove this guide.*
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
### Describe the bug
|
||||
|
||||
*A clear and concise description of what the bug is.*
|
||||
|
||||
**Versions**
|
||||
### Context
|
||||
|
||||
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
|
||||
- YunoHost version: x.x.x
|
||||
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
|
||||
|
@ -25,8 +27,8 @@ about: Create a report to help us debug, it would be nice to fill the template a
|
|||
- Using, or trying to install package version/branch:
|
||||
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
|
||||
|
||||
**To Reproduce**
|
||||
*Steps to reproduce the behavior.*
|
||||
### Steps to reproduce
|
||||
|
||||
- *If you performed a command from the CLI, the command itself is enough. For example:*
|
||||
```sh
|
||||
sudo yunohost app install mobilizon
|
||||
|
@ -38,9 +40,16 @@ about: Create a report to help us debug, it would be nice to fill the template a
|
|||
3. *Scroll down to '....'*
|
||||
4. *See error*
|
||||
|
||||
**Expected behavior**
|
||||
### Expected behavior
|
||||
|
||||
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
|
||||
|
||||
**Logs**
|
||||
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
|
||||
### Logs
|
||||
|
||||
*When an operation fails, YunoHost provides a simple way to share the logs.*
|
||||
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
|
||||
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
|
||||
|
||||
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
|
||||
|
||||
*If applicable and useful, add screenshots to help explain your problem.*
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose an admin user",
|
||||
"fr": "Choisissez l’administrateur"
|
||||
"fr": "Choisissez l'administrateur"
|
||||
},
|
||||
"example": "johndoe"
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib git curl gnupg openssl postgis make gcc libc-dev argon2 imagemagick webp gifsicle jpegoptim optipng pngquant cmake"
|
||||
pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib git curl unzip gnupg openssl postgis make gcc libc-dev argon2 imagemagick webp gifsicle jpegoptim optipng pngquant cmake"
|
||||
extra_pkg_dependencies="elixir esl-erlang"
|
||||
|
||||
NODEJS_VERSION=12
|
||||
|
|
|
@ -113,14 +113,10 @@ fi
|
|||
ynh_script_progression --message="Modifying a config file..."
|
||||
|
||||
config="$final_path/$app/config/prod.secret.exs"
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
|
||||
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$config"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing the config file checksum..."
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -155,6 +155,12 @@ pushd $final_path/$app
|
|||
sudo -u "$app" MIX_ENV=prod mix deps.get
|
||||
sudo -u "$app" MIX_ENV=prod mix compile
|
||||
sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name $name --admin-email $admin_email --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port
|
||||
popd
|
||||
|
||||
cat "../conf/ldap.exs" >> "$config"
|
||||
|
||||
pushd $final_path/$app
|
||||
ynh_secure_remove --file="/tmp/setup_db.psql"
|
||||
sudo -u "$app" MIX_ENV=prod mix ecto.migrate
|
||||
sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password"
|
||||
popd
|
||||
|
|
|
@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service..."
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
|
@ -49,7 +49,7 @@ ynh_remove_systemd_config
|
|||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source ynh_package_version
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -91,6 +92,23 @@ ynh_script_progression --message="Stopping a systemd service..."
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE FROM PREVIOUS VERSION
|
||||
#=================================================
|
||||
|
||||
if ynh_version_gt "1.0.0-rc1~ynh1" "${previous_version}" ; then
|
||||
ynh_script_progression --message="Upgrade configuration to 1.0.0-rc1~ynh1..."
|
||||
|
||||
config="$final_path/$app/config/prod.secret.exs"
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
|
||||
# Implement ldap
|
||||
cat "../conf/ldap.exs" >> "$config"
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$config"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -173,7 +191,7 @@ pushd $final_path/$app/js
|
|||
ynh_script_progression --message="Building NodeJS..."
|
||||
ynh_use_nodejs
|
||||
sudo -u $app env PATH=$PATH yarn install
|
||||
sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build
|
||||
sudo -u $app env PATH=$PATH yarn run build
|
||||
popd
|
||||
|
||||
pushd $final_path/$app
|
||||
|
@ -183,12 +201,14 @@ pushd $final_path/$app
|
|||
sudo -u "$app" MIX_ENV=prod mix deps.get
|
||||
sudo -u "$app" MIX_ENV=prod mix compile
|
||||
sudo -u "$app" MIX_ENV=prod mix ecto.migrate
|
||||
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing the config file checksum..."
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
|
@ -210,6 +230,20 @@ ynh_script_progression --message="Securing files and directories..."
|
|||
# Set permissions on app files
|
||||
chown -R "$app":"$app" "$final_path"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description "$app daemon for Mobilizon"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Mobilizon.Web.Endpoint at"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
@ -222,13 +256,6 @@ then
|
|||
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Mobilizon.Web.Endpoint at"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
26
scripts/ynh_package_version
Normal file
26
scripts/ynh_package_version
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
read_json () {
|
||||
sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])"
|
||||
}
|
||||
|
||||
read_manifest () {
|
||||
if [ -f '../manifest.json' ] ; then
|
||||
read_json '../manifest.json' "$1"
|
||||
else
|
||||
read_json '../settings/manifest.json' "$1"
|
||||
fi
|
||||
}
|
||||
abort_if_up_to_date () {
|
||||
version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7')
|
||||
last_version=$(read_manifest 'version')
|
||||
if [ "${version}" = "${last_version}" ]; then
|
||||
ynh_print_info "Up-to-date, nothing to do"
|
||||
ynh_die "" 0
|
||||
fi
|
||||
}
|
||||
|
||||
ynh_version_gt ()
|
||||
{
|
||||
dpkg --compare-versions "$1" gt "$2"
|
||||
}
|
Loading…
Add table
Reference in a new issue