Skip to content
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

Add a "Deploy to Digital Ocean" button. #127

Open
andrewculver opened this issue May 6, 2022 · 5 comments
Open

Add a "Deploy to Digital Ocean" button. #127

andrewculver opened this issue May 6, 2022 · 5 comments
Assignees

Comments

@andrewculver
Copy link
Contributor

Looks like both PostgreSQL and Redis are configured under "databases".

@gazayas
Copy link
Contributor

gazayas commented May 10, 2022

As you can tell by the number of commits on the branch I started working on, this one's taking some effort to get moving. I've been going back and forth with Digital Ocean's support team for a bit and have gotten to the point where the site is deployed, but I'm getting an error when trying to actually access the site.

Although it's kind of old, I'm putting this video here for reference.

Currently trying to attach a database, since the details in the template I wrote aren't seeming to pick up on production: true.

@gazayas
Copy link
Contributor

gazayas commented May 24, 2022

@andrewculver I’ve spent a decent amount of time on this, and I’ve come to the conclusion that a one-click deploy button is great for static websites and applications early in the development process, but for a number of reasons I don’t think that this is currently a viable option for Bullet Train and that BT devs will be better off simply going the whole 9 yards by setting up everything via Digital Ocean for their Bullet Train.

Here are the reasons why:

  1. You can only make a dev database to experiment with deployment. Upgrading to a production-ready database involves more steps.
  2. You can’t get the DATABASE_URL connection string until after the app successfully deploys. You then grab it from the db settings and set it as an environment variable (in my opinion, Render took care of this better in that you didn’t need to have a successful deployment first).
  3. After you finally set the connection string, THAT’S when you run rake db:migrate in the console. I wanted to automate this step instead of just write it in the console so I asked customer support about it, and they said I needed to use a post-deploy job for this. This isn’t something configured in the deploy template, but in the dashboard. It takes a few steps which can be read in this page in the docs that customer support sent to me.
  4. We usually run bin/dev to spin up multiple processes. In the app platform, which is what one-click deployment uses, each component is one container so we can’t use multiple servers (rails s + sidekiq, etc.). Customer support told me however that this can be done by creating a droplet. If it comes to that, I think Bullet Train devs would just better off configuring a droplet from the start and deploying that way.

I’ve read a bunch of Digital Ocean’s articles in the past and I’m sure their service is great, I just think that trying to use one-click deployment will cause more headaches than anything when a lot else has to be configured just to get things moving. The impression I also get from the one-click docs is that it's used more just to test things out, and not for full-on production.

By the way, here’s the spec I used in the digital-ocean-deployment branch:

spec:
  name: bullet-train
  services:
    - name: web
      git:
        repo_clone_url: https://github.com/gazayas/bullet_train.git
        branch: digital-ocean-deployment
      envs:
        - key: BASE_URL
          # TODO: Replace this with the URL Digital Ocean provides after successfully deploying your application.
          value: http://localhost:3000/
          scope: RUN_AND_BUILD_TIME
        - key: SECRET_KEY_BASE
          scope: RUN_AND_BUILD_TIME
  databases:
    - name: bullet-train-dev
      engine: PG
      production: false

Also, here is the deployed website after attaching the connection string and migrating the database.

@jagthedrummer
Copy link
Contributor

@gazayas @andrewculver It sounds like maybe the thing to do here is to provide a page in the /docs area that describes how to deploy to Digital Ocean. Unless things have changed significantly at DO over the last year?

@gazayas
Copy link
Contributor

gazayas commented Aug 28, 2023

@jagthedrummer I'm open to either solution, thinking back on this one I just remember this being pretty difficult to implement. A lot has changed since then though, so if we want to prioritize it I can take another shot at it.

@jagthedrummer
Copy link
Contributor

@gazayas no need to prioritize it as far as I'm concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants