Help Center


Production deployment on Digital Ocean Apps

https://app.chaskiq.io/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBdXdKIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--1e4bb37de70b822f55f05051b5f11730cf9b0963/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVdscGFRPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--285ee8d1047615771afef258f0db59a0c5726b2a/mich-square-profile.png

Written by Miguel Michelson

updated

There are many ways to deploy Chaskiq on the cloud. This article is about the deployment of Chaskiq's Docker image on DigitalOcean. Note that this procedure will be similar on other cloud providers, K8s context and so.

Requirements:

Chaskiq has two databases that have to be connected, that's Redis and Postgres. So, the easiest way, if you don't have databases already, is to create that on the managed databases section on DigitalOcean. Please check the details before proceeding: https://www.digitalocean.com/products/managed-databases/ when you have the databases you will need the string connection information for both: the format is like this:

postgresql://user:pass@db-postgresql-nyc1-xxxxx.db.ondigitalocean.com:25060/yourdatabase?sslmode=require

Enter DO Apps

Go to https://cloud.digitalocean.com/apps/new
Choose the DockerHub option and for the Repository add chaskiq/chaskiq, for the tag you can use latest or and specific tag that can be found at here.

Then you will be asked for some configurations

Run Command:
The run command you have to configure is:

bundle exec rails s -b 0.0.0.0 -p 3000

HTTP Port:
The HTTP port has to be the same as the port in the build command, so put port 3000.
Environment Variables:
Make sure you put the proper environment variables on the prompt. But don't worry you could also edit this later.
Check the Chaskiq environment variables article.

When you are done, hit next and the app will be built in a minute.

Sidekiq Worker

Chaskiq does some background tasks in order to not block the web process with heavy tasks like emails, file uploading, and messaging, The process that handles all the work is a Sidekiq server that has to be installed too, This is different from web apps because they don't receive internet traffic, they just receive instructions internally to perform tasks. Once you got the Web app working you will need to add Sidekiq as an App Worker component. So, in the DO app panel go to components and add a worker.

The process is simple, just add the Worker components and choose the same repo for the worker. Also, you will have to put the same ENV vars as your web process. The only difference is that you have to set a different start command, the start command is:

bundle exec sidekiq -C config/sidekiq.yml


Domains:

The Digital ocean will give you a standard domain, that will end with the .ondigitalocean.app, that's good enough to get started, precisely because it has SSL support. But you can also set your own domain to the instance, just make sure to change the HOST and WS env vars.


Full tutorial

Part 1

Part 2 - Environment Variables

Environment Variable template can be found here: https://gist.github.com/michelson/c25495159eabbf6fc473da5513bc9e83


Part 3

Part 4 - Database Migrations and seedding