Forem

Brian
Brian

Posted on

2

Deploying Strapi using Digital Ocean's App Platform and Managed DB

In this article, I'm going to share how I deployed one of my apps using Digital Ocean. This should take you around 15-20 minutes.

Updating your code for different environments

Most of the time, I only have 3 environments in my application; development, staging and production.
To create these configurations, you need to create these folders:
config > env > {configName }

Alt Text
Take note of your environment variables, we're going to need them later in App Platform.

You can learn more from the official doc

Setting up Managed DB

Alt Text
Make sure to choose MySQL. For some reasons, I was not able to connect using Postgres.

For other options, just pick according to your needs.

After provisioning is done, create a new user which you are going to use later to connect to your app.

Alt Text
For Password Encryption, use the Legacy – MySQL 5.x. I'm not a DB expert and it took me a lot of time to figure out this one.

Take note of the connection details found here
Alt Text
You will need them later when setting up the environment variables.

DB part is done and now we go to the App Platform

Setting up App Platform

App platform will prompt you to choose your git repo and branch to deploy from.

After clicking Next, you will be prompted similar to this screenshot

Alt Text
The important part here is the Environment Variables. You can set them now or just do it later. For Build/Run Command, you don't need to change it since the scripts in your package.json already had the same names and working accordingly.

Set the values of your Environment variables now if you haven't because the build will fail without them.
You can go to the Components tab > Environment variables

Alt Text
You can freely choose your own variable names and don't need to necessarily copy mine. After clicking save, App Platform will rebuild your app.

If the build finish successfully, you will see a link in your dashboard like this

Alt Text

Feedback is welcome. If you have a better way of doing things, please comment it down below.

If you reached this section, please consider using my affiliate link when creating a new account :D
You will get $100 in credit over 60 days
https://m.do.co/c/5c95573fc1d2

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay