This guide will be focusing on guiding you through the deployment of Burdy onto the cloud using DigitalOcean infrastructure. Deployment into production requires the following infrastructure elements:
To start, first, we need to prepare object storage (spaces) and a database for Burdy. Afterward, we need to either create a container registry or use the official Burdy docker image. If custom code is present, we need to containerize our application and publish it to the container registry. As the last step, we will be creating an app that uses tagged images to run our code.
After creating an account navigate to Spaces and start by creating a new space. For this guide, we will be creating a space in
San Francisco data center. Do not use CDN in the space itself, since the assets will not be directly accessible to the public, instead, Burdy will be responsible for delivery, management, and creation of assets.
We should also restrict the file listing as we do not want anyone to have access to the files outside of the Burdy app.
The important thing to pick out from the selected space will be the endpoint. Go into the space you've just created and copy the endpoint URL of the space. In our case, this is
sfo3.digitaloceanspaces.com. This is our
SPACE_ENDPOINT. We also have
SPACE_URL, which in our case is:
burdy-demo-app.sfo3.digitaloceanspaces.com. Also, our
SPACE_REGION is sfo3.
The last step is to create an access key for the space we've created. Navigate to API in the side panel, and you should see Space access keys. We need to create one, for our application to connect to it.
After clicking the Generate New Key button and naming your access key, a key and a secret will be generated. From here, we will be referring to these values as
SPACE_SECRET. Copy them somewhere safe, as we will be using these details while setting up the environment variables for Burdy deployment.
In summary, after following these steps you should have the following configuration variables:
In case you need a more detailed tutorial on how to create your own space on DigitalOcean, refer to the official tutorial by DigitalOcean.
Before moving on to building and deploying our app, the last step is creating a database. Click Create -> Database in the DigitalOcean panel. We will be creating a MySQL instance during this tutorial, however, feel free to use Postgres, there are only minor differences in the deployment of these (notably
TYPEORM_DRIVER environment variable). To ensure that everything is performant, we should create all infrastructure of the application in the same datacenter, otherwise, we will be having delays in communication between node and database/spaces. Therefore, we'll create our database in the San Francisco 3 data center.
Feel free to adjust your machine type, node type, and other settings according to your needs. After creating the database, it is highly recommended that you secure it in the later steps (after the app is created) so that it is open to only connections from the application.
For now, copy the values from the generated database. Notably:
The next step is creating the application. In case you need more details about creating the database, we recommend checking out the tutorial by DigitalOcean.
As the last step of our deployment, we will be deploying Burdy core code. Click Create -> App. If you have custom code, at this stage you should have the docker image available from the content repository. For our example, we will use Burdy's official Docker image.
After pressing Next, we will be promoted with the configuration of our service. For the type, we should choose Web Service, and our HTTP Port should be set to 4000 (unless specified otherwise by customer Docker Image). We should leave the RUN command empty as it's provided by the Burdy Docker image. Now is the time for us to set up our keys as well:
# DigitalOcean Spaces FILE_DRIVER = aws_s3 AWS_ACCESS_KEY_ID = SPACE_KEY AWS_SECRET_ACCESS_KEY = SPACE_SECRET AWS_S3_REGION = SPACE_REGION AWS_S3_BUCKET = SPACE_BUCKET AWS_S3_ENDPOINT = SPACE_ENDPOINT # Database TYPEORM_CONNECTION = mysql # or postgres TYPEORM_HOST = DATABASE_HOST TYPEORM_USERNAME = DATABASE_USER TYPEORM_PASSWORD = DATABASE_PASSWORD TYPEORM_DATABASE = DATABASE_NAME TYPEORM_PORT = DATABASE_PORT TYPEORM_SYNCHRONIZE = true # or create a pipeline for migrating database changes # General BURDY_HOST = BurdyURL # domain where you are hosting Burdy, e.g. https://cms.burdy.io ASSETS_CACHE_CONTROL=max-age=259200 # Asset caching (optional)
After that, your Burdy should be up and running, run the deployment process, and your Burdy should be available via URL within a few moments!