Skip to content

An example showing how to declare and utilize optional services with Architect

Notifications You must be signed in to change notification settings

davidthor/architect-optional-services

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Optional services

The best way to handle optional services (e.g. services that exist in some environments but not in others) is to put them into their own components. This repository contains two of Architect's starter projects: a react frontend and a node backend.

The backend component contains only the information needed for itself to run, which in this case includes the service itself and a postgres database. The frontend component however contains both its runtime and a reference to the node-rest-api component via dependencies. This means that whenever the frontend is deployed to an environment, it will automatically deploy the node-rest-api backend or connect to an existing instance already in the environment.

Local development

Running just the backend

$ architect dev ./node-rest-api

Running the frontend as well as the backend

# This only has to be done once on your machine
$ architect link ./node-rest-api
# This will automatically deploy the node-rest-api since its cited as a dependency
$ architect dev ./react

Remote deployments

Deploying just the backend

$ architect env:create <my-environment> --account <my-account>
$ architect deploy ./node-rest-api --account <my-account> --environment <my-environment>

Deploying the frontend as well as the backend

$ architect env:create <my-environment> --account <my-account>
$ architect deploy ./react --account <my-account> --environment <my-environment>

Deploying one and then the other

When running the second deploy command, Architect is smart enough to determine that the dependency already exists. The deployment will connect to the existing instance instead of deploying a new one.

$ architect env:create <my-environment> --account <my-account>
$ architect deploy ./node-rest-api --account <my-account> --environment <my-environment>
$ architect deploy ./react --account <my-account> --environment <my-environment>

About

An example showing how to declare and utilize optional services with Architect

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published