Categories
Cloud

Setting Digital Ocean environment variables

Are you trying to work out how to setup environment variables for your Digital Ocean droplet or app running on the app platform? Here’s how.

Digital Ocean droplet environment variables

Setting an environment variable for a droplet is a little more complicated than for an app running on the app platform.

Follow these steps to set environment variables on a Linux droplet:

  1. SSH into your droplet. If you’re not sure how to do that, see here
  2. Once connected, run the following command to set your environment variable:
export YOUR_VARIABLE_KEY=<your-variable-value>

App platform environment variables

To set environment variables for an app running on Digital Ocean’s app platform, follow these steps:

  1. Login to the Digital Ocean portal
  2. Open your app
  3. Click the “Settings” tab
  4. Scroll down until you see “App-Level Environment Variables”
  5. Click “Edit” and add the environment variable key and value
  6. Click “Save”

Your environment variable will now be available for your app.

Categories
Azure

How to create an Azure app service with a database

Need to deploy your app to an Azure app service, and rely on a database such as Postgres or Azure SQL?

Microsoft is now previewing a new blade in the Azure portal that lets you quickly spin up an Azure app service with an associated database.

Supported database engines for the preview are Postgres or serverless Azure SQL server.

To get started using the new blade, click here or search the Azure Marketplace for “web app database”.

The blade – currently in preview – is fairly basic compared to the normal app service blade, but allows you to specify the app name, runtime and database engine. You can also set the server name and database name.

By default it’ll spin up an app service using the Premium V2 tier, but you can scale this down (or up if required) once the service is created using the regular Azure scale up settings.

The database connection information will automatically be set as environment variables for your app service.