1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/tandoor_ynh.git synced 2024-09-03 20:35:56 +02:00

Merge pull request #1 from YunoHost-Apps/fixes

This commit is contained in:
Navan Chauhan 2022-08-08 07:44:28 -04:00 committed by GitHub
commit f45eb4fd18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 136 additions and 70 deletions

23
LICENSE
View file

@ -1,4 +1,21 @@
File containing the license of your package. MIT License
More information here: Copyright (c) 2022 YunoHost-Apps
https://yunohost.org/packaging_apps_guidelines#yep-1-3
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -46,6 +46,7 @@ a public page.
**Shipped version:** 1.3.3~ynh1 **Shipped version:** 1.3.3~ynh1
**Demo:** https://app.tandoor.dev/accounts/login/?demo **Demo:** https://app.tandoor.dev/accounts/login/?demo
## Screenshots ## Screenshots
@ -54,19 +55,6 @@ a public page.
## Disclaimers / important information ## Disclaimers / important information
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* requiring a full dedicated domain ?
* architectures not supported ?
* not-working single-sign on or LDAP integration ?
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?
* Known limitations: * Known limitations:
* Requires a full dedicated domain for now * Requires a full dedicated domain for now

View file

@ -44,7 +44,8 @@ a public page.
- 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/) - 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/)
- Many more like recipe scaling, image compression, printing views and supermarkets - Many more like recipe scaling, image compression, printing views and supermarkets
**Version incluse :** 1.3.3~ynh1 **Version incluse :** 1.3.3~ynh1
**Démo :** https://app.tandoor.dev/accounts/login/?demo **Démo :** https://app.tandoor.dev/accounts/login/?demo
@ -54,19 +55,6 @@ a public page.
## Avertissements / informations importantes ## Avertissements / informations importantes
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* requiring a full dedicated domain ?
* architectures not supported ?
* not-working single-sign on or LDAP integration ?
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?
* Known limitations: * Known limitations:
* Requires a full dedicated domain for now * Requires a full dedicated domain for now

View file

@ -1,30 +1,20 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path"
is_public=1 is_public=1
language="fr"
admin="john"
password="1Strong-Password"
port="666" port="666"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=0
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=CommitHash
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0 port_already_use=0
change_url=1 change_url=0
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none

View file

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=gunicorn daemon for recipes Description=Tandoor, smart recipe mangement
After=network.target After=network.target
[Service] [Service]
@ -7,10 +7,12 @@ Type=simple
Restart=always Restart=always
RestartSec=3 RestartSec=3
User=__APP__ User=__APP__
Group=www-data Group=__APP__
WorkingDirectory=__FINALPATH__ WorkingDirectory=__FINALPATH__
EnvironmentFile=__FINALPATH__/.env EnvironmentFile=__FINALPATH__/.env
ExecStart=__FINALPATH__/venv/bin/gunicorn --error-logfile /tmp/gunicorn_err.log --log-level debug --capture-output --bind 127.0.0.1:__PORT__ recipes.wsgi:application ExecStart=__FINALPATH__/venv/bin/gunicorn --bind 127.0.0.1:__PORT__ recipes.wsgi:application
Restart=on-failure
RestartSec=10
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -1,16 +1,3 @@
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* requiring a full dedicated domain ?
* architectures not supported ?
* not-working single-sign on or LDAP integration ?
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?
* Known limitations: * Known limitations:
* Requires a full dedicated domain for now * Requires a full dedicated domain for now

View file

@ -16,7 +16,7 @@
"userdoc": "https://docs.tandoor.dev", "userdoc": "https://docs.tandoor.dev",
"code": "https://github.com/TandoorRecipes/recipes" "code": "https://github.com/TandoorRecipes/recipes"
}, },
"license": "free", "license": "MIT",
"maintainer": { "maintainer": {
"name": "Navan Chauhan", "name": "Navan Chauhan",
"email": "tandoor@navan.email" "email": "tandoor@navan.email"
@ -37,7 +37,10 @@
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"default": true "default": false,
"help": {
"en": "Should the login be exposed to public?"
}
} }
] ]
} }

View file

