mirror of
https://github.com/YunoHost-Apps/peertube_ynh.git
synced 2024-09-03 19:56:29 +02:00
Fix folder permissions
This commit is contained in:
parent
7a621c48f6
commit
6526d69667
10 changed files with 104 additions and 70 deletions
|
@ -1,9 +1,9 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
domain="domain.tld"
|
||||
email="admin@example.com"
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
port="9000" (PORT)
|
||||
is_public=1
|
||||
port="9000"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
30
doc/DISCLAIMER.md
Normal file
30
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
### Why PeerTube?
|
||||
|
||||
We can't build a FOSS video streaming alternatives to YouTube, Dailymotion, Vimeo... with a centralized software. One organization alone cannot have enough money to pay bandwidth and video storage of its server.
|
||||
|
||||
So we need to have a decentralized network of servers seeding videos (as [Hubzilla YunoHost](https://github.com/YunoHost-Apps/hubzilla_ynh), [Friendica YunoHost](https://github.com/YunoHost-Apps/friendica_ynh),[Mastodon YunoHost](https://github.com/YunoHost-Apps/mastodon_ynh)), [Diaspora](https://github.com/diaspora/diaspora) ([Diaspora YunoHost](https://github.com/YunoHost-Apps/diaspora_ynh)),[Funkwhale](https://funkwhale.audio) ([Funkwhale YunoHost](https://github.com/YunoHost-Apps/funkwhale_ynh)).
|
||||
But it's not enough because one video could become famous and overload the server.
|
||||
It's the reason why we need to use a P2P protocol to limit the server load.
|
||||
Thanks to [WebTorrent](https://github.com/feross/webtorrent), we can make P2P (thus BitTorrent) inside the web browser, as of today.
|
||||
|
||||
### Why is that cool?
|
||||
Servers are run independently by different people and organizations. They can apply wildly different moderation policies, so you can find or make one that fits your taste perfectly.
|
||||
|
||||
By watching a video, you help the hosting provider to broadcast it by becoming a broadcaster of the video yourself. Each instance doesn’t need much money to broadcast the videos of its users.
|
||||
|
||||
* Any known limitations, constrains or stuff not working, such as (but not limited to):
|
||||
* Require **dedicated domain** like **peertube.domain.tld**.
|
||||
* Admin username is: **root**.
|
||||
* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation.
|
||||
* URL can not be changed once selected. Choose the domain wisely.
|
||||
* You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**.
|
||||
|
||||
$ dd if=/dev/zero of=/swapfile bs=1024 count=1048576
|
||||
$ mkswap /swapfile
|
||||
$ swapon /swapfile
|
||||
$ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
|
||||
|
||||
* This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server)
|
||||
* **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)**
|
||||
* LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation.
|
||||
* HTTP auth is not supported
|
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/screenshot1.png
Normal file
BIN
doc/screenshots/screenshot1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
|
@ -8,6 +8,14 @@
|
|||
},
|
||||
"version": "3.2.1~ynh3",
|
||||
"url": "https://github.com/Chocobozzz/PeerTube",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-only",
|
||||
"website": "https://joinpeertube.org/fr/",
|
||||
"demo": "http://peertube.cpy.re",
|
||||
"admindoc": "https://docs.joinpeertube.org/",
|
||||
"userdoc": "https://yunohost.org/#/app_peertube",
|
||||
"code": "https://github.com/Chocobozzz/PeerTube/"
|
||||
},
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": [
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -43,6 +43,12 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -63,13 +69,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
|
|||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up data directory..."
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
|
|
@ -103,7 +103,7 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
|
|||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
|
@ -140,21 +140,20 @@ chown -R $app:www-data "$final_path"
|
|||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config "datadir"
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# CREATE THE DATA DIRECTORY
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating the data directory..."
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
# Create app folders
|
||||
mkdir -p "$datadir"
|
||||
mkdir -p $datadir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
chmod 750 "$datadir/.."
|
||||
chmod -R o-rwx "$datadir/.."
|
||||
chown -R $app:www-data "$datadir/.."
|
||||
|
||||
#=================================================
|
||||
# BUILD YARN DEPENDENCIES
|
||||
|
@ -169,7 +168,7 @@ popd
|
|||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a config file..."
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml"
|
||||
|
||||
|
@ -203,7 +202,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
|
|||
ynh_script_progression --message="Installing LDAP plugin..."
|
||||
|
||||
pushd "$final_path"
|
||||
NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
|
||||
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -212,7 +211,7 @@ popd
|
|||
ynh_script_progression --message="Changing PeerTube admin password..."
|
||||
|
||||
pushd "$final_path"
|
||||
echo $admin_pass | NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production npm run reset-password -- -u root
|
||||
echo $admin_pass | ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run reset-password -- -u root
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -220,7 +219,7 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
# Stop a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -75,30 +75,21 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring data directory..."
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
|
||||
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
|
||||
mkdir -p "$datadir"
|
||||
mkdir -p $datadir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring firewall..."
|
||||
|
||||
# Open the port
|
||||
ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
|
||||
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
@ -129,6 +120,14 @@ ynh_psql_test_if_first_run
|
|||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
||||
|
||||
#=================================================
|
||||
# OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring firewall..."
|
||||
|
||||
# Open the port
|
||||
ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -35,6 +35,30 @@ ynh_script_progression --message="Checking version..."
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -102,37 +126,13 @@ if ! ynh_permission_exists --permission="api"; then
|
|||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -182,7 +182,7 @@ chown -R $app:www-data "$final_path"
|
|||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config "datadir"
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
|
@ -212,16 +212,15 @@ yunohost tools regen-conf nginx
|
|||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# CREATE THE DATA DIRECTORY
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating the data directory..."
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
# Create app folders
|
||||
mkdir -p "$datadir"
|
||||
mkdir -p $datadir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
chmod 750 "$datadir/.."
|
||||
chmod -R o-rwx "$datadir/.."
|
||||
chown -R $app:www-data "$datadir/.."
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
|
@ -252,7 +251,7 @@ popd
|
|||
ynh_script_progression --message="Installing LDAP plugin..."
|
||||
|
||||
pushd "$final_path"
|
||||
NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
|
||||
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue