How to install composer globally on a Linux PHP app service? - linux

I have an app service for my PHP 8.0 application. Azure will only allow me to use Linux which is fine, but I'm having trouble installing composer globally.
Because only files inside of /home are persisted I'm not sure where I can place the resulting composer.phar file, in such a way that it is included in the PATH, and I can't find any relevant documentation, only relevant discussion I could find was this: https://learn.microsoft.com/en-us/answers/questions/3638/installing-composer-on-azure-app-service.html but it still didn't help.
Could anyone tell me either where to put composer.phar or whether there's a way to edit my path to point towards /home/composer.phar?
Thanks!

I found the right way.
If I echo'ed PATH it told me that /home/site/wwwroot was included in the PATH, so all that's needed is to move the composer file into wwwroot doing something like mv composer.phar /home/site/wwwroot/composer.

Related

What is the proper way of using npm in root environment?

I'm currently setting up a Parse Server with AWS EC2 instance, where I've been using Nginx and Elastic IP to manage SSL certificates.
Through different guides I've reached the solution of put the node app at /var/www/parse-server, but they say I should do 'npm init' in this directory, which is obviously owned by root (and fails because of permissions, of course).
My question is about the proper way of manipulate the app files in this root path, specially because 'sudo npm init' has conflicts with packages when the project keep moving on.
Should I use 'sudo su' and proceed with the install? I tried to do that, but npm init isn't recognized as a command. I haven't tried with --prefix yet, because I wanted to make sure before do that.
Should I use another directory to keep my application working? I've though that, but what about Nginx and all the related config?
Should I chown -R the folder to gain ownership of the /var/www/parse-server folder? If I do that, what about permissions later on?
I found two workarounds for this:
chown -R to change the directory owner to my own user. This works but i think is not the proper way.
Proxy reverse to the specific folder (i'm using nginx, so whoever is watching this thread should be fine with nginx docs)
Thanks to Davi Macedo for solution 1.

threejs build guide unclear

so i need to modify three.js.min and i need to rebuild it to have the changes take effect.
i did it before when it used to be via phyton, but the process & method seems to have changed.
i downloaded node.js as linked here in the quickstart guide: https://github.com/mrdoob/three.js/wiki/Build-instructions, and restarted my pc
this happens when i try to clone threejs as described:
the Quickstart says that i can also "download and unzip" the directory which i already did to work on it, but i am unsure where to place it and where the relative path starts.
so if i use cd ./three.js would the threejs folder be in the c:/programs/nodejs directory? do i need to register it first? am i on the completely wrong path?
sorry if this is a really dumb question, but the guide just does not make sense to me
ok so here are the mistakes i made:
i used the Node.js command window (from programs) instead of the windows cmd
i need to navigate to my threejs root folder containing the package.json file using cd ./nextFolder
now compiled & working without a problem

Spring roo installation

Spring roo seems a convenient tool and I have a chance to try it. I created a linux package so that I can maintain it using the package manager to install or uninstall or share it in my team. The package manager will install the spring-roo to the /opt/spring-roo directory. But when running the roo command it will create a cache directory in the $ROO_HOME(/opt/spring-roo) and generates many small bundle files. But a normal user doesn't have the write access to the /opt/spring-roo. So my question is: is there a way to use another path as a cache directory just like the $HOME/.cache/roo? I noted that there is a config.properties in the $ROO_HOME but I can't figure a way to configure it.
After researching the roo.sh I found I can set the cache dir directly from the roo.sh. So I change it to the user's home, just likeROO_OSGI_FRAMEWORK_STORAGE="$HOME/.cache/spring-roo".

How to get write permission to a /var/lib folder for app installed as a distiubutable package

I'm creating a mono app and I've build up a *.deb installer.
In windows I write quite a bit of configuration information into the program data directory. The linux corollary seems to be /var/lib/[appname]. I've figured out how to create the directories as part of the install package, but when the app goes to run I get an excpetion because the app doesn't have write permission.
How do I get my app to have write permission to the /var/lib/[appname] folder? Is that the correct place to put things like a local db for an app?
It seems the only way to do this is via the postinst script file.
You can use that hook to execute a script to chmod the directories to anything you want. You can find the complete documentation for the postinst file here: https://www.debian.org/doc/manuals/maint-guide/dother.en.html#maintscripts

Call Download node app dependencies from another node application

i have a command tool application developed using node. when pointed over a folder when i run a command it should install the node dependencies specified in the package.json file in the folder. is it possible to do like this.
You need to use
exec = require('child_process').exec;
exec(#your command starts here
But in general you should do googling before asking questions: http://nodejs.org/api/child_process.html
also remember that user under which your tool is executed should have access rights to do so (e.g. root or destination folder owner)
PS: sorry for bad formatting and little text - typed from phone :)

Resources