preact-redux-isomorphic
preact-redux-isomorphic copied to clipboard
serverless set up
Hey, I'm really interested in the serverless set up - do you think you could include the terraform scripts in the repo or a gist? I tried following the instructions but got lost - I think the script will be a bit more explicit.
Great boilerplate btw
I recommend preact-cli / PR #11, lots of work done for serverless prerendering.
Am 01.06.2017 10:06 schrieb "Copple" [email protected]:
Hey, I'm really interested in the serverless set up - do you think you could include the terraform scripts in the repo or a gist? I tried following the instructions but got lost - I think the script will be a bit more explicit.
Great boilerplate btw
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BerndWessels/preact-redux-isomorphic/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AAepgoq3EnhV8GlviwsR_6jaxzZ4bO_7ks5r_nEHgaJpZM4NsoKJ .
@kiwicopple You can find a complete example with terraform infrastructure here.
It automatically builds the domain and complete infrastructure for it and the preact website in a Lambda with SSR and static resources in S3. Its live at wessels.nz
Let me know what you think and if you have any more questions.
This is a really great set of scripts, thanks @BerndWessels !!
Perhaps one more question - I have the cloudfront distro set up, but I'm getting errors when I try to access it via my website. I have Route53 Record Set with an Alias target that is equal to the cloudfront URL, but I can't quite figure it out.
I'll drop the full set of steps I took below, since I figure someone else may find them useful. My first time with terraform, it was quite enjoyable
Prereq's
- Make sure you have created an IAM role with AWSLambdaBasicExecutionRole and CloudWatchLogsFullAccess
- Make sure you have added your ssh key to your github account (this is required for the
terraform get
command later) - Create a certificate for your domain if you don't already have one using AWS Certificate manager (this had to be in the us-east-1 region for some reason?)
Instructions
- Fork repo - https://github.com/wessels-nz/infrastructure-modules (this is required for the
terraform get
command later) - clone the repo to local
-
cd platform-api
- this is the "master" terraform -
terraform get
- this will pull down all the required submodules for the master terraform - Create a file in this folder that is called
prod.tfvars
that has the terraform vars (example below) - Run
terraform apply -var-file="prod.tfvars"
- upload
/Path/to/preact-redux-isomorphic/dist/client/*
into the newly created bucket in a subfolder_
- wait for the cloudfront distro to populate completely
- point your DNS to the new cloudfront distro's domain name
- visit website (this is the part I am getting an error, could have something to do with Cert, but i'm not sure how to diagnose the problem yet)
- send thanks to @BerndWessels
Example prod.tfvars
domain_certificate_arn = "arn:aws:acm:us-east-1:XXXX:certificate/XXX-XX-XXX-XXX"
domain_name = "app.yourdomain.com"
region = "ap-southeast-1"
stage_description = "Production website"
stage_name = "live"
website_lambda_filename = "/Path/to/preact-redux-isomorphic/dist/Archive.zip"
website_lambda_role_arn = "arn:aws:iam::XXXX:role/service-role/XXXXNAME"
Looks like it may have resolved itself. Perhaps just a propagation issue - feel free to close this one off