Inist-CNRS / pkgi

Pkgi permet la création d'environnements applicatifs indépendants et mutualisés sous Debian.
http://www.pkgi.net
5 stars 3 forks source link

apache2 and nodejs modules incompatibility #8

Open parmentf opened 11 years ago

parmentf commented 11 years ago

When installing only apache2, php, and nodejs, you can't start apache2. Probable cause: nvm bad bash syntax (nvm is installed from the last version in github, it may have been working before, not no more now).

francois@francois-Aspire-5742G:~/dev/test-pkgi$ etc/init.d/apache2 start
etc/init.d/apache2: 20: /home/francois/dev/test-pkgi/nvm/nvm.sh: function: not found

Here is my pkgi.env:

export APPNAME="AN"
export AN_MODULES="core,apache,php,nodejs"
export AN_HOME="/home/francois/dev/test-pkgi"
export AN_USER="francois"
export AN_GROUP="francois"
export AN_ADMIN_MAIL="francois@francois-aspire-5742g"
export AN_VERSION="dev"
export AN_OPTIMIZATION="normal"
export AN_APACHE_LISTEN_PORT="19996"
export AN_APACHE_LISTEN_INTERFACE="0.0.0.0"
export AN_APACHE_URL_ROOT="http://francois-Aspire-5742G:19996"
export AN_APACHE_BEHIND_REVERSE_PROXY="no"
export AN_APACHE_MODS="authz_groupfile,auth_basic,authz_user,authn_file,authz_host,actions,alias,autoindex,dir,env,mime,negotiation,setenvif,rewrite"
export AN_APACHE_OPTIONS="htaccess"
export AN_NODEJS_HOME=""
export AN_NODEJS_PORT="42068"
export AN_NODEJS_VERSION="v0.8.17"

nodejs module uses nvm, and add some inclusions in etc/profile.d, which crash the etc/init.d apache2 script.

parmentf commented 11 years ago

À mon avis (je reviens au français, on est dans pkgi, que diable!) on pourrait ajouter ce petit bout de code à pkgi/nodejs/bin/pkgi-install-nodejs:

# Fix syntax problems
mv <?php echo getenv('APPNAME_HOME') ?>/nvm/nvm.sh <?php echo getenv('APPNAME_HOME') ?>/nvm/to_fix_nvm.sh
cat <?php echo getenv('APPNAME_HOME') ?>/nvm/to_fix_nvm.sh | \
sed -e 's/function rc_nvm_version {/rc_nvm_version () {/' | \
sed -e 's/if \[\[ "\$PATTERN" == v[?][*]\.[?][*]\.[?][*] \]\];/if [ "$PATTERN" = "v?*.?*.?*" ];/' | \
sed -e 's/if \[\[ -d "\$NVM_DIR\/\$VERSION" \]\];/if [ -d "$NVM_DIR\/$VERSION" ];/' | \
  > <?php echo getenv('APPNAME_HOME') ?>/nvm/nvm.sh

Par contre, je n'ai pas refait un test complet pour voir si ça ne casse rien.

kerphi commented 11 years ago

Oui tant qu'a faire si tu as corrigé le problème, on pourrait simplement forker le dépôt git de nvm et appliquer ton patch dessus. Ensuite pkgi-install-nodejs n'aurait plus qu'a se baser sur ce fork patché. Ca évite ainsi les sed dans le code qui alourdissent sa lisibilité.

On Thu, Jan 31, 2013 at 3:51 PM, François Parmentier < notifications@github.com> wrote:

À mon avis (je reviens au français, on est dans pkgi, que diable!) on pourrait ajouter ce petit bout de code à pkgi/nodejs/bin/pkgi-install-nodejs:

Fix syntax problems

mv <?php echo getenv('APPNAME_HOME') ?>/nvm/nvm.sh <?php echo getenv('APPNAME_HOME') ?>/nvm/to_fix_nvm.sh cat <?php echo getenv('APPNAME_HOME') ?>/nvm/to_fix_nvm.sh | \ sed -e 's/function rc_nvm_version {/rc_nvmversion () {/' | \ sed -e 's/if [[ "\$PATTERN" == v[?][].[?][].[?][] ]];/if [ "$PATTERN" = "v?.?.?_" ];/' | \ sed -e 's/if [[ -d "\$NVM_DIR\/\$VERSION" ]];/if [ -d "$NVM_DIR\/$VERSION" ];/' | \

<?php echo getenv('APPNAME_HOME') ?>/nvm/nvm.sh

Par contre, je n'ai pas refait un test complet pour voir si ça ne casse rien.

— Reply to this email directly or view it on GitHubhttps://github.com/kerphi/pkgi/issues/8#issuecomment-12945661.

parmentf commented 11 years ago

J'ai forké nvm, j'ai testé à la main: on peut lancer apache et nodejs en utilisant ce fork. Je pushe les modifs permettant de prendre en compte le bon nvm. On verra plus tard pour le tag et le site pkgi.net?