DEV Community

Cover image for How do you deploy your apps?

How do you deploy your apps?

Jakub Sarnowski on November 30, 2019

What kind of tools and strategies do you use for your apps' deployment Do you do it manually via Git? Do you use a PaaS like Dokku? Or maybe just c...
Collapse
 
yenyih profile image
Jordan Soo Yen Yih • Edited

I just build everything into docker images, then setup docker-compose yaml file for your stack and just upload or git clone the yaml file on the server, and run the docker compose up command. If it works on your development machine, then it will works on production too. That's how docker was born.
For project that need to be scalable, You may take a look at kubernetes.

Collapse
 
jsardev profile image
Jakub Sarnowski

Hey Jordan! Thanks for your reply!

I'm aware of docker and it's a really easy and cool solution for deployment. Unfortunately, I often work on shared servers that do not offer virtualization (docker is not supported) and I need to handle it somehow different.

But for docker-compatible servers - I think it's one of the best solutions out there.

Btw. do you use Kubernetes in your private projects or is it just too much for the task that's need to be done?

Collapse
 
yenyih profile image
Jordan Soo Yen Yih

Shared server? You mean CPanel? As long as you have root access to the server and the server is using Linux, suppose you are able to setup docker.

I didn't use Kubernetes for my private projects. Because I am still not confident enough on my Kubernetes knowledge. But I ever use Docker Swarm which is simpler and lesser features version of Kubernetes. Honestly it is steep learning curve to learn Kubernetes. πŸ˜… Therefore, if you are interested and feel difficult on learning Kubernetes, u may start from docker swarm first.

Thread Thread
 
jsardev profile image
Jakub Sarnowski

Yeah, something like a CPanel. Even if you have root access there, those hosts are often based on a virtualization technology which does not support Docker.

Thanks for suggestions!

Collapse
 
cirphrank profile image
🎧CirphrankπŸ‘£ • Edited

Okay, y'all are saying a whole lot that's seeming alien but here goes nothing, just in case my hunch is right.

Github, Netlify.

Case study: cirphrank.com


Processes:

  1. CREATION>
    XAMP's active, VSCode open. I create my app on VSCode, check on the go till I'm satisfied via chrome, localhost powered by XAMP.

  2. DEPLOYMENT>
    To cut costs, save for clients' and main business' projects, I use Netlify now (so long site's supposed to be static), used to use blogger but that had extreme limitations(optimum for blogs though).

I use Github for Desktop to upload my app to a private repository on my Github account, then I proceed to deploy via Github on Netlify.

-----At this point, I have cirphrank.netlify.com but to go custom I sync DNS and CNAMES for free SSL coverage...

  1. WHY> Why deployment through Github and not Direct Netlify deployment? well for the case of continuous deployment, I still don't get how .TOML is making that possible, and if I want to do that on Direct Netlify Deployment, it will mean that I have to delete site and redeploy from scratch anytime I sight an error, be it just a typo, that I can tackle with the Github private repository by committing new build on the go, and without a second's break, it reflects on the site straight away.

Too much talk already and I'm not even sure if it's under the right topic. Γ‡iao

Collapse
 
jsardev profile image
Jakub Sarnowski

Too much talk already and I'm not even sure if it's under the right topic

It is! Thank you for this extended description! πŸ˜ƒ Your flow is interesting!

Collapse
 
cirphrank profile image
🎧CirphrankπŸ‘£

πŸ€—My pleasure. Thank you too for the platform thread to express.

Collapse
 
mt3o profile image
mt3o

My team uses Jenkins, in future we might adopt CodeStar from AWS. Unfortunately, using 3rd party tools like GitLab in the cloud is not an option for security reasons. Perhaps it's possible, but getting this is way above my pay grade. On the other hand Jenkins gives you most control you can have. All jobs are pipelines in the code, stored in git.

Collapse
 
jsardev profile image
Jakub Sarnowski

Thanks for your reply!

Let me add one more question: you use Jenkins as a deployment tool, but how do you actually deploy your code? How do the scripts look like? Do you just copy your code to the remote server, or git pull on the target server and restart the app? How does it look like?

Collapse
 
mt3o profile image
mt3o • Edited

With Java - the deployment flow is two-part - one is to build the app and it's assets, and execute unit and integration tests, and put artifact into artifactory. Second part is about pushing stuff to one or multiple tomcats. Each time there is a loadbalancer that has to be disconnected, artifact to be deployed, sanity checks (both automated and manual), then loadbalancer reconnects, then we proceed to next server.

For some - flow is ansible based - put service down with systemd, upload new artifact, then bring it up

We work on having aws lambda, im currently finding the best approach, there is a package to be built, deploy as staging, run checks, promote to production build, and discard older versions.

There is also a package of static files that is deployed by just "git checkout".

Thread Thread
 
jsardev profile image
Jakub Sarnowski

Thank you! :)

Collapse
 
phpcoder profile image
Slava Semushin • Edited

In my pet project I do semi-automated deploy. When I merge commits into the prod branch I push it to GitHub. TravisCI performs all kind of checks and invokes the deployment script that executes Ansible that copies WAR file to a server and restarts the service. No docker so far :)

Collapse
 
jsardev profile image
Jakub Sarnowski

Nice! How was your experience with Ansible? Is it easy to use and "get into", or does it have a difficult learning curve?

Collapse
 
phpcoder profile image
Slava Semushin

It was easy to me when I found it (around 5 years ago). But I had experience with puppet at that moment so maybe because of that I had the smooth experience.

Collapse
 
intricatecloud profile image
Danny Perez

At my first job, we used Jenkins to build Android apks, someone downloaded the signed build, and uploaded it to the Play Store. Once tools like Testflight and HockeyApp came out, we had a Jenkins pipeline to manage distribution.

