9
54 Comments

How do you deploy your web app?

Hi,

I'm a Ruby on Rails developer, and I usually use Capistrano to deploy my web apps. At Capistrano, you configure the deploy by YML files, so you need to know well the Capistrano documentation to get it done.

Before the first deploy, I setup Nginx, database, keys, etc. on the server. I need to spend some time at the server console to setup it, attempt to deploy the app multiple times, fix a lot of issues before getting the production app ready.

It's easier on Heroku, but it's more expensive. Is any better way to deploy the web app?

I'm curious how it looks like at other technologies? What technology do you use, and how your deploy looks like? Or do you have a better way at Ruby on Rails?

  1. 4

    AWS Elastic Beanstalk is super easy and quick to deploy. You can either push straight from the repo to publish on production, or if you wanted to use a CI process, AWS also has CodePipeline which can do that.

    1. 2

      I second this. With my setup, all I have to do to deploy is run npm run deploy from the terminal.

      1. 1

        Totally! I have published Nodejs as well as Ruby projects (not Rails, but another framework) to Elastic Beanstalk. Once set up, I am always thrilled at how easy it is to push changes to production. Users don't even realise an update is going on.

        1. 1

          Thanks! Sounds good. I have to check it out!

  2. 3

    Try render - they got your back.
    here's their docs

  3. 2

    I use Heroku and now recently I have purchased the necessary technology to deploy Heroku apps on my own servers.

    The thing is, for most companies the $100 monthly when you're starting out are negligible in comparison to salary costs for running your own servers. And then by the time you reach $3k monthly spend, you are very much locked in.

    Which price point do you consider "expensive"?
    Would 10 Heroku apps hosted on 2 PM web dynos each at $300 monthly be expensive to you?
    Do you have any uptime targets that using Capistrano might jeopardize?
    How high are your CPU and RAM requirements? Do you need bare metal to make things cost effective?

    1. 1

      Yes, 2 PM web dynos each at $300 monthly is expensive for me. Now I usually use Digital Ocean to host my apps. For a start, I pay $10-$20 monthly. I need to run at least two processes: one for the webserver and the second for background jobs. I don't need the bare metal. I'm looking for a time/cost most effective solution.

      1. 1

        So you pay roughly $15 per website. And how many sites at that price point do you run in parallel?

        1. 1

          Now, I have only one site.

  4. 2

    IMO, an infrastructure–as–code tool like Terraform is basically a requirement. Not only is it often easier than managing infrastructure different services' web interfaces, but it also makes your configuration very explicit: it's very easy to see exactly what infrastructure your app depends on.

    I made a blue–green deployment system with Terraform, Packer and nginx. Essentially, Packer builds an image with the newest code on it, and then Terraform spins up a new server using that image and has nginx point to that. Super easy to deploy and roll back, and it's extremely portable to any VPS.

    1. 1

      Cool! Rolling blue green deployments in tf seemed like a nightmare last time I looked into it... Most people separate out their provisioning and deployment steps, I guess if you're mentioning Packer your servers run on ec2 (or similar) and not as containers

      1. 1

        It took a few tries to get right! The tl;dr is that Terraform has a “null resource” that is responsible for updating the nginx configuration.

        My servers are all normal Ubuntu servers on DigitalOcean. I could make an image for the “provisioning” step and use that as the base for the deploy process but I haven’t gotten around to that yet.

  5. 2

    Ansible! It is specifically for this purpose. Ansible lets you define tasks in a playbook to bring your server to a specific state (i.e. nginx installed, config file set up, postgres installed, config file set up, code deployed, migrations run), and then every time you run the playbook again, it'll check the server and intelligently bring it to the state you've defined.

    The really nice part about this is that you can use that same playbook to stand up a virtual machine to do your development on, so that your development VM and production VM end up being configured the same. Make a change on your dev VM to enable a new feature? The next time you deploy that playbook against your production VM, it'll apply that same change. It also makes it trivial to set up a staging server or additional production servers for load balancing.

    This is the approach I take with Nodewood, and it really simplifies production deployments - if it works in the dev VM, it'll work in production.

    1. 1

      I was using Ansible for cloud apps with multiple nodes. In my opinion, it's to advanced tool for new startups.

      1. 1

        Man, disagree. You CAN do some really complex stuff with it, but that doesn't mean you HAVE to. It just means it scales well.

        Is like saying "I was using Python for AI research, it's too advanced a tool for new startups." There are simple ways of using all this stuff.

        If you're writing code, you can string together a few Ansible roles.

  6. 2

    I use Laravel for most applications. For deployments I have two paid services.

    • Forge: creates servers, sets all services up, creates db etc.
    • Envoyer: deploys actual code
    1. 1

      Thank you. It looks like cool stack. Is it possible with Forge and Envoyer to deploy and maintain the production app without using ssh and terminal?

      I found sth similar for Ruby on Rails: https://www.hatchbox.io/

      1. 1

        i must understand maybe im really old and used to other things , but why you don't configure the server manually ?? including the load balancers and all?
        you always have better control on what's is going on on every point in the application

        1. 1

          Now, I do it manually. In my opinion, it's a waste of time. It's not valuable for my customers. It's a job which needs to be done, so I'm looking for a solution which can do the job instead of me.

  7. 1

    I am a big fan of AWS and Heroku. Only problem I have with AWS is its easy to stack up a huge bill.

  8. 1

    I've recently heard about Dokku, I haven't used it yet, but it sounds promising.

  9. 1

    I deploy my website, https://daily-dev-tips.com/ automaticly trough netlify git integration.
    So every push to master will invoke the deployment.

    Must say it's been sooo easy :D

    1. 1

      For static pages, it's a very good solution :)

  10. 1

    I'm a Ruby on Rails developer as well. There are MANY options on how to deploy your app and quite frankly it does depend on the app a bit.

    For my current projects I actually use just 200+ lines of Bash to bootstrap a VM to do git-push like deployments (ala Heroku). I am documenting this in Deployment from Scratch.

    For bigger projects I would personally look either in Capistrano (since it's Ruby) or Ansible (since it fits my model of Bash module <> Ansible module). We used Salt at work, it was fine too.

  11. 1

    www.mediamarkup.com is a .Net Core application (amongst other technologies)

    We use Azure Devops for automated build and deployments and also host our Git repos.

    Azure Devops is great for almost any type of deployment.

    I should add that the website (not app) is Wix, so you would need to signup and check it out to get the full experience 😃

  12. 1

    Firebase hosting.
    Cloud Functions, Cloud Run for backend.
    Gitlab CI/CD (the best part)
    Cloudflare CDN.

  13. 1

    With https://www.colorsandfonts.com I drag and drop the folder on netlify..

    1. 2

      I've been using your website and it helps a lot! Thank you :) One little curious question.. How did you do the animated blue color footer on the website? Looks cool..

      1. 1

        How cool engi! Thank you so much!

        Look I made a gist here with the code for the background.

        https://gist.github.com/michael-andreuzza/59e1f6478abc26ab350b5fe06962c0c8

    2. 1

      It's a good solution for the landing pages.

  14. 1

    I use Vercel. I only push to github, Vercel will detect the branch and build it. It deploys to production when merged on master.

    1. 1

      Thanks! I haven't heard about it.

  15. 1

    Gitlab CI with Capistrano, easy and free 👌👌

  16. 1

    I make web apps with flutter which i host on Firebase Hosting by Google its free, check if you can host your ruby on rails project there.

    1. 1

      Any good tutorials on this?

      1. 1

        Actually i teach on youtube you can lern from this before this make sure to setup flutter by visiting flutter.dev get started https://www.youtube.com/watch?v=M7z-Zctu6vA&list=PLBxWkM8PLHcqtJvdYz0rR23XblqiHHtaT

  17. 1

    I'm a big fan of AWS Codestar. They have an integrated continuous integration/continuous deployment system that's free/cheap

  18. 1

    Gitlab CI!

    Free, works great, can work with any deployment option. Use it for anything from deploying to Cloud Run, Kubernetes, even doing code signing for Desktop apps

  19. 1

    Checkout cloud66.com they have a nice solution for deploying rails applications to any vps. It makes it as easy to deploy as it is with heroku.

    1. 1

      Thanks, I will check it out.

  20. 1

    I swear by Heroku, it takes seconds to set up an instance and automatic deploys is ideal for quick testing.

  21. 1

    I'm using DigitalOcean's managed Kubernetes as Heroku is too expensive for my needs. In there I run my Ruby on Rails app, with a nginx sidecar for the static assets and the Puma application server.

    For the database I use Kubernetes on a separate Droplet as the managed one is pricy and running the database in Kubernetes is not so much fun.

    1. 1

      This comment was deleted 3 years ago.

      1. 1

        For me it just adds a layer of complexity that isn't necessary for my use case of just having one database running. I don't run big clusters, or spin up a database for each customer where having them managed in a central place / infra would make things nicer. Then I have to deal with making things properly stateful, have to deal with backups done from within Kubernetes etc.

        It's just easier to run it on a normal VM, run pg_dump for backups in a cronjob and be done with it. In case something goes wrong I'd have to deal with the complexities of Postgres + the complexities of Kubernetes. Of course if everything is working nicely it's all good but things get complex when things go wrong.

        1. 1

          This comment was deleted 3 years ago.

  22. 1

    I have the perfect solution for you! There is a tool called Dokku which is essentially a self hosted Heroku. They even have a pre-built image on DigitalOcean, so you can one click install it. From that point on, you just have to run a few commands to create the app, set up env variables, deploy, set up custom domains, and letsencrypt.

    1. 1

      I was using it about 3 years ago for staging apps. There were some issues with performance. Is it production-ready now?

      1. 2

        Yep, I've been using it happily for a while now! Also the creator/maintainer is pretty much always online and willing to help if you have any issues. I personally use the Dockerfile deploy method since its 1.5x faster. If you do go with Dockerfile, don't forget to set the port mapping

        1. 1

          Thanks, I should give Dokku one more chance :)

  23. 1

    For Ruby on Rails I use either Heroku or AWS Elastic Beanstalk to not worry about the devops :-)

    1. 1

      I have never used AWS Elastic Beanstalk. How is it different than Heroku?

      1. 1

        It requires some setup initially (you need to choose your server size like you would choose dyno size using their services), but once you get hold of it it's basically the same — it even comes with a "eb" command to deploy and manage the environment. One thing that is different is that services are not that tightly interconnected as they are with Heroku — it takes a bit of practice and time to feel confident with Beanstalk. It's much more elastic though and scalable, because you have much more granular control over the stack, services, logging, etc. Also Beanstalk is a bit complicated with Rails6 at the moment, so just stick with Rails5 if you can :D

        My advice? Heroku for small/cheap projects that don't require compliance with privacy/security (or for testing and pipeline, which is superb in Heroku), but for more scaled projects that require more security/compliance AWS is good because it is one of the few GDPR-compliant providers (Google Cloud apparently is not for some reason from what I heard).

        I host my company website https://cubitoo.com on Heroku, which costs $7/month and my cofounded startup https://vila-health.com uses AWS which costs around $200/month, but has multiple databases, 3 environments, encryption and all the security goodies you are required in the digital health space.

        1. 2

          Thanks for the detailed explanation

  24. 1

    This comment was deleted 3 years ago.

Trending on Indie Hackers
After 10M+ Views, 13k+ Upvotes: The Reddit Strategy That Worked for Me! 42 comments Getting first 908 Paid Signups by Spending $353 ONLY. 24 comments 🔥Roast my one-man design agency website 21 comments I talked to 8 SaaS founders, these are the most common SaaS tools they use 19 comments What are your cold outreach conversion rates? Top 3 Metrics And Benchmarks To Track 19 comments Hero Section Copywriting Framework that Converts 3x 12 comments