Create a project
We'll base our movie database off of an Adapt starter template called
adapt new hello-react-node-postgres ./moviedb
This command creates a complete template for a "Hello World" app in a new directory,
Our new Hello World app contains the front end user interface, all of its back end services, and the Adapt specification that allows everything to be easily deployed into different environments. The app consists of:
- A simple React user interface, created with create-react-app, that displays "Hello World!".
Source code for the UI is in the
- A simple Node.js back end API server that responds to HTTP requests with "Hello World!".
Source code for the API server is in the
- A static web server that serves the app's HTML, CSS, JS, and image files.
- A URL router that directs HTTP requests that start with
/api/to the Node.js back end and all other requests to the static web server.
- A Postgres database (which will be useful in a later step).
It also contains Adapt Style Sheets that allow the app to be deployed to different environments:
laptopstyle sheet deploys all the app components to your local Docker host--great for interactive debugging of end-to-end tests. It can even pre-populate the Postgres database with test data for you.
k8s-teststyle sheet deploys all app components to a Kubernetes cluster for testing (without redundancy or database persistence).
k8s-prodstyle sheet shows how to use an existing database along with the other app components in Kubernetes.
To run all the app components on your local Docker host:
cd moviedb/deploy adapt run --deployID movieapp
This changes into the
moviedb/deploy directory, where the Adapt deployment spec is located, and runs the deployment.
deployID option gives the newly created deployment a name that we can refer to for later commands.
When the deployment is complete, you should see:
Deployment created successfully. DeployID is: movieapp
Test the Hello World App
The app should now be available at: http://localhost:8080
If you open this URL in your browser, you should see something like this: