New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download sources during installation and upgrade to 1.0.36 #38
Conversation
Upgrade to 1.0.36
Finally implemented dependencies download during install/upgrade with composer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thank you for the package update, I've put my remarks but didn't test the package yet. Other thing LGTM.
In a more general notice while managing the dependency throught composer seems a good idea it not always the case. Composer take a lot (and I mean a lot) of RAM during install so the kanboard install will probably fail on small hardware. Related bug: https://dev.yunohost.org/issues/363 (plus there is a bunch of open bug for failed roundcube install because of this).
Did you notice that the link https://kanboard.net/kanboard-latest.zip always contain dependency while the github one don't ? Maybe it would be better to use this link and don't install composer at all. But I don't like that we can't point a specific version :/
# Uncompress | ||
sudo unzip -qq kanboard.zip -d .. | ||
# Create tmp directory and install app inside | ||
TMPDIR=$(ynh_mkdir_tmp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is deprecated, use mktemp since it's bash native.
sudo sudo -u "$USER" $@ | ||
fi | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so over-engineered IMO. This complicate the script for exactly no gain, the whole script is run as "admin" user by YunoHost and this is used only to run thing as admin. Plus I don't think apps script should contain such generic helper, if one is really needed it should be in yunohost core.
exec_composer() { | ||
local AS_USER=$1 | ||
local WORKDIR=$2 | ||
shift 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shift is useless here
# update dependencies to create composer.lock | ||
exec_composer "$AS_USER" "$DESTDIR" install --no-dev \ | ||
|| ynh_die "Unable to update application core dependencies" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think exec_composer and init_composer function should be merged since:
- they are never called independently
- they can be simplified by removing all the exec_as thing
local AS_USER=${2:-admin} | ||
|
||
# install composer | ||
curl -sS https://getcomposer.org/installer \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not the best way to install composer, the composer website provide a way more secure script here: https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
Thanks for taking time to review the PR! |
Cool, I didn't know it worked. Using the zip of kanboard.net with the dependencies was the way I updated the package before (as noted is the readme). |
Just did another commit: now downloading Kanboard sources from kanboard.net website, avoiding the need to use composer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
wget -q -O "$archive" "$APPLICATION_SOURCE_URL" \ | ||
|| ynh_die "Unable to download application archive" | ||
# Here we process with unzip as would tar "--strip-component" option | ||
unzip -qq "$archive" -d "$DESTDIR" && rm "$archive" && f=("$DESTDIR"/*) && mv "$DESTDIR"/*/* "$DESTDIR" && rm -f "${f[@]}"/.htaccess && rmdir "${f[@]}" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow! Why is this needed? I remember having to deal with the lack of strip-component option in unzip before but I don't remember how I solved it.
Here is how I handle the gogs zip archive for example: https://github.com/YunoHost-Apps/gogs_ynh/blob/master/scripts/_common.sh#L32-L47
If it's really needed please move it to its own function since it's not obvious how it work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When looking for a substitute to --strip-component, I also stumbled upon rsync-based solutions. I do prefer using bash-only when possible.
But I agree it's ugly, so I'll make it cleaner in a specific function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok so it was probably Gogs. But since rsync is installed in debian like unzip why bother? I prefer not to have complicated rm -f
while rsync do the job very well.
@@ -46,9 +46,9 @@ ynh_app_setting_set $app adminusername $admin | |||
ynh_app_setting_set $app is_public $is_public | |||
|
|||
# Create tmp directory and install app inside | |||
TMPDIR=$(ynh_mkdir_tmp) | |||
TMPDIR=`mktemp -d` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little picky here but could you use $(command) instead of backquotes theses are deprecated. Also consistency with the rest of the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I fell into old habits here :-)
Ok for me, tested the upgrade on my production instance yesterday without issue. I'd like to have another person to test it before merging since it's an official app. |
* Create check_process * Syntax fix * Download sources during installation and upgrade to 1.0.36 (YunoHost-Apps#38) * Download sources (except dependencies) during installation and upgrade to 1.0.35 * Download dependencies during installation Upgrade to 1.0.36 * Download kanboard zip from kanboard.net website * Take review into account
No description provided.