Skip to content

Commit

Permalink
Prepare the application for demo with scripts and a README
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybatt committed Jun 1, 2024
1 parent ffeb3bc commit a0ba525
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,4 @@ application/data/
application/app/frontend/node_modules/
node_modules
aws/
api.txt
application_url.txt
56 changes: 52 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,56 @@
# P01-RidingShare

# Application Demo
As the application requires a collection of self-hosted tools and engines to perform, that can take time to be provisioned a simplified demo script has been created that modifies the usage of these enigines to publically available free and open-source hosting.

Please note however that the usage of these API's however is rate limited so the demo application will be more limited.

## Setting up the envrionment
To deploy the demo script you will need that `Terraform` and `Docker` both installed on your system.

Below are the links to installation guides for both of these tools. Ensure you follow the correct instructions for your system.
- [Terraform Installer Guide](https://developer.hashicorp.com/terraform/install)
- [Docker Installer Guide](https://docs.docker.com/engine/install/)

## Creating credentials
Running the demo requires AWS credentials to be passed in. A shell script has been provided to generate a blank credentials file for you to fill out. Simply run the following script command.
```shell
./generate_credentials_file.sh
```
Once the credentials file is generated simply paste in your AWS credentials.
The credentials file must export your credentials as environment variables such as below.
```shell
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_SESSION_TOKEN=...
```

## Running the Demo
After setting up the required environment and credentials you can then just run the demo script .
```shell
./demo.sh
```
After running the script an `application_url.txt` file will be generated with the URL of the demo to run on. Additinally the URL will also be displayed in the console output under `application_dns_name`.

**NOTE**
Please note that for the demo your application will be generated under a new DNS and such won't have a signed certificate and instead will use HTTP. Additionally the demo application will only last until your temporary credentials expire.


## Stopping the Demo
After finishing with the demo you need to teardown the application so it does not remain running. Once again a script has been provided for convinence.

**NOTE**
Please note that depending on how long the application was up for your credentials may have expired and new ones will need to be generated. These new credentials simply need to be copied into the credentials file again as above, replacing the existing ones.

```shell
./teardown.sh
```


# Deploying the Application

## Installing the Environment
To deploy the application both Terraform and the AWS cli tools must be installed.
To deploy the application both Terraform and the AWS cli tools must be installed. Additionally Docker needs to be installed to create the container image locally.

Some installation scripts have been provided to streamline the process for specific OSes.

Expand All @@ -17,9 +64,10 @@ The following script installs the AWS cli tool. It supports both Linux and MacOS
./install_aws.sh
```

The links for installation documentation can be found below.
- [Terraform Installer](https://developer.hashicorp.com/terraform/install)
- [AWS cli Installer](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
The links for installation documentation can be found below. Ensure you follow the correct instructions for your system.
- [Terraform Installer Guide](https://developer.hashicorp.com/terraform/install)
- [AWS cli Installer Guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
- [Docker Installer Guide](https://docs.docker.com/engine/install/)


## Self-Hosted API Tools
Expand Down
15 changes: 15 additions & 0 deletions demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Make sure Terraform is installed
(which terraform >> /dev/null) || echo "Terraform must be installed" && exit 1

# Make sure we have a credentials file
[ ! -f credentials ] && echo "Missing credentials file!" && exit 1

# Move credentials for application to access
cp credentials ./application

source credentials

terraform init
terraform apply -auto-approve -var routing_engine_url="http://router.project-osrm.org" -var geocoding_engine_url="https://nominatim.openstreetmap.org"
5 changes: 4 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash

# Ensure we have our credentials
# Make sure Terraform is installed
(which terraform >> /dev/null) || echo "Terraform must be installed" && exit 1

# Make sure we have a credentials file
[ ! -f credentials ] && echo "Missing credentials file!" && exit 1

# Move credentials for application to access
Expand Down
10 changes: 10 additions & 0 deletions generate_credentials_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Construct a credentials file
if [ ! -f credentials ]; then
echo "Generating credentials file"
touch credentials
else
echo "You already have a credentials file"
fi

0 comments on commit a0ba525

Please sign in to comment.