me
Published on

Digitalocean docker deployment

Authors
  • avatar
    Name
    Omer ATAGUN
    Twitter

Well, as you know from previous posts that i created my own homeserver using cloudflare tunnel and kubernetes. But i was not satisfied with the performance of the server alongside the cost of it for running. Electricity, UPS ( for energy disruptions ) and also the infastructure cost i had to get myself into. This was almost a endless work which i have enjoyed utmost but i think it is time to end this :).

Idea

Almost a year and the half ago me and a colleague Matevz had an idea of creating a service that would allow you to deploy your project without knowing a single thing about deployment procedures.

You will tell me know that it is not a something new, there is a heroku or netlify was doing that for a quite long time. You're right but our problem was that on top of what know, we had to learn these products requirements. Which is bad and additional knowledge will be gone to waste if you don't use it frequently. However, we said this should be total no brainer, you just push your code and it should work. All you had to do is to provide us Dockerfile.

Digitalocean

Well yeah, it was just another day that i was browsing the internet and i saw that digitalocean is offering starting from 5$ a Dockerfile under app section. I was curious how good this was, hence the following happened :).

All you have to do is to give access to your gitlab or github account and select the repository you want to deploy. You can set your Dockerfile path and the port you want to expose. That's it, you're done.

Performance and cost

Let's start with identifying both servers and their specs.

Homeserver

  • 4 core cpu ( i5 4th generation)

  • 8gb ram ( DDR3 )

  • 150/50 mbps internet connection ( LTE, yeah i live in rural area)

  • 120gb ssd

    • Docker for cloudflare tunnelSSH
    • Kubernetes ( k3s with Rancher )
    • Network router ( TP-Link ) 5 ports.
    • 1x RPI 4b 8gb ram for additional node.
  • God knows if goes kaput :). Yet i wrote another rust application that pings and send me an email if it goes down. Runs in my personal mac and gaming desktop one. Yeah it is just for a fun.

approximately electric cost is 10$ per month

Digitalocean

  • 512mb ram
  • 1 core vCpu ( shared obviously )
  • No other information available
  • ssh access into the pod
  • Runtime logs
  • Insights
  • Auto deploy from a given branch with fallbacks and failures.
  • HTTP redirects
  • ENV for both build and runtime
  • Alert policies and more

costs 5$ per month

Deployment

I gave the access to my gitlab account and told my branch and where my dockerfile lives, simple as that. Then i picked the service i want out of options that i could have staging, dev and prod environments with N amount of nodes.

Once deployment was done and live in a given random subdomain, all i had to do is to log into my cloudflare account and add a CNAME record to that domain. Done, now my blog is live and running without me thinking anything about deployment procedure anymore.

Juicy part - Benchmark

I will cut short and let you decide whether it is worth it or not.

  • Homeserver AB test
Concurrency Level:      10
Time taken for tests:   3.458 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      2914574 bytes
HTML transferred:       2802800 bytes
Requests per second:    28.92 [#/sec] (mean)
Time per request:       345.800 [ms] (mean)
Time per request:       34.580 [ms] (mean, across all concurrent requests)
Transfer rate:          823.10 [Kbytes/sec] received
  • Digitalocean Docker deployment AB test
Concurrency Level:      10
Time taken for tests:   2.563 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      2842516 bytes
HTML transferred:       2760700 bytes
Requests per second:    39.02 [#/sec] (mean)
Time per request:       256.273 [ms] (mean)
Time per request:       25.627 [ms] (mean, across all concurrent requests)
Transfer rate:          1083.18 [Kbytes/sec] received

Conclusion

I think we got ourselves an obvious winner here. This does not mean i will close my homeserver yet. For cases like blog applications, digitalocean is your guy to go. but with applications that require more resources ( database, key/value store etc), i would still go with my homeserver.

Till the next time, stay hydrated!