Version 0.1.0
- platform website deployment is working.
- platform lambda GraphQL endpoint deployment is working.
- This repo contains everything to spin up new production / development / test environments on AWS.
- The idea here is that production / development / test environments should be almost identical.
- To spin up a new environment you either create a new
branch
orfork
of yourmaster
. Then you create a new AWS account, update the configuration files and deploy your new environment. - Batteries included and completely serverless*:
- Websites for your domain via S3 Bucket, CloudFront Distribution, Route53 DNS, ACM Certificate.
- React, Webpack.
- React-Native App.
- GraphQL Lambda Backend.
- Cognito Indentity and User Pools.
- ...
-
Create a new
AWS Account
for your newEnvironment
. -
Create a new
IAM User
calledterraform
withAdministratorAccess
permissions and save theaccess key
andsecret key
somewhere safe. -
Create an
aws-cli
profile calledplatform-terraform
in your local~/.aws/credentials
file with those credentials. -
In the
platform
folder create a file called.aws.tfvars
and put theaccess key
andsecret key
there.aws_access_key = "XXXXXXXXXXXXXXXXXXXX" aws_secret_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
-
In the
platform
folder create a file called.platform.tfvars
and update it to match your newenvironment
.aws_region = "us-east-1" environment = "BaaSPlatform" platform_domain = "baas.com" email_domain_verification_cname_name = "xxxxxxxxxx" email_domain_verification_cname_value = "zmverify.zoho.com" email_mx_record_values.1 = "10 mx.zoho.com" email_mx_record_values.2 = "20 mx2.zoho.com" platform_domain_certificate_arn = "arn:aws:acm:xxxxxxxxx:xxxxxxxxxxxx:certificate/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" product_domain = "visa.baas.com" product_subdomain_ns_record_values.1 = "ns-1111.awsdns-11.com" product_subdomain_ns_record_values.2 = "ns-2222.awsdns-22.org" product_subdomain_ns_record_values.3 = "ns-3333.awsdns-33.co.uk" product_subdomain_ns_record_values.4 = "ns-4444.awsdns-44.net"
-
You might have to adjust
.platform.tfvars
andmain.tf
to match you particular requirements.- Maybe your
email provider
requires a differentdomain verification method
. - Maybe you bring your own
SSL Domain Certificate
rather than usingAWS ACM Certificates
.
- Maybe your
-
In this example we are going for the
cheapest
possible solutions.Zoho Mail
offers afree mail account
for your own domain.AWS
gives you afree SSL Domain Certificate
via theCertificate Mananger
.
-
After everything has been setup you can now prepare the
lambdas
andwebsites
for yourenvironment
.- Run
npm run platform:install
to load all dependencies.
- Run
-
To make sure everything is setup correctly you can
plan
youdeployment
.- Run
npm run platform:plan
to make sure everything is ready to be deployed.
- Run
-
Now you are ready to
deploy
yourenvironment
.- Run
npm run platform:deploy
to actually deploy allresources
of yourenvironment
.
- Run
Congratulations, your new environment
should be up and running in the cloud
now.
Now you can make changes to lambdas
or the websites
and simply deploy them with npm run platform:deploy
.
Basically you do exactly the same again for each of your product environments.
Every product environment will also get its own AWS account.
Obviously the product environments will be more or less different but the build and deployment processes are pretty much the same.
Just have a look in the Product
folder and the package.json
for an example.
To demonstrate all the complexity around enterprise environments this repo has two logical parts.
The platform contains the public marketing page and can be branded, so that you can resell the complete platform.
The products are the actual services within the platform offering and contain the private web and mobile apps the users log into.
Register a domain and make sure to provide valid contact details!
Set the domain in the .platform.tfvars file
.
Register the domain with an email provider like zoho.com
.
Get the CNAME
name and value from the provider to verify the domain ownership.
Set these in your .platform.tfvars file
.
Use the AWS Certificate Manager to request a new certificate.
Include the domain.com
and www.domain.com
in the certificate.
This will send a confirmation email for each included domain to your registered domain contact details.
Confirm both emails and in the AWS Certificate Manager check that the certificate has status issued
.
Get the ARN of the certificate and set it in you .platform.tfvars
file.
For each Production Environment
there is a dedicated AWS Account
.
This is the Manapaho Platform
Marketing and Administration.
manapaho.com
www.manapaho.com
This is a Direct Customer
on the Manapaho Platform
.
bnz.manapaho.com
www.bnz.manapaho.com
*.bnz.manapaho.com fonterra.bnz.manapaho.com
This is a Platform Reseller
. Selling the platform as Wessels Platform
to its own customers.
wessels.com
www.wessels.com
This is a Direct Customer
on the Wessels Platform
.
anz.wessels.com
www.anz.wessels.com
*.anz.wessels.com barfoot.anz.wessels.com
This is a Direct Customer
on the Wessels Platform
bringing their own domain.
westpack-q.com
www.westpack-q.com
*.westpack-q.com farmhouse.westpack-q.com
For each Development Environment
there is a dedicated AWS Account
.
Every development will be made using the manapaho-dev.com
domain.
manapaho-dev.com
www.manapaho-dev.com
wessels.manapaho-dev.com
www.wessels.manapaho-dev.com
anz.wessels.manapaho-dev.com
www.anz.wessels.manapaho-dev.com
*.anz.wessels.manapaho-dev.com
new-card-wizard-feature.wessels.manapaho-dev.com
www.new-card-wizard-feature.wessels.manapaho-dev.com
*.new-card-wizard-feature.wessels.manapaho-dev.com