Skip to content

Commit

Permalink
Merge pull request #55 from aehrc/dev
Browse files Browse the repository at this point in the history
Documentation update
  • Loading branch information
anuradhawick authored Apr 19, 2023
2 parents 3a84474 + 2aa6808 commit 05067f0
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 38 deletions.
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Serverless Beacon
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

![assets/logo-black.png](assets/logo-black.png)

## Why serverless?
Serverless means the service does not require any servers to be provisioned. The
idea is to minimise running costs, as well as support arbitrary scalablility. It
Expand All @@ -21,7 +23,7 @@ cd terraform-aws-serverless-beacon

### Option 1: Setting up the development environment

Skip to next section if you're only interested in deployment or using a different architecture compared to AWS lambda environment.
Skip to next section if you're only interested in deployment or using a different architecture compared to AWS lambda environment. The following setup must be performed on a latest Amazon Linux instance to match the lambda runtimes. If this is not a viable option, please resort to using Docker.

Run the following shell commands to setup necessary build tools. Valid for Amazon Linux development instances.

Expand All @@ -42,11 +44,11 @@ make
sudo make install
```

Make sure you have a terraform version newer than `Terraform v1.1.6` if you're not using the docker image. Run the following command to get the terraform binary.
Make sure you have a terraform version newer than `Terraform v1.3.7` if you're not using the docker image. Run the following command to get the terraform binary.

```bash
wget https://releases.hashicorp.com/terraform/1.2.8/terraform_1.2.8_linux_386.zip
sudo unzip terraform_1.2.8_linux_386.zip -d /usr/bin/
wget https://releases.hashicorp.com/terraform/1.2.8/terraform_1.3.7_linux_386.zip
sudo unzip terraform_1.3.7_linux_386.zip -d /usr/bin/
```

### Option 2: Using the docker image
Expand Down Expand Up @@ -98,12 +100,6 @@ terraform apply
Your beacon deployment could be a part of a larger program with a front-end and other services. In that case, on the parent folder that the repo folder resides, create a `main.tf` file.
```bash
# main.tf

provider "aws" {
# aws region
region = "REGION"
}

