Initial commit
This commit is contained in:
commit
914b85a251
10
README.md
Normal file
10
README.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# YunoHost Application example #
|
||||||
|
|
||||||
|
## Documentation ##
|
||||||
|
https://yunohost.org/packaging_apps_en
|
||||||
|
|
||||||
|
## Usage ##
|
||||||
|
- Add application source files into `sources` subfolder.
|
||||||
|
- Edit `conf/nginx.conf` file to match application prerequisites.
|
||||||
|
- Edit install/upgrade/remove scripts.
|
||||||
|
- Edit manifest with application specific information.
|
25
conf/nginx.conf
Normal file
25
conf/nginx.conf
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
location YNH_EXAMPLE_PATH {
|
||||||
|
|
||||||
|
# Path to source
|
||||||
|
alias YNH_EXAMPLE_ALIAS ;
|
||||||
|
|
||||||
|
# Force https
|
||||||
|
if ($scheme = http) {
|
||||||
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Example PHP configuration
|
||||||
|
index index.php;
|
||||||
|
try_files $uri $uri/ index.php;
|
||||||
|
location ~ [^/]\.php(/|$) {
|
||||||
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Include SSOWAT user panel.
|
||||||
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
}
|
48
manifest.json
Normal file
48
manifest.json
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"name": "YunoHost application example",
|
||||||
|
"id": "ynhexample",
|
||||||
|
"description": {
|
||||||
|
"en": "Example package for Yunohost applications."
|
||||||
|
},
|
||||||
|
"licence": "GPL-2",
|
||||||
|
"developer": {
|
||||||
|
"name": "John doe",
|
||||||
|
"email": "john.doe@example.com",
|
||||||
|
"url": "http://example.com"
|
||||||
|
},
|
||||||
|
"multi_instance": "false",
|
||||||
|
"arguments": {
|
||||||
|
"install" : [
|
||||||
|
{
|
||||||
|
"name": "domain",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a domain for ynhexample"
|
||||||
|
},
|
||||||
|
"example": "example.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a path for ynhexample"
|
||||||
|
},
|
||||||
|
"example": "/dokuwiki",
|
||||||
|
"default": "/dokuwiki"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose an admin user"
|
||||||
|
},
|
||||||
|
"example": "johndoe"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "is_public",
|
||||||
|
"ask": {
|
||||||
|
"en": "Is it a public application ?"
|
||||||
|
},
|
||||||
|
"choices": ["Yes", "No"],
|
||||||
|
"default": "Yes"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
38
scripts/install
Executable file
38
scripts/install
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
app=ynhexample
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$1
|
||||||
|
path=$2
|
||||||
|
admin=$3
|
||||||
|
is_public=$4
|
||||||
|
|
||||||
|
# Save app settings
|
||||||
|
sudo yunohost app setting $app admin -v "$admin"
|
||||||
|
sudo yunohost app setting $app is_public -v "$is_public"
|
||||||
|
|
||||||
|
# Check domain/path availability
|
||||||
|
sudo yunohost app checkurl $domain$path -a dokuwiki
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy source files
|
||||||
|
final_path=/var/www/$app
|
||||||
|
sudo mkdir -p $final_path
|
||||||
|
sudo cp -a ../sources/* $final_path
|
||||||
|
|
||||||
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
|
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||||
|
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
|
if [ "$is_public" = "Yes" ];
|
||||||
|
then
|
||||||
|
sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restart services
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
18
scripts/remove
Executable file
18
scripts/remove
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
app=ynhexample
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
path=$(sudo yunohost app setting $app path)
|
||||||
|
admin=$(sudo yunohost app setting $app admin)
|
||||||
|
is_public=$(sudo yunohost app setting $app is_public)
|
||||||
|
|
||||||
|
# Remove sources
|
||||||
|
sudo rm -rf /var/www/$app
|
||||||
|
|
||||||
|
# Remove configuration files
|
||||||
|
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
|
# Restart services
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
32
scripts/upgrade
Executable file
32
scripts/upgrade
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/bash
|
||||||
|
app=ynhexample
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
path=$(sudo yunohost app setting $app path)
|
||||||
|
admin=$(sudo yunohost app setting $app admin)
|
||||||
|
is_public=$(sudo yunohost app setting $app is_public)
|
||||||
|
|
||||||
|
# Remove trailing "/" for next commands
|
||||||
|
path=${path%/}
|
||||||
|
|
||||||
|
# Copy source files
|
||||||
|
final_path=/var/www/$app
|
||||||
|
sudo mkdir -p $final_path
|
||||||
|
sudo cp -a ../sources/* $final_path
|
||||||
|
|
||||||
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
|
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||||
|
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
|
if [ "$is_public" = "Yes" ];
|
||||||
|
then
|
||||||
|
sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restart services
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
|
Loading…
Reference in New Issue
Block a user