1

I lost the access to a droplet where I am running a rails 5 app that I've deployed with Capistrano. The stack of technologies I am using is

-Ruby 2.3.0 (RVM 2.9.1)
-Rails 5.0.1
-Puma
-Capistrano 3.7.2 (the first time I deployed the app I've used 3.6.0,                     but I was getting an error and I decided to upgrade it)
-Postgresql
- Nginx

I am able to take an snapshot and recreate the server and get the access again. However I am not able to make the app work again.

First things first, these are the steps I made

  1. Take an snapshot of the server
  2. Create a droplet based on the spanshot I did before
  3. Setup access to the server (the user I used for deployment is there and I didn't need to do anything)

While I was trying to deploy Capristano I was getting an error that I didn't have access permissions to a folder o the folder didn't exists (the error was I haven't enough memory), but it turned out that I solved this adding swap memory.

Then I was getting an error that there was another puma.sock instance (or something like that), and I solved deleting the files from /apps/myapp/shared/tmp

Now it seems that when I try to deploy the app, The app does not have access to the database (the database is there with all the data)

Has anyone done something similar? is there a more magical/easy way?

agusgambina
  • 6,229
  • 14
  • 54
  • 94

2 Answers2

2

Finally I was able to solve it. The problem was that I needed to add this line of config to my deploy.rb file

set :linked_dirs, %w{tmp/pids tmp/sockets log}

the lack of that line was causing that puma could not deploy. The message was something like this

Socket 'already in use'

agusgambina
  • 6,229
  • 14
  • 54
  • 94
0

is there a more magical/easy way?

I would suggest you to use heroku over digital ocean if you dont have alot of experience working with linux server configurations, its a lot more "magical and easy" and its free for basic stuff

if you choose to keep using digital ocean, i would make sure rails is working on the correct ip address, take a look at this guide: https://www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-puma

Eduardo Veras
  • 961
  • 1
  • 7
  • 20
  • I use heroku as staging, but for production is more expensive than what I was looking for. Also I would like to learn, but since this is urgent I have to post the question here. – agusgambina Feb 23 '17 at 15:59