[Bug]: No Strapi Droplet in DigitalOcean's marketplace
Link to the documentation page or resource
https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/installation/digitalocean-one-click.html#creating-a-strapi-project
Describe the bug
Improve documentation for DigitalOcean One-click
On documentation page DigitalOcean One-click link Go to the Strapi page on DigitalOcean's marketplace return Error.
There is no Strapi Droplet in DigitalOcean's marketplace.
Additional context
No response
Suggested improvements or fixes
Add DigitalOcean Strapi Droplet or remove page DigitalOcean One-click from documentation.
Related issue(s)/PR(s)
No response
+1
@1ur11 thank you, we are aware of the issue and are working on it. :)
Thank you! A temporary warning in our documentation is going to be deployed soon.
Hello,
Any ideas why there is not anymore the one-click button on DO ?
Thanks
Hello @Aylay We are still waiting for a DigitalOcean reply on the topic. In the meantime, we've added a warning in the documentation.
@pwizla Is there any doc to install Strapi on DO (or any server) without using the one-click button ?
@Aylay Indeed, the best way to use Strapi is to first create your project locally and then deploy it on a server. We have deployment guides for this, and two of them cover deploying on DigitalOcean. Hope this helps :-)
@pwizla Is there any doc to install Strapi on DO (or any server) without using the one-click button ?
Hi, you can check documentation:
Very good !!!
Thanks @pwizla & @1ur11
@pwizla @1ur11 ,
I didn't succeed to deploy strapi on DO with the deployment guides for DO Droplets. I should maybe try with App Platform.
Any news for the marketplace ?
Thanks
@Aylay
It appears that deployment via DigitalOcean App Platform consistently fails as well. This was tested using a fresh create-strapi-app project, deployed following Strapi's documentation regarding App Platform, and using DO's Dev Database option.
The error reads:
Error while running command build: Could not load js config file /workspace/config/env/production/database.js: Cannot read property 'charAt' of undefined
This appears to be an error thrown by the package pg-connection-string, although I cannot verify this absolutely. After speaking with DO support, I get the impression that this error has something to do with how DO provisions their Dev Databases (I cannot say whether or not this is the case with Managed Databases). Here's a quote from DO support:
"The dev database actually is not available during build time. The connection details aren't available. If the app fails to build while trying to connect during build time the database will never be provisioned. In this case, we would either recommend you run any connection attempts to the database during run time rather than build. This will ensure the database is provisioned successfully. "
I realize this App Platform error is a bit off issue, however I get the impression that right now all the pre-configured deployment options listed in the Strapi Documentation for DigitalOcean are currently broken. Hopefully this information will get us all a step closer to sorting the issue out.
@sg-code
Thank you for the explanation.
I hope everything will be back to normal soon I, like others, have to deploy many Strapi new websites with DO very soon :)
Any updates ? Still can't deploy one-click on DO
@mrabusalah
The main issue here seems to be that when initially trying to deploy an App Platform application, DO does not provision the Dev Database until the application has been successfully deployed. This creates a catch-22 situation, where in order for the application to successfully deploy, you need a running database. Furthermore, if you are using a static site generating frontend (Gatsby, Next.js, etc), the build will fail if Strapi is not running during the build process. According to Digital Ocean, there is no way to order build commands during deployment, and furthermore Strapi needs to be actively running in order for many of these frontend applications to build.
Here's the temporary workaround:
Prerequisites:
- Split your frontend and backend (Strapi) into separate GitHub repositories (if they are not already). This method does not work for mono-repos.
TLDR;
- Strapi needs to be running in App Platform before you can deploy your frontend.
- The data and code for your Strapi installation must always be pushed and successfully deployed BEFORE your frontend.
- Use your DO hosted database in your local Strapi development environment.
- If you get repeated build errors when trying to update your app, remove the frontend build commands from your App Spec, deploy your Strapi backend changes, establish database parity with your local machine (don't forget Roles and Permissions!), then add your frontend build commands back to the App Spec and deploy your frontend.
- Edit: If your Strapi backend fails even without a frontend component, provision a Managed Database through Digital Ocean and use that database instead of the Dev Database provided with the App Platform.
For New Strapi installations:
- Create an App Platform component from your backend (Strapi) repository.
- Attach a Managed Database through Digital Ocean.
- Deploy your application (without a frontend, this should deploy successfully)
- After a successful deployment, you will need to manage all your data and settings using the Strapi installation on DO, rather than on your local machine. The easiest workaround/stop-gap to ease this issue is to connect your local dev environment to your DO hosted database (You will also need to set your local machine as a Trusted Source for your DO database).
- If you have data or configurations in Strapi, migrate the data and configurations (don't forget to change Roles and Permissions!) from your local Strapi install to match your DO installation. You can now add your frontend repository as an App Component, and so long as you can build your frontend using the DO hosted database (through Strapi), you will be able to deploy your application successfully.
For Existing installations with a Database:
- In App Platform, go to your app's settings, download the App Spec (yaml file) and make a copy of the file.
- Open the copied file and remove the
- build commandarray inservicesfor whichever frontend component you use.
Below is an example App Spec with comments showing which code to remove:
alerts:
- rule: DEPLOYMENT_FAILED
- rule: DEPLOYMENT_LIVE
databases:
- cluster_name: xxxx
db_name: example_db
db_user: example_user
engine: PG
name: example_db_name
num_nodes: 1
production: true
size: xxxx
version: "12"
domains:
- domain: example.com
type: PRIMARY
zone: example.com
envs:
- key: APP_URL
scope: RUN_AND_BUILD_TIME
value: ${APP_URL}
name: my-app
region: sfo
services:
- build_command: NODE_ENV=production yarn build
environment_slug: node-js
envs:
- key: BACKEND_ENVIRONMENT_VARIABLE
scope: RUN_AND_BUILD_TIME
type: SECRET
value: xxxx
github:
branch: main
deploy_on_push: true
repo: xxxx
http_port: 8080
instance_count: 1
instance_size_slug: basic-s
name: my-strapi-backend-component
routes:
- path: /backend
run_command: NODE_ENV=production yarn start
source_dir: /
# REMOVE 'my-frontend-component' build code below
- build_command: NODE_ENV=production yarn build
environment_slug: node-js
envs:
- key: FRONTEND_ENVIRONMENT_VARIABLE
scope: RUN_AND_BUILD_TIME
value: xxxx
github:
branch: main
deploy_on_push: true
repo: xxxx
http_port: 8080
instance_count: 1
instance_size_slug: basic-xs
name: my-frontend-component
routes:
- path: /
run_command: NODE_ENV=production yarn start
source_dir: /
# END REMOVE
- Upload your updated copy of the App Spec, and then force a deployment if App Platform doesn't start a deployment automatically for you.
- Once your Strapi backend deploys successfully, login to your Strapi backend and make sure that your installation on DO servers contains all the same data as your local Strapi installation. (I have been doing this more or less manually, but check the Strapi docs if you need to do a database migration).
- Now that there is data parity between your local and remote Strapi installations (don't forget Roles and Permissions!), you can upload the original copy of your App Spec (which includes your frontend build commands), and if all goes well your application should deploy successfully.
Using the method above, I have been able to reliably deploy my app when pushing code to GitHub, so long as I ALWAYS push and deploy changes to the backend (Strapi) before pushing and deploying changes to the frontend.
I hope this helps! I can clarify as needed.
Thank you so much for the very detailed explanations, @sg-code ! ❤️ Strapi's Documentation Team is fully focused on documenting Strapi v4 for now, but we'll handle the deployment guides topic in the upcoming months, and this will definitely help :-)
Please see PR #857 for the latest deployment guide for Digital Ocean. A new Droplet guide will be written shortly.
Hi All, Since this issue included a lengthy discussion of the DO App Platform and PR #857 provides a new deployment guide I am going to close the issue. We are working on new deployment guides and I hope to share a Droplets guide over the summer. We don't plan to support 1-click deployments anytime in the near future. Please open a new issue if you have further trouble with DigitalOcean deployments.