committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 392 additions and 146 deletions
-
88README.md
-
2check_process
-
11conf/nginx.conf
-
104conf/php-fpm.conf
-
8manifest.json
-
24pull_request_template.md
-
13scripts/_common.sh
-
23scripts/backup
-
92scripts/change_url
-
42scripts/install
-
19scripts/remove
-
27scripts/restore
-
81scripts/upgrade
-
4sources/www/index.html
@ -1,65 +1,73 @@ |
|||||
Custom Webapp |
|
||||
------------- |
|
||||
|
# Custom Webapp for YunoHost |
||||
|
|
||||
Empty application with SFTP access to the Web directory. |
|
||||
|
[](https://dash.yunohost.org/appci/app/my_webapp) |
||||
|
[](https://install-app.yunohost.org/?app=my_webapp) |
||||
|
|
||||
|
> *This package allow you to install Custom Webapp 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 |
## Overview |
||||
|
|
||||
This application allows you to easily install a custom Web application, |
This application allows you to easily install a custom Web application, |
||||
providing files access with SFTP. It can also create a MySQL database - |
|
||||
|
providing files access with [SFTP](https://yunohost.org/#/filezilla). It can also create a MySQL database - |
||||
which will be backed up and restored with your application. The connection |
which will be backed up and restored with your application. The connection |
||||
details will be stored in the file `db_accesss.txt` located in the root |
details will be stored in the file `db_accesss.txt` located in the root |
||||
directory. |
directory. |
||||
|
|
||||
Once installed, go to the chosen URL to know the user, domain and port |
|
||||
you will have to use for the SFTP access - the password is one you give |
|
||||
at the installation. Under the Web directory, you will see a `www` folder |
|
||||
which is the public and served one. You can put all the files of your |
|
||||
custom Web application inside. |
|
||||
|
**Once installed, go to the chosen URL to know the user, domain and port |
||||
|
you will have to use for the SFTP access.** The password is one you chosen |
||||
|
during the installation. Under the Web directory, you will see a `www` folder |
||||
|
which contains the public files served by this app. You can put all the files |
||||
|
of your custom Web application inside. |
||||
|
|
||||
|
**Shipped version:** 1.0 |
||||
|
|
||||
|
## Screenshots |
||||
|
|
||||
|
## Demo |
||||
|
|
||||
## Upgrade |
|
||||
|
## Configuration |
||||
|
|
||||
Due to the SFTP access change, the upgrade can not be done from the last |
|
||||
`my_webapp` application - provided with YunoHost 2.2. You will have to remove |
|
||||
it first and install this new one, taking care of migrating your data. |
|
||||
|
## Documentation |
||||
|
|
||||
### Save your files and the database |
|
||||
|
* YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_my_webapp.md |
||||
|
|
||||
You will have to save the content of the `/var/www/my_webapp/files` |
|
||||
directory, either from the Web admin interface provided by the old app or |
|
||||
connecting to your server using SSH - or SFTP as `admin`. |
|
||||
|
## YunoHost specific features |
||||
|
|
||||
If you've created a MySQL database, you can also migrate it since the new |
|
||||
version allows to manage it for you. To create a dump, you could either use |
|
||||
[phpMyAdmin](https://github.com/YunoHost-Apps/phpmyadmin_ynh) or connect to |
|
||||
your server and execute: |
|
||||
`mysqldump -u root -p$(cat /etc/yunohost/mysql --no-create-db "$dbname" > ./dump.sql` |
|
||||
(do not forget to replace `$dbname` by your database name). |
|
||||
|
#### Multi-users support |
||||
|
|
||||
### Restore your custom Webapp |
|
||||
|
#### Supported architectures |
||||
|
|
||||
When you've taken care of saving your files - and optionally your database, |
|
||||
you can remove the app and install this new one. You can set the same |
|
||||
settings as the previous installation. |
|
||||
|
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/my_webapp/) |
||||
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/) |
||||
|
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/my_webapp/) |
||||
|
|
||||
To restore your files, connect to the Web directory using the SFTP account - as |
|
||||
described at the installation path - and put everything into the `www` directory. |
|
||||
|
## Limitations |
||||
|
|
||||
If you have chosen to migrate your database too, open the file `db_access.txt` |
|
||||
to know the new database, user and password you will have to set in your app |
|
||||
configuration. You can restore the dump you've created earlier either using |
|
||||
[phpMyAdmin](https://github.com/YunoHost-Apps/phpmyadmin_ynh) or connect to |
|
||||
your server and execute: |
|
||||
`mysql -u "$dbuser" -p"$dbpass" "$dbname" < ./dump.sql` |
|
||||
(do not forget to replace `$dbuser`, `$dbpass` and `$dbname` with the values |
|
||||
given in the file). |
|
||||
|
## Additional information |
||||
|
|
||||
### SFTP port ### |
|
||||
|
#### SFTP port |
||||
|
|
||||
You may have change the SSH port as described |
You may have change the SSH port as described |
||||
[here (section "Modifier le port SSH"](https://yunohost.org/#/security_fr) ; |
[here (section "Modifier le port SSH"](https://yunohost.org/#/security_fr) ; |
||||
then you should use this port to update your website with SFTP. |
then you should use this port to update your website with SFTP. |
||||
|
|
||||
## Links |
|
||||
|
## Links |
||||
|
|
||||
|
* Report a bug: https://github.com/YunoHost-Apps/my_webapp_ynh/issues |
||||
|
* 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/my_webapp_ynh/tree/testing). |
||||
|
|
||||
**YunoHost**: https://yunohost.org/ |
|
||||
|
To try the testing branch, please proceed like that. |
||||
|
``` |
||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing --debug |
||||
|
or |
||||
|
sudo yunohost app upgrade my_webapp -u https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing --debug |
||||
|
``` |
||||
@ -0,0 +1,24 @@ |
|||||
|
## Problem |
||||
|
- *Description of why you made this PR* |
||||
|
|
||||
|
## Solution |
||||
|
- *And how you fix that* |
||||
|
|
||||
|
## PR Status |
||||
|
- [ ] Code finished. |
||||
|
- [ ] Tested with Package_check. |
||||
|
- [ ] Fix or enhancement tested. |
||||
|
- [ ] Upgrade from last version tested. |
||||
|
- [ ] Can be reviewed and tested. |
||||
|
|
||||
|
## Validation |
||||
|
--- |
||||
|
*Minor decision* |
||||
|
- **Upgrade previous version** : |
||||
|
- [ ] **Code review** : |
||||
|
- [ ] **Approval (LGTM)** : |
||||
|
- [ ] **Approval (LGTM)** : |
||||
|
- **CI succeeded** : |
||||
|
[](https://ci-apps-dev.yunohost.org/jenkins/job/my_webapp_ynh%20PR-NUM-/) |
||||
|
*Please replace '-NUM-' in this link by the PR number.* |
||||
|
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. |
||||
@ -0,0 +1,13 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
# ============= FUTURE YUNOHOST HELPER ============= |
||||
|
# Delete a file checksum from the app settings |
||||
|
# |
||||
|
# $app should be defined when calling this helper |
||||
|
# |
||||
|
# usage: ynh_remove_file_checksum file |
||||
|
# | arg: file - The file for which the checksum will be deleted |
||||
|
ynh_delete_file_checksum () { |
||||
|
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' |
||||
|
ynh_app_setting_delete $app $checksum_setting_name |
||||
|
} |
||||
@ -0,0 +1,92 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
#================================================= |
||||
|
# GENERIC STARTING |
||||
|
#================================================= |
||||
|
# IMPORT GENERIC HELPERS |
||||
|
#================================================= |
||||
|
|
||||
|
source _common.sh |
||||
|
source /usr/share/yunohost/helpers |
||||
|
|
||||
|
#================================================= |
||||
|
# RETRIEVE ARGUMENTS |
||||
|
#================================================= |
||||
|
|
||||
|
old_domain=$YNH_APP_OLD_DOMAIN |
||||
|
old_path=$YNH_APP_OLD_PATH |
||||
|
|
||||
|
new_domain=$YNH_APP_NEW_DOMAIN |
||||
|
new_path=$YNH_APP_NEW_PATH |
||||
|
|
||||
|
app=$YNH_APP_INSTANCE_NAME |
||||
|
|
||||
|
#================================================= |
||||
|
# LOAD SETTINGS |
||||
|
#================================================= |
||||
|
|
||||
|
# Needed for helper "ynh_add_nginx_config" |
||||
|
final_path=$(ynh_app_setting_get $app final_path) |
||||
|
|
||||
|
#================================================= |
||||
|
# CHECK THE SYNTAX OF THE PATHS |
||||
|
#================================================= |
||||
|
|
||||
|
test -n "$old_path" || old_path="/" |
||||
|
test -n "$new_path" || new_path="/" |
||||
|
new_path=$(ynh_normalize_url_path $new_path) |
||||
|
old_path=$(ynh_normalize_url_path $old_path) |
||||
|
|
||||
|
#================================================= |
||||
|
# CHECK WHICH PARTS SHOULD BE CHANGED |
||||
|
#================================================= |
||||
|
|
||||
|
change_domain=0 |
||||
|
if [ "$old_domain" != "$new_domain" ] |
||||
|
then |
||||
|
change_domain=1 |
||||
|
fi |
||||
|
|
||||
|
change_path=0 |
||||
|
if [ "$old_path" != "$new_path" ] |
||||
|
then |
||||
|
change_path=1 |
||||
|
fi |
||||
|
|
||||
|
#================================================= |
||||
|
# STANDARD MODIFICATIONS |
||||
|
#================================================= |
||||
|
# MODIFY URL IN NGINX CONF |
||||
|
#================================================= |
||||
|
|
||||
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf |
||||
|
|
||||
|
# Change the path in the nginx config file |
||||
|
if [ $change_path -eq 1 ] |
||||
|
then |
||||
|
# Make a backup of the original nginx config file if modified |
||||
|
ynh_backup_if_checksum_is_different "$nginx_conf_path" |
||||
|
# Set global variables for nginx helper |
||||
|
domain="$old_domain" |
||||
|
path_url="$new_path" |
||||
|
# Create a dedicated nginx config |
||||
|
ynh_add_nginx_config |
||||
|
fi |
||||
|
|
||||
|
# Change the domain for nginx |
||||
|
if [ $change_domain -eq 1 ] |
||||
|
then |
||||
|
# Delete file checksum for the old conf file location |
||||
|
ynh_delete_file_checksum "$nginx_conf_path" |
||||
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf |
||||
|
# Store file checksum for the new config file location |
||||
|
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" |
||||
|
fi |
||||
|
|
||||
|
#================================================= |
||||
|
# GENERIC FINALISATION |
||||
|
#================================================= |
||||
|
# RELOAD NGINX |
||||
|
#================================================= |
||||
|
|
||||
|
systemctl reload nginx |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue