This is a guide for how to run an instance of LeadOut in AWS.
This project is set up as a monorepo that contains everything required to run its full stack.
api
- Defines the data-serving layer of the application. It runs in AWS, so can be started via thecdk
below.cdk
- Defines the CDK deployment configurations.client
- Defines the Vue front-end server.docs
- Contains any other technical documentation See the index to browse the docs.
This guide assumes you have done the following:
- Install Node 16.
- Have an AWS account and specified your AWS credentials on your workstation (general guide, BlueConduit guide).
- Own a domain managed by AWS Route53.
- Have a Mapbox account with API access token.
First, build the client:
-
From the root of the repository, change to the
client
directory.cd client
-
Install dependencies.
npm install
-
Set
VUE_APP_MAP_BOX_API_TOKEN
in.env.production
to your your MapBox API token. -
Build the static files.
npm run build
You should now have index.html
and other static files in client/dist
. If you aren't deploying
this through BlueConduit's infrastructure, you'll need to edit some configs:
- Replace the AWS account ID with your own in
cdk.ts
anddns.ts
. - Replace the domain name with your own in
util.ts
.
Next, deploy the infrastructure using the CDK:
-
From the root of the repository, change to the
cdk
directory.cd cdk # or `cd ../cdk` if you were already in `client`
-
Install dependencies.
npm install
-
Deploy the application. Review and approve each of the prompted permissions questions.
cdk deploy --all
You can review that this has been successful by going to your AWS console and viewing the
CloudFormation console. It should show a successful deployment of several OpenDataPlatform
stacks.
Then, open the CloudFront console and find the full domain name of your LeadOut instance. Open that
in a browser. It should display the application.
You can use the above guide and cdk deploy --all
to deploy local changes. However, each deployment
may take a few minutes. A faster development cycle is to locally serve a live version of the client,
which points to the deployed backend.
First, create a file for your local environment variables:
-
Create a local
.env
file.cd client touch .env
-
Add the following [
.env
].VUE_APP_MAP_BOX_API_TOKEN = # Your Mapbox token VUE_APP_API_ENDPOINT = # The root endpoint for your deployed LeadOut instance, including `https://` VUE_APP_DEFAULT_TILESERVER_HOST = # The domain for your deployed LeadOut instance, without `https://`
-
Build the client and run a local development server.
npm run serve
LeadOut should now be available at the returned localhost
URL. You can verify the env vars are
correctly configured by viewing the browser dev console, which should print
Using API: ${your LeadOut instance}/api
.