1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/beehive_ynh.git synced 2024-09-03 18:06:24 +02:00
This commit is contained in:
ericgaspar 2021-06-13 15:49:55 +02:00
parent a85a651100
commit 8d7ac89845
No known key found for this signature in database
GPG key ID: 574F281483054D44
4 changed files with 44 additions and 54 deletions

View file

@ -2,6 +2,6 @@ SOURCE_URL=https://github.com/muesli/beehive/releases/download/v0.4.0/beehive_0.
SOURCE_SUM=f1959bc2f7c19d4ec8eaabc7b78492836afcc3bcd75d034854e66607efa9efab SOURCE_SUM=f1959bc2f7c19d4ec8eaabc7b78492836afcc3bcd75d034854e66607efa9efab
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=false
SOURCE_FILENAME= SOURCE_FILENAME=
SOURCE_EXTRACT=true SOURCE_EXTRACT=true

View file

@ -6,9 +6,15 @@ location __PATH__/ {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
proxy_pass http://localhost:__PORT__; proxy_pass https://127.0.0.1:__PORT__;
proxy_redirect off;
proxy_set_header Host $host;
# Include SSOWAT user panel. proxy_set_header X-Real-IP $remote_addr;
include conf.d/yunohost_panel.conf.inc; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
} }

View file

@ -3,7 +3,7 @@
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
GO_VERSION=1.16
# dependencies used by the app # dependencies used by the app
pkg_dependencies="wget" pkg_dependencies="wget"
@ -11,45 +11,28 @@ pkg_dependencies="wget"
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then # Check the architecture
architecture="arm64" #
elif [ -n "$(uname -m | grep 64)" ]; then # example: architecture=$(ynh_detect_arch)
architecture="amd64" #
else # usage: ynh_detect_arch
ynh_die "Unable to detect your achitecture, please open a bug describing \ #
your hardware and the result of the command \"uname -m\"." 1 # Requires YunoHost version 2.2.4 or higher.
fi
ynh_smart_mktemp () { ynh_detect_arch(){
local min_size="${1:-300}" local architecture
# Transform the minimum size from megabytes to kilobytes if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
min_size=$(( $min_size * 1024 )) architecture="arm64"
elif [ -n "$(uname -m | grep 64)" ]; then
# Check if there's enough free space in a directory architecture="amd64"
is_there_enough_space () { elif [ -n "$(uname -m | grep 86)" ]; then
local free_space=$(df --output=avail "$1" | sed 1d) architecture="386"
test $free_space -ge $min_size elif [ -n "$(uname -m | grep armv7)" ]; then
} architecture="arm7"
elif [ -n "$(uname -m | grep armv6)" ]; then
if is_there_enough_space /tmp; then architecture="arm6"
local tmpdir=/tmp
elif is_there_enough_space /var; then
local tmpdir=/var
elif is_there_enough_space /; then
local tmpdir=/
elif is_there_enough_space /home; then
local tmpdir=/home
else else
ynh_die "Insufficient free space to continue..." architecture="unknown"
fi fi
echo $architecture
echo "$(mktemp --directory --tmpdir="$tmpdir")"
} }
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -27,6 +27,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url="/"
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
architecture=$(ynh_detect_arch)
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -61,13 +62,6 @@ ynh_script_progression --message="Finding an available port..." --weight=1
port=$(ynh_find_port --port=8181) port=$(ynh_find_port --port=8181)
ynh_app_setting_set --app=$app --key=port --value=$port ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -76,6 +70,13 @@ ynh_script_progression --message="Configuring system user..." --weight=1
# Create a 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"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -83,10 +84,10 @@ ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" #chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#================================================= #=================================================