module "serverless-beacon" {
# repo folder
source = "./terraform-aws-serverless-beacon"
Expand All @@ -119,8 +115,8 @@ module "serverless-beacon" {
# aws region
region = "REGION"
}

```
Please refer to [./examples](./examples) to find a minimal and a complete setup.
## Development

All the layers needed for the program to run are in layers folder. To add a new layer for immediate use with additional configs, run the following commands. Once the decision to use the library is finalised update the `init.sh` script to automate the process.
Expand Down Expand Up @@ -149,7 +145,7 @@ cp lib terraform-aws-serverless-beacon/layers/<Library Name>/

* Collaborative development

Please make a copy of `backend.tf.template` with suited parameters and rename as `backend.tf`. Refer to documentation for more information [https://www.terraform.io/language/settings/backends/configuration](https://www.terraform.io/language/settings/backends/configuration).
Please make a copy of `backend.tf.template` with suited parameters and rename as `backend.tf`. Refer to documentation for more information [https://www.terraform.io/language/settings/backends/configuration](https://www.terraform.io/language/settings/backends/configuration). If this is not done, make sure the terraform lock and state files are stored securely to avoid infrastructure-vs-code inconsistencies. Please refer to [./examples/full](./examples/full) to find a an example backend.

## API

Expand Down
Binary file added assets/logo-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo-tile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions backend.tf.template
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
terraform {
backend "s3" {
bucket = "sbeacon-terraform-states"
key = "sbeacon"
region = "ap-southeast-2"
bucket = "sbeacon-terraform-states"
key = "sbeacon"
region = "ap-southeast-2"
dynamodb_table = "terraform-state-locks"
}
}

8 changes: 8 additions & 0 deletions examples/full/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
backend "s3" {
bucket = "sbeacon-terraform-states"
key = "sbeacon"
region = "ap-southeast-2"
dynamodb_table = "terraform-state-locks"
}
}
38 changes: 29 additions & 9 deletions examples/full/main.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
provider "aws" {
region = "ap-southeast-2"
}

module "serverless-beacon" {
region = "us-east-1"
source = "../.."
beacon-id = "au.csiro-serverless.beacon"
beacon-name = "CSIRO Serverless Beacon"
organisation-id = "CSIRO"
organisation-name = "CSIRO"
common-tags = {
stack = "serverless-beacon"
stack = "serverless-beacon"
environment = "dev"
}
variants-bucket-prefix = "sbeacon-variants-"
metadata-bucket-prefix = "sbeacon-metadata-"
lambda-layers-bucket-prefix = "sbeacon-lambda-layers-"
beacon-id = "au.csiro.sbeacon"
beacon-name = "CSIRO Serverless Beacon"
beacon-api-version = "v2.0.0"
beacon-environment = "dev"
beacon-description = "Serverless Beacon (sBeacon)"
beacon-version = "v0.1.0"
beacon-welcome-url = "https://bioinformatics.csiro.au/"
beacon-alternative-url = "https://bioinformatics.csiro.au/"
beacon-create-datetime = "2018-11-26H00:00:00Z"
beacon-update-datetime = "2023-03-16H00:00:00Z"
beacon-handovers = "[]"
beacon-documentation-url = "https://github.com/EGA-archive/beacon2-ri-api"
beacon-default-granularity = "boolean"
beacon-uri = "https://beacon.csiro.au"
organisation-id = "CSIRO"
organisation-name = "CSIRO"
beacon-org-description = "CSIRO, Australia"
beacon-org-address = "AEHRC, Westmead NSW, Australia"
beacon-org-welcome-url = "https://beacon.csiro.au"
beacon-org-contact-url = "https://bioinformatics.csiro.au/get-in-touch/"
beacon-org-logo-url = "https://raw.githubusercontent.com/aehrc/terraform-aws-serverless-beacon/master/assets/logo-tile.png"
beacon-service-type-group = "au.csiro"
beacon-service-type-artifact = "beacon"
beacon-service-type-version = "1.0"
}
2 changes: 1 addition & 1 deletion examples/full/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output "api_url" {
value = module.serverless-beacon.api_url
value = module.serverless-beacon.api_url
description = "URL used to invoke the API."
}
17 changes: 8 additions & 9 deletions examples/minimum/main.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
provider "aws" {
region = "ap-southeast-2"
}

module "serverless-beacon" {
source = "../.."
beacon-id = "au.csiro-serverless.beacon"
beacon-name = "CSIRO Serverless Beacon"
organisation-id = "CSIRO"
organisation-name = "CSIRO"
source = "../.."
beacon-id = "au.csiro-serverless.beacon"
variants-bucket-prefix = "sbeacon-"
metadata-bucket-prefix = "sbeacon-metadata-"
lambda-layers-bucket-prefix = "sbeacon-lambda-layers-"
beacon-name = "CSIRO Serverless Beacon"
organisation-id = "CSIRO"
organisation-name = "CSIRO"
}
2 changes: 1 addition & 1 deletion examples/minimum/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output "api_url" {
value = module.serverless-beacon.api_url
value = module.serverless-beacon.api_url
description = "URL used to invoke the API."
}
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ variable "beacon-org-address" {
variable "beacon-org-welcome-url" {
type = string
description = "Value for beacon organisation welcome url"
default = "https://beacon.csiro.au"
default = "https://bioinformatics.csiro.au/"
}

variable "beacon-org-contact-url" {
Expand All @@ -155,7 +155,7 @@ variable "beacon-org-contact-url" {
variable "beacon-org-logo-url" {
type = string
description = "Value for beacon organisation logo url"
default = "https://bioinformatics.csiro.au/covid-19-sbeacon/"
default = "https://raw.githubusercontent.com/aehrc/terraform-aws-serverless-beacon/master/assets/logo-tile.png"
}

# Beacon service variables
Expand Down

0 comments on commit 05067f0

Please sign in to comment.