I use Dokku to push the multiple Micro Services that power my blog www.wisdomtoinspire.com (which are hosted in a Digital Ocean server)
Initially, I worked mostly on single computer which I used to set up Dokku on Digital Ocean and set my initial SSH keys etc
Recently I wanted to push a new Micro Service (which is deployed via Dokku on my digital Ocean machine) on a different computer but I ran into multiple issues.
I then SSHed into my Digital Ocean machine, and manually copied the new SSH into ~/.ssh/authorized_keys and then assumed I need to copy it into /home/dokku/.ssh/authorized_keys as Dokku might use it. I also switched to the "dokku" user (using "su dokku") and added the key to "~/.ssh/authorized_keys"
Assuming this would fix the issues I was having trying to push my app to the Dokku remote, I pushed via "git push dokku master"
And kept getting this error:
fatal: 'appname' does not appear to be a git repository
fatal: Could not read from remote repository.
I then dug around and came across these issue on Dokku's Github:
https://github.com/dokku/dokku/issues/1608 (Gitreceive doesn't work)
This comment struck out:
"Guess there was a bug in how you initially setup your keys. The dokku user is meant to be managed solely by sshcommand, and you aren't supposed to "ssh" in as that user, hence why things seemed to break for you."
Basically, it means that I should not try and add new SSH keys like the way I did. Instead I should remotely do it from my machine like it's mentioned in this article https://www.digitalocean.com/community/questions/dokku-add-new-ssh-key
i.e. I undid all those manual keys I manually copied in my Digital Ocean server and from my local computer I ran this:
cat /path/to/public_key | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"
Read more here (in the SSH command part)
http://off-the-stack.moorman.nu/2013-11-23-how-dokku-works.html
Now when you try "git push dokku master" it should start pushing your app to Digital Ocean using Dokku.
But I then ran into this issue:
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@wisdomtoinspire.com:thumby'
:(
But I knew the above "pre-receive hook declined" usually appear when something goes wrong with the install and launch via npm. So I just enabled Dokku tracing like so "dokku trace off" (http://dokku.viewdocs.io/dokku/troubleshooting/) and fixed all my issues and my Service was good to go!
Hope this helps someone.
Happy Coding!
Dokku uses Docker and is a Free open source Heroku alternative which makes a Microservices architecture possible |
Initially, I worked mostly on single computer which I used to set up Dokku on Digital Ocean and set my initial SSH keys etc
Recently I wanted to push a new Micro Service (which is deployed via Dokku on my digital Ocean machine) on a different computer but I ran into multiple issues.
- I assumed that all I had to do was clone the GIT repo, set my Dokku remote (after creating a Dokku App on the server) and then pushing via "git push dokku master"
- But I could not access the server. So I create a new SSH key with the same email I used previously when I set up the server and stored it in "id_rsa.pub"
I then SSHed into my Digital Ocean machine, and manually copied the new SSH into ~/.ssh/authorized_keys and then assumed I need to copy it into /home/dokku/.ssh/authorized_keys as Dokku might use it. I also switched to the "dokku" user (using "su dokku") and added the key to "~/.ssh/authorized_keys"
Assuming this would fix the issues I was having trying to push my app to the Dokku remote, I pushed via "git push dokku master"
And kept getting this error:
fatal: 'appname' does not appear to be a git repository
fatal: Could not read from remote repository.
I then dug around and came across these issue on Dokku's Github:
https://github.com/dokku/dokku/issues/1608 (Gitreceive doesn't work)
This comment struck out:
"Guess there was a bug in how you initially setup your keys. The dokku user is meant to be managed solely by sshcommand, and you aren't supposed to "ssh" in as that user, hence why things seemed to break for you."
Basically, it means that I should not try and add new SSH keys like the way I did. Instead I should remotely do it from my machine like it's mentioned in this article https://www.digitalocean.com/community/questions/dokku-add-new-ssh-key
i.e. I undid all those manual keys I manually copied in my Digital Ocean server and from my local computer I ran this:
cat /path/to/public_key | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"
Read more here (in the SSH command part)
http://off-the-stack.moorman.nu/2013-11-23-how-dokku-works.html
Now when you try "git push dokku master" it should start pushing your app to Digital Ocean using Dokku.
But I then ran into this issue:
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'dokku@wisdomtoinspire.com:thumby'
:(
But I knew the above "pre-receive hook declined" usually appear when something goes wrong with the install and launch via npm. So I just enabled Dokku tracing like so "dokku trace off" (http://dokku.viewdocs.io/dokku/troubleshooting/) and fixed all my issues and my Service was good to go!
Hope this helps someone.
Happy Coding!
No comments:
Post a Comment