Voyage Configuration
Explore and Learn how to Configure Voyage

Overview

When setting up a new project in Voyage there are a few different options for configuration. If you application is a well known framework such as Create React App or Laravel you may select a pre-defined preset as long as your project is structured via the out of the box configuration from that framework.

Manual Configuration

Most applications will require a Voyage configuration file. Creating this file is simple. Simply create a .voyage directory in the root of your application. Voyage will see this folder and look for a config.yml inside of it similar to other third-party providers.

How to Build a Configuration File

If a Voyage config file is present in the deployed branch, that configuration will take precedence over the configuration set in the UI. You should create a configuration similar to the one below in the .voyage/config.yml file in your project.

For basic applications you may add the build commands for your app directly in the .voyage/config.yml file. For more complex applications we recommend that you provide a Dockerfile to build your primary image.

If you use a preset, you don't need a Dockerfile. Most modern web development environments tend to lean towards being Docker based.

For help writing good Dockerfiles see Docker's docs or reach out to us and we can help.

Voyage config example

Not a real file. You will need to tailor to your use case.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 services: app: # Base image to use to build app image: node:12.19.0-alpine3.10 # Providing commands to build app w/out a Dockerfile # Voyage will run these commands inside the base image above commands: - 'npm i' - 'node server.js' # Context is where we should start building/running the app (Helpful for building a sub-directory) context: ./ # If no dockerfile is specified Voyage will look for a Dockerfile in specified context or root of project dockerfile: ./Dockerfile.voyage # One container should be primary defining which container should accept the incoming requests primary: true # If no exposePort is defined, Voyage will default to 80 exposePort: 8000 environment: - name: MOCK_DEPLOYMENT value: 1 - name: DB_HOST value: 127.0.0.1 - name: REDIS_URL value: redis://127.0.0.1:6379 # Sensative secrets may be defined via the UI and consumed like below - name: SECRET_VALUE value: ${SECRET} database: image: postgres:11 # When using images you may mount init files from your codebase mount: - ./init.sql:/docker-entrypoint-initdb.d/init.sql environment: - name: POSTGRES_USER value: 'test' redis: image: redis environment: - name: ALLOW_EMPTY_PASSWORD value: 'yes'

Using Defined Presets

CRA Preset

Your app may either use Yarn or NPM but must have a script named start in your package.json. This is the default CRA config.

Example CRA Application

Laravel Preset

Your app must follow the initial bootstraped architecture from Laravel. The application will be deployed behind nginx and the database uses mysql.

Example Laravel Application

Presets Coming Soon

  • Ruby on Rails
  • .NET
  • Django

Multi Repo Configuration

Voyage supports multi-repository deployments. This is supported by referencing an additional repository as a service inside the .voyage config file. The current repo executing the deployment is considered the primary repository. The api repository in this case will use the Dockerfile in the root of the additional repo just like normal. When using an external repo however the only .voyage configuration that will be read will be the primary repo executing the deployment.

You may specify which branch to use from the external repo. If an externalBranch is not provided, Voyage will look for a matching branch name as the current branch being deployed from the primary repo. If Voyage can not find a matching branch it will default to the externalBranchDefault field. If that field is not provided it will lastly fallback to master.

In order to reference the api service url inside the app service, Voyage automatically injects environment variables into each container with a format of VOYAGE_SERVICE_{SERVICE_NAME}_URL. So in this case the referenced url would be VOYAGE_SERVICE_API_URL.

In the case you would like your service variables named differently you may cast them to a different value in the config file.

Here is a simple example.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 services: app: context: ./ primary: true exposePort: 3000 api: context: ./ externalUrl: https://github.com/actovos-consulting-group/api-service externalBranch: feat/new-feat # Fallback if no matching branch name externalBranchDefault: staging exposePort: 3001 environment: - name: API_URL value: ${VOYAGE_SERVICE_API_URL}

Environment Variables

When running inside Voyage a build argument and environment variable RUNNING_IN_VOYAGE=1 is automatically injected into each build and deployment. This allows the developer to modify any build or startup scripts to build anything specific for the Voyage environment.