@ -5,14 +5,99 @@
#================================================= #=================================================
# dependencies used by the app (must be on a single line) # dependencies used by the app (must be on a single line)
pkg_dependencies="git curl python3 python3-pip python3-venv libpq-dev postgresql libsasl2-dev python3-dev libldap2-dev libssl-dev" pkg_dependencies="git curl python3 python3-pip python3-venv libpq-dev postgresql libsasl2-dev python3-dev libldap2-dev libssl-dev libffi-dev autoconf build-essential"
nodejs_version=16 nodejs_version=16
py_required_version=3.9.2
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
# Install specific python version
# usage: myynh_install_python --python="3.8.6"
# | arg: -p, --python= - the python version to install
myynh_install_python () {
# Declare an array to define the options of this helper.
local legacy_args=u
local -A args_array=( [p]=python= )
local python
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
# Check python version from APT
local py_apt_version=$(python3 --version | cut -d ' ' -f 2)
# Check existing built version of python in /usr/local/bin
if [ -e "/usr/local/bin/python${python:0:3}" ]
then
local py_built_version=$(/usr/local/bin/python${python:0:3} --version \
| cut -d ' ' -f 2)
else
local py_built_version=0
fi
# Compare version
if $(dpkg --compare-versions $py_apt_version ge $python)
then
# APT >= Required
ynh_print_info --message="Using provided python3..."
py_app_version="python3"
else
# Either python already built or to build
if $(dpkg --compare-versions $py_built_version ge $python)
then
# Built >= Required
ynh_print_info --message="Using already used python3 built version..."
py_app_version="/usr/local/bin/python${py_built_version:0:3}"
else
ynh_print_info --message="Installing additional dependencies to build python..."
pkg_dependencies="${pkg_dependencies} tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libbz2-dev libexpat1-dev liblzma-dev wget tar"
ynh_install_app_dependencies "${pkg_dependencies}"
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin
ynh_print_info --message="Building python (may take a while)..."
# Store current direcotry
local MY_DIR=$(pwd)
# Create a temp direcotry
tmpdir="$(mktemp --directory)"
cd "$tmpdir"
# Download
wget --output-document="Python-$python.tar.xz" \
"https://www.python.org/ftp/python/$python/Python-$python.tar.xz" 2>&1
# Extract
tar xf "Python-$python.tar.xz"
# Install
cd "Python-$python"
./configure --enable-optimizations
ynh_exec_warn_less make -j4
ynh_exec_warn_less make altinstall
# Go back to working directory
cd "$MY_DIR"
# Clean
ynh_secure_remove "$tmpdir"
# Set version
py_app_version="/usr/local/bin/python${python:0:3}"
fi
fi
# Save python version in settings
ynh_app_setting_set --app=$app --key=python --value="$python"
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -136,21 +136,27 @@ chown $app:$app "$final_path/.env"
#================================================= #=================================================
ynh_script_progression --message="Setting up Tandoor venv..." --weight=1 ynh_script_progression --message="Setting up Tandoor venv..." --weight=1
ynh_exec_as $app python3 -m venv "$final_path/venv" if [[ $(ynh_get_debian_release) == "bullseye" ]]; then
py_app_version="python3"
else
myynh_install_python --python="$py_required_version"
fi
ynh_exec_as $app $py_app_version -m venv "$final_path/venv"
ynh_script_progression --message="Installing dependencies via pip..." --weight=4 ynh_script_progression --message="Installing dependencies via pip..." --weight=4
pushd "$final_path" pushd "$final_path"
ynh_exec_as $app "$final_path/venv/bin/pip3" install -r requirements.txt ynh_exec_warn_less ynh_exec_as $app "$final_path/venv/bin/pip3" install -r requirements.txt
popd popd
ynh_script_progression --message="Building frontend..." --weight=5 ynh_script_progression --message="Building frontend..." --weight=5
pushd "$final_path/vue" pushd "$final_path/vue"
ynh_use_nodejs ynh_use_nodejs
yarn install ynh_exec_warn_less yarn install
yarn build ynh_exec_warn_less yarn build
popd popd
ynh_script_progression --message="Running migrations and generatic static files..." --weight=2 ynh_script_progression --message="Running migrations and generating static files..." --weight=2
pushd "$final_path" pushd "$final_path"
# load environment variables # load environment variables
export $(cat "/var/www/$app/.env" |grep "^[^#]" | xargs) export $(cat "/var/www/$app/.env" |grep "^[^#]" | xargs)
@ -182,7 +188,7 @@ ynh_use_logrotate
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Smart recuoe management" --log="/var/log/$app/$app.log" yunohost service add $app --description="Smart recipe management" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -115,7 +115,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" yunohost service add $app --description="Smart recipe management" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -181,7 +181,7 @@ ynh_use_logrotate --non-append
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" yunohost service add $app --description="Smart recipe management" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE