Skip to content

Sample app that uses Doppler for app config and secrets management. Translates an English phrase to "Yoda-speak".

Notifications You must be signed in to change notification settings

DopplerUniversity/yodaspeak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yoda Speak

A simple application to translate English into Yoda Speak.

Import to Doppler

It's designed to show how to use the Doppler Universal Secrets Manager for securely and easily fetching app config and secrets for local and production environments using the Doppler CLI and either a system installation of Node.js, Docker, or Docker Compose (Kubernetes coming soon).

New to Doppler? Check out our documentation to get started with your own applications, or clone this repo and follow-along.

NOTE: The Yoda translation API used by the app is limited to 5 requests per hour unless you register to purchase an API key.

Requirements

The commands and scripts to run tha application will work on macOS and Linux variants but not Windows. If you wish to get this working on Windows, either use WSL or create an issue if you'd like to see native Windows support via PowerShell.

Requirements:

If on macOS, you can install the Doppler CLI by running:

brew install dopplerhq/cli/doppler node

Environment variables

The following environment variables are required and you can use the below defaults. Also see [sample.env

Doppler set up

  1. Install Doppler
  2. From a terminal, run:
doppler login
  1. Once logged in, open a new browser window and sign in to Doppler
  2. In the Doppler Web UI, create a workspace

Once authenticated, run the following command to create the yodaspeak project in Doppler and populate the required secrets with default values:

make doppler-project-setup

Local development with system Node.js

Run npm start to install all app dependencies.

Then use doppler run to call the npm start command, which will inject our secrets as environment variables:

doppler run -- npm start

NOTE: For HTTPS, create the TLS_CERT, TLS_KEY, and TLS_PORT secrets

Using Docker

You can use Docker in production using a Doppler service token to provide read-only access to a specific production config, or run the container locally local code mounted into the container and the development dependencies installed.

To use Docker in production, run:

# Requires `DOPPLER_TOKEN` to be exported
make docker

For local development, run:

make docker-dev

There are also commands for using Docker Compose.

To use Docker Compose in production, run:

make docker-compose

For local development, run:

make docker-compose-dev

Deploying to Heroku

This is mainly for the Doppler team to test the Heroku integration but you can deploy this to your own Heroku account/team, by overriding the default values in Heroku.Makefile for:

  • TEAM
  • APP
  • DOMAIN

Creating and deploying a site also consists of setting initial default values for config vars in order for the app to deploy successfully.

Then once the app has deployed, open the Doppler dashboard and enable the Heroku integration for the relevant environment.

To create and deploy to production using default values (works for Doppler team only)

make create -f Heroku.Makefile

To create and deploy to your own custom account:

make create -f Heroku.Makefile TEAM=your-team APP=your-yodaspeak-app-name DOMAIN=your-domain.yodaspeak.com

Using Repl.it

Work in Repl.it

NOTE: This is a work in progress and feedback is greatly appreciated!

You can quickly and easily run YodaSpeak on repl.it by following the below steps once your environment has booted up:

  1. Create a Service Token and expose it using the DOPPLER_TOKEN environment variable
  2. Install and configure all required dependencies by running:
# You'll need to paste your Doppler Service Token when prompted
. ./bin/replit-setup.sh

Once setup, you can then start the server by clicking the Run button, or manually by running:

./bin/replit-start.sh

Having trouble?

Create a GitHub issue, including your OS and Node version, and we'll help you out!

About

Sample app that uses Doppler for app config and secrets management. Translates an English phrase to "Yoda-speak".

Resources

Stars

Watchers

Forks