My next job was in a web services context. We had an infrastructure on AWS with hosts managed by Chef. "Deploying" meant that an ops team would need to build out a cookbook for your service which had a lead time of 3-5 months. Then once the infrastructure was set up, the ops team would need to update a manifest.yml file which had the master list of which build/version would be released on which hosts. The file would deploy about 15 minutes after that.

This could only be done in prod after 10pm since it incurred downtime, could only be done by the ops team since it was a fragile process. no one had enough data to figure out whether we had any users around at that time. Some pieces of it were managed by Jenkins, but it was what I would call a manual automated process - a bunch of manual steps that were just as bad as having to deploy manually. ... But the repo for this process was named "devops" so it must have been a devops process, amirite?

My job after that was to build an in house tool to make push button deploys for legacy services and new apps. It is basically a REST API with a front-end around a few deploy.sh scripts - one for backend services that deployed chef cookbooks, another for deploying to S3, and most recently, one for deploying containers to AWS Fargate.

That tool took care of authentication/authorization and integrated with JIRA to manage approval processes.

It also provided a few dashboards for reviewing all deployments for a particular service, what the current version of that service is in each environment - available to read for everyone in the company. Even POs could deploy... from a bar ...with proper approvals.

Nowadays, we use Jenkins to build and test artifacts, upload them to artifactory, deploy through the deployment tool (Jenkins does it for test environments, a human does it in prod). The tool just does an S3 sync to a bucket behind Cloudfront.

Collapse
 
jsardev profile image
Jakub Sarnowski

Wow, this is an extensive description, thanks! πŸ˜„

Collapse
 
mikolaj_kubera profile image
Mikolaj Kubera

git push ;)

Collapse
 
jsardev profile image
Jakub Sarnowski

Do you mean solutions like Heroku or doing stuff with git hooks? πŸ˜„

Collapse
 
mikolaj_kubera profile image
Mikolaj Kubera

I've been using Gandi for my single-dev apps lately, but I suppose Heroku could work as well :-) So, yeah, Option #1.

Collapse
 
lornasw93 profile image
Lorna Watson

For my personal projects I've just discovered Netlify! I highly recommend a look into it. I use that for continuous deployment from GitHub. But like you said, there are SO many!! ☺

Collapse
 
jsardev profile image
Jakub Sarnowski

Hey Lorna! Thank you for your reply πŸ˜ƒ I've tried Netlify and it's amazing! Unfortunately, it works only with static websites, and sometimes I need to do some more complex server-side solutions. Netlify is my go-to with static sites, but I'm still looking for something I'll fall in love with when working on server-side solutions πŸ˜„

Collapse
 
opshack profile image
Pooria A

I use Zeit Now for my personal projects and my own pipeline with github webhooks and NodeJS for work (check out my latest post)

Collapse
 
mikolaj_kubera profile image
Mikolaj Kubera

I've just discovered Zeit Now myself. How does it work for you?

Collapse
 
opshack profile image
Pooria A

As advertised I guess?

Collapse
 
jsardev profile image
Jakub Sarnowski

I didn't have time to try out Zeit Now for now, but it looks promising! I'll definitely take a look at your post, thank you for your reply! πŸ˜„

Collapse
 
scriptify profile image
Maximilian Torggler

We're using BitBucket pipelines internally, which deploys all our serverless endpoints to AWS and our React apps to S3.

Collapse
 
jsardev profile image
Jakub Sarnowski

I still didn't have time to take a look at serverless backend. Does it scale well? Do you have a lot of endpoints or rather a few of them?

Collapse
 
scriptify profile image
Maximilian Torggler

It scales infinitely, that's the cool thing about it (of course there are bottlenecks like DBs, so it's rather a theoretical infinity). Actually, we currently have 3 endpoints, and each of them exposes a GraphQL API.

Collapse
 
thenetjedi profile image
/dev/πŸ˜’

Started with basic Bash scripts, now I use GitLab CI/CD + DCR or GitLab CI/CD + rsync to my EC2 instances (mostly for my throwaway POCs).

PS. I have a self-hosted GitLab instance.

Collapse
 
jsardev profile image
Jakub Sarnowski

I'm sorry but... what stands behind DCR? πŸ˜„

That's a cool setup! Do you host GitLab on your own server? Are the costs high for something like this?

Collapse
 
thenetjedi profile image
/dev/πŸ˜’

I deploy those images to a docker engine running on an EC2 or directly to ECS.
I was using DCR way before ECR hence didn't migrate.

Yep, I do host GitLab on my own server and the costs are not high, but not cheap either.
It gets the job done without me having to worry(much) about security of my codebase

Collapse
 
jsardev profile image
Jakub Sarnowski

For me, I mostly deploy NodeJS apps and do it via PM2. Unfortunately, I struggled with some bugs with it and started looking for an alternative... but I didn't find any. That's one of the reasons why I asked this question here. I tried Fabric and ShipitJS but also run into some limitations that didn't allow me to do what I want. I hope some of you will bring up some cool alternatives that I could use πŸ˜ƒ

Collapse
 
morganandrewv profile image
Morgan VanDerLeest

Render! render.com/

It’s like Heroku but it doesn’t destroy your wallet. Great tool and team.

Collapse
 
jsardev profile image
Jakub Sarnowski

Huh! Didn't know about Render. It looks really good! And yeah, the main reason why I don't like Heroku is that it makes my wallet go empty. Render prices look a lot better! Thanks!

Collapse
 
ebartan profile image
eray Bartan

i think best solution for me "heroku cli" cause nuxt ssr mode run more stable. all other thins zeit awesome useful if you need run dev mode on local.
old guy allways use git :)