A dynamic microservices framework for building, connecting, and deploying cloud-native applications.
It is extremely common to run a REST API with a backend database as a standalone service so that it can be consumed by multiple, disparate applications.
In this example, you'll learn how to capture an app written with Go and a Postgres database backend as a dependency using Architect to enable automated deployments, networking and network security for your application - wherever it gets deployed.
In the architect.yml
file for this project, we describe this app as two deployable services. However, we also
leverage Architect's service discovery features to populate environment
secrets by reference. This not only allows us to automatically connect the services to each other, but it also allows
Architect to build strict network policies to whitelist the traffic between these services. Now we won't have any work ahead
of us to promote this stack from local dev all the way through to production!
Learn more about the architect.yml file
This service implements GET/POST functionality for a simple Movies
schema consisting of a name
and a rating
between 1 and 5.
You could use it to gather data about anything you want to rate, from your favorite restaurants, movies, and more!
{
"name": "string",
"rating": "integer"
}
In the Go service under server/static/base.tmpl
, uncomment the user_input
and user_table
template blocks to interact with the API and Database components of the app.
The architect.yml
file is declarative, which allows the Architect Component it describes to be run in any environment,
from local development all the way to production. Follow these steps to clone this repository and run the application
locally.
Once the deployment has completed, you can reach your new service by going to https://app.localhost.architect.sh.
# Clone the repository and navigate to this directory
$ git clone https://github.com/architect-templates/go.git
$ cd ./go
# Deploy locally using the dev command
$ architect dev architect.yml
Want to try deploying this to a cloud environment? Architect's got you covered there, too! It only takes a minute to sign up for a free account.
You can then deploy the application by running the command below. Note that “example-environment” is the free environment that is created with your Architect account.
# Deploy to Architect Cloud
$ architect deploy architect.yml -e example-environment