diff --git a/public/logos/digitalocean.svg b/public/logos/digitalocean.svg new file mode 100644 index 0000000000000..90027e24424a7 --- /dev/null +++ b/public/logos/digitalocean.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/components/DeployGuidesNav.astro b/src/components/DeployGuidesNav.astro index d2c46540d0302..c5e11230e91f2 100644 --- a/src/components/DeployGuidesNav.astro +++ b/src/components/DeployGuidesNav.astro @@ -23,6 +23,7 @@ const services: Service[] = [ { title: 'Deno Deploy', slug: 'deno', supports: ['ssr', 'static'] }, { title: 'GitHub Pages', slug: 'github', supports: ['static'] }, { title: 'GitLab Pages', slug: 'gitlab', supports: ['static'] }, + { title: 'DigitalOcean', slug: 'digitalocean', supports: ['ssr', 'static'] }, { title: 'Cloudflare Pages', slug: 'cloudflare', supports: ['ssr', 'static'] }, { title: 'AWS', slug: 'aws', supports: ['ssr', 'static'] }, { title: 'AWS via Flightcontrol', slug: 'flightcontrol', supports: ['ssr', 'static'] }, diff --git a/src/content/docs/en/guides/deploy/digitalocean.mdx b/src/content/docs/en/guides/deploy/digitalocean.mdx new file mode 100644 index 0000000000000..bfb165cbb7200 --- /dev/null +++ b/src/content/docs/en/guides/deploy/digitalocean.mdx @@ -0,0 +1,135 @@ +--- +title: Deploy your Astro Site to DigitalOcean +description: How to deploy your Astro site to the web on DigitalOcean. +sidebar: + label: DigitalOcean +type: deploy +i18nReady: true +--- +import ReadMore from '~/components/ReadMore.astro'; +import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'; +import { Steps } from '@astrojs/starlight/components'; + +[DigitalOcean](https://www.digitalocean.com/) offers multiple hosting options for web applications and static websites, including App Platform, Spaces, and Droplets. Any Astro site can be hosted on DigitalOcean! + +This guide includes instructions for deploying to DigitalOcean using App Platform, which is the recommended approach for most Astro sites. + +## Project configuration + +Your Astro project can be deployed to DigitalOcean in different ways depending on your needs: + +### Static site + +Your Astro project is a static site by default. DigitalOcean App Platform offers direct static site hosting. Configure your app as a "Static Site" resource type. This allows DigitalOcean to serve your static files directly using the default settings without requiring additional packages or custom configuration. + +### Server-Side Rendering (SSR) + +For Server-Side Rendering, you'll need to configure your Astro project for SSR. Configure your app as a "Web Service" resource type. This allows DigitalOcean to deploy your app with Server-Side Rendering. + +## How to deploy + +You can deploy to DigitalOcean App Platform through the website UI or using DigitalOcean's CLI (`doctl`). The process works for both static and Server-Side Rendered Astro sites. In this guide, we will only cover using the [DigitalOcean Control Panel](https://cloud.digitalocean.com/). For more information about the CLI, visit the official documentation: [doctl Command Line Interface (CLI)](https://docs.digitalocean.com/reference/doctl/). + +### Web Application Deployment + +If your project is stored in GitHub, GitLab, or Bitbucket, you can use the DigitalOcean App Platform to deploy your Astro site. +
+ +**Naming:** There are two names you will see in the next steps. There is the name of the overall `App Platform`, and the name of the `Web Application`. +
+**Note:** You can also deploy using Docker Containers. For more information, please follow the [How to Deploy from Container Images Guide from DigitalOcean](https://docs.digitalocean.com/products/app-platform/how-to/deploy-from-container-images/). +
+
+ + +1. [Sign up](https://m.do.co/c/e70457dcb5b6) for an account if you don't have one already. + - Log in to your [DigitalOcean Control Panel](https://cloud.digitalocean.com/) if you already have an account. + - Note: The above signup link is a referral link; it costs nothing but provides you with a free $200 credit for 60 days to try out DigitalOcean. If you spend $25 after your credits expire, the referrer gets $25 as well. Please use if you'd like, or don't if you don't. [Here](https://cloud.digitalocean.com/registrations/new) is a direct signup link if you'd prefer it. +
+ +2. Open the dropdown menu in the top right header called `Create` click `App Platform`. + +3. Choose GitHub, GitLab, or Bitbucket as your source. + +4. Select your Astro repository from the list. + +5. Choose Source: + - **Repository:** Select your Repository. + - **Branch:** Select which Branch to deploy (main/ master by default.) + - **Source directories (Optional):** DigitalOcean detects it by default, but you can also manually input a route. + - **Autodeploy:** Select whether or not the application should be re-deployed each time an update is made to the branch. (Recommended) +
+ +6. Review and configure resource settings: + - **Info:** Edit Name and Resource Type. + - **Name:** Enter the web application name. + - **Resource Type:** Choose `Static Site` for static Astro sites, or `Web Service` for SSR. + - **Size (Only for Web Service):** Select instances and containers to use. + - **Instance size:** Select the instance type to use. + - **Containers:** Select how many of the instances to run. + - Note: It is recommended to run the lowest-spec instance needed and scale up as needed. If using dedicated instances, you can also enable autoscaling to scale as needed. + - **Deployment settings:** Enter the Build command and Output directory. + - **Build command:** `astro build` + - **Output directory:** Enter the output directory (`dist` is the output directory in Astro by default, but you can leave it blank and let DigitalOcean should detect it automatically. It is recommended to enter it manually.) + - **Network:** + - **Public HTTP port (Only in Web Service):** Public port. (Do not change unless you know what you are doing.) + - **Internal ports (Only in Web Service):** Internal communication ports. (Do not add anything unless required and you know what you are doing. **Can introduce security risks.**) + - **HTTP request routes:** Routing routes. (Do not change unless you know what you are doing.) + - **App-level environment variables:** Variables accessible by all resources in the app (Do not change unless you know what you are doing.) + - **Datacenter Region:** + - **Choose a datacenter region:** Choose the region closest to the average user. The further the region, the longer the load time. + - **Connect app to VPC network:** Virtual Private Cloud network. (Off by default; do not change unless you know what you are doing.) + - **Finalize:** Enter your App Platform name, and which Project this Applications should be within. +
+ +7. Review your configuration and click `Create app`.
+ DigitalOcean will now automatically build and deploy your app. +
+ +To change any of the configuration settings, go to Settings, select the Component you would like to reconfigure, and edit as appropriate. + +Any future changes to your source branch will trigger automatic deployments if Autodeploy is enabled. By default, DigitalOcean will notify you by email if there are any failed deployments. This, and many other settings can be changed in the Settings tab within the App. + +Congratulations! You have deployed your Web Application on DigitalOcean. + +## Additional Resources +- [DigitalOcean Docs](https://docs.digitalocean.com/) +- [DigitalOcean Discord](https://discord.com/invite/digitalocean) + +## Troubleshooting + +1. Run the following commands to ensure that the applications Builds and Deploys properly on your local machine: + + + ```shell + npm run build + npm run preview + ``` + + + ```shell + pnpm run build + pnpm run preview + ``` + + + ```shell + yarn run build + yarn run preview + ``` + + + You should be able to view your application locally. If it is working here, then your application should not be the issue, and the issue lies in the DigitalOcean configuration. + +2. Check to ensure your configuration is correct. + - Did you enter the correct Build command? + - Did you enter the correct Output Directory? + - Are you building the latest Application? + - Are you using the correct HTTP Request Routes? + + Ensure to read through the Build and Deploy logs and check if there are any issues. There may be hints as to the issue even if it builds and deploys successfully. + + +## Full server management - DigitalOcean Droplets + +For more control over your server environment, you can deploy to a [DigitalOcean Droplet](https://www.digitalocean.com/products/droplets). Read the [documentation](https://docs.digitalocean.com/products/droplets/) for more information. diff --git a/src/data/logos.ts b/src/data/logos.ts index 0fa89e3382c55..5ebc89631be82 100644 --- a/src/data/logos.ts +++ b/src/data/logos.ts @@ -59,6 +59,7 @@ export const logos = LogoCheck({ drupal: { file: 'drupal.svg', padding: '.12em' }, ghost: { file: 'ghost.png', padding: '.125em' }, 'decap-cms': { file: 'decap-cms.svg', padding: '0 .225em 0 .26em' }, + digitalocean: { file: 'digitalocean.svg', padding: '0.125em 0' }, 'tina-cms': { file: 'tina-cms.svg', padding: '.15em' }, payload: { file: 'payload.svg', padding: '.3em .25em .3em .3em' }, prismic: { file: 'prismic.svg', padding: '.25em' },