-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Composer Question #2639
Comments
Did you install it globally, or just for that user? |
To be honest, this is my first experience with composer, but this is the way it was installed:
|
You shouldn't need to pave the server. Try the following:
If you install composer again as your regular web user, and it gives you a permission denied error, just rm whatever composer directory it's choking on. (Composer sticks some cache folders in various directories, depending on your distro.) |
Okay, I removed composer.phar and .composer from my home dir. I tried installing composer again, and I'm getting access denied trying to write to the /var/www/snipeit dir. I see in #2168 you mention that root probably owns the folder. I checked, and it looks like www-data is the owner. Is that fixed by changing the permissions to allow the user I'm logged in as to write to that dir? I tried searching around on running composer as www-data, but the lack of results leads me to believe that might not be the way to do it. |
Can you show me the specific message? |
and here is the permissions from the web dir
|
Can you run:
and tell me what you see? |
|
What user are you logged in as now? (Type |
The user is "snipe" |
Is |
Ah, it's not. Is adding |
You should be able to add snipe to the www-data group (just don't do it the other way around, adding the www-data user to the snipe group.) |
Thanks a lot for your help, especially since these are just OS related questions. |
Did you get it working then? |
I just got the chance to try it actually, I assumed it would have worked, but it throws the same error as before. However, I do see this line in the |
Well, the tricksy bit is that composer stashes some caches in other places too. Can you give me the whole line of the latest error? |
It just repeats 3 times and then quits. Here is the whole error:
|
And |
Let's try something else. Try installing composer globally: https://getcomposer.org/doc/00-intro.md#globally So, download composer.phar to wherever. Then try running the composer install for Snipe-IT |
(Using sudo is okay here, since you have to move it to a part of the server that your normal user wouldn't have access to. It won't monkey anything up.) |
When you try to run the composer install for Snipe-IT, however, do NOT run it as sudo or root. Just cd back to your snipe-it installation directory and run |
Okay, I installed it globally, and when running install, It's getting access denied on various files, so I was deleting them one by one, but I feel like that could take a while. |
Can you show me the output (including the errors?) |
Do me a favor and just remove the vendor directory and re-run |
(Composer is what populates the files in that directory, so it's okay to delete them. When you run composer install again, it will pull them back down.) |
lulz.
|
|
(you could also chown that to your own user.group, versus www-data. The web user never needs to write to it.) |
Get this after creating vendor:
I created that folder, and changed ownership to www-data like I did with vendor, and then get this:
|
You should definitely never need to create folders within the
(assuming your current user is |
There it goes. it's installing them now. |
Oh thank fucking christ. |
ha! now, the good stuff:
|
That one's easy.
|
(That's actually in the docs: https://snipe-it.readme.io/docs/configuration#required-set-directory-permissions ) |
Just so you can understand how permissions work a little better, the only things that really need to be owned by www-data are directories that need to be written to by the web server itself (aka via the web interface). So, log files (because when an error happens, it's your web server that logs that to a file), any directories where files would be uploaded to (since your web server is technically the user who is putting those files there), backups (since the web server is the user generating those backups and storing them), etc. Everything else can be owned by snipeit (or whatever your normal user is). But nothing inside your snipeit install directory should be owned by root. Does that make a little more sense? |
Yeah, that makes sense. What would be the situation where the weird errors mentioned in the docs about composer? The reason for asking is, at the end of the deployment, is there any thing I can do to try and test to see those issues would present themselves? |
If composer ran this time, it should be able to run every time, as long as you don't go monkeying around with the permissions. The weird errors mentioned in the docs happen when you run composer as root, because then the vendors dir is owned by root, and if you try to run it as a normal user ever, you're going to get stuff exploding all over the place. Most of the time, people run it as root, and then forget they did, and then they don't understand why composer is shitting itself all over their website. It's very simple though - if you run composer as root, all of the files it pulls down will be owned as root, which means only root can ever overwrite them. |
Ah, okay, I see. Thanks for helping out with this. |
No problem - are you all sorted now? Can I close this ticket? |
Yup, Okay to close |
Woot. |
Expected Behavior (or desired behavior if a feature request)
Run composer as non root
Actual Behavior
Accidentally ran composer as root
Please confirm you have done the following before posting your bug report:
Please provide answers to these questions before posting your bug report:
app/storage/logs
and your webserver's logs.I'm not getting any errors yet, but I goofed and used sudo when running "php composer.phar install --no-dev --prefer-source" (I think I originally got an access denied error when I didn't used sudo).
Is there any way to fix the permissions changed, or should I rebuild the server before getting too far in our implementation?
The text was updated successfully, but these errors were encountered: