basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
11.2k stars 440 forks source link

Missing user permissions for docker on AWS ec2 ubuntu #1106

Closed indigotechtutorials closed 1 week ago

indigotechtutorials commented 1 week ago

I just tried to deploy a Ruby on Rails app using the new Kamal 2, I learned that the .env changed to use credentials defined in secrets or a command so thats cool and I had my deploy working correctly until it finished installing docker on AWS and I got a permission denied error. The user account didn't have permissions to access the docker daemon socket. I looked up the error online and quickly found an article which showed a fix. SSH into the server and then run this command sudo usermod -a -G docker $USER Then you have to log out and it should work I did this and verified it worked by running docker ps which previously threw an error

I'm guessing the permission error is because I specified a user other than root, I set my user to "ubuntu" which the aws server was using for a default username.

Anyways the command that fixed it for me could be added into Kamal to reduce the struggle of deploying, I might look into the code and see If it makes sense to add in to the kamal setup script

indigotechtutorials commented 1 week ago

It seems like this was mentioned in the ssh.yml docs

If you are using a non-root user, you may need to bootstrap your servers manually before using them with Kamal

and it lists some helpful commands for setting up the server for non root users so I guess thats all it is.