Skip to content

Commit

Permalink
change deploy to s3 sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Hessu committed Feb 7, 2020
1 parent 0b16d7b commit 77679f6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 31 deletions.
5 changes: 2 additions & 3 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ phases:
- dpkg -i hugo_${hugo_version}_Linux-64bit.deb
finally:
- hugo version
- ls
build:
commands:
- hugo
- hugo deploy --maxDeletes -1
- cd public
- aws s3 sync . s3:https://www.gonzague.dev/
finally:
- echo "Script finished running"
26 changes: 2 additions & 24 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
baseURL = "https://d11kvp5ejzn9yk.cloudfront.net/"
baseURL = "https://www.gonzague.dev/"
languageCode = "fr-FR"
title = "Gonzague"
theme = "hyde"
Expand All @@ -11,26 +11,4 @@ uglyurls = true
]

[params]
description = "My personal blog where I present my work and stuff"

[deployment]
order = [".jpg$", ".gif$"]

[[deployment.targets]]
name = "s3deployment"
URL = "s3:https://blog.gonzague.pagin?region=eu-west-3"

[[deployment.matchers]]
# Cache static assets for 1 year.
pattern = "^.+\\.(js|css|svg|ttf)$"
cacheControl = "max-age=31536000, no-transform, public"
gzip = true

[[deployment.matchers]]
pattern = "^.+\\.(png|jpg)$"
cacheControl = "max-age=31536000, no-transform, public"
gzip = false

[[deployment.matchers]]
pattern = "^.+\\.(html|xml|json)$"
gzip = true
description = "My personal blog where I present my work and stuff"
2 changes: 1 addition & 1 deletion terraform/cloudfront/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "aws_cloudfront_distribution" "d" {
wait_for_deployment = false
origin {
domain_name = var.website_endpoint
domain_name = var.bucket_domain_name
origin_id = "S3-${var.bucket}"

custom_origin_config {
Expand Down
2 changes: 1 addition & 1 deletion terraform/cloudfront/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable "website_endpoint" {
variable "bucket_domain_name" {
type = string
}
variable "bucket" {
Expand Down
4 changes: 4 additions & 0 deletions terraform/s3/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ output "website_endpoint" {
output "bucket_id" {
value = aws_s3_bucket.b.id
}

output "bucket_domain_name" {
value = aws_s3_bucket.b.bucket_domain_name
}
4 changes: 2 additions & 2 deletions terraform/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ module "codebuild" {
module "cloudfront" {
source = "./cloudfront"

website_endpoint = module.s3.website_endpoint
bucket = module.s3.bucket
bucket_domain_name = module.s3.bucket_domain_name
bucket = module.s3.bucket
}

0 comments on commit 77679f6

Please sign in to comment.