Blue green deployments and a better way of getting real files links into hugo

This commit is contained in:
shockrah 2024-02-19 18:22:08 -08:00
parent 49127eb191
commit b4eec03391
2 changed files with 29 additions and 17 deletions

View File

@ -3,6 +3,7 @@ image: shockrah/website:latest
stages: stages:
- build - build
- deploy - deploy
- golive
############## ################## ############## ############## ################## ##############
@ -44,3 +45,23 @@ deploy-to-s3:
# Upload the content to the bucket itself # Upload the content to the bucket itself
- cd main-site/ && aws s3 cp public s3://temper.tv/ --recursive - cd main-site/ && aws s3 cp public s3://temper.tv/ --recursive
############## ################## ##############
############## Refresh Container ##############
############## ################## ##############
blue-green-deployment-nginx:
stage: golive
image:
name: amazon/aws-cli:2.2.25
entrypoint: [""]
needs:
- deploy-to-s3
vars:
service: athens-nginx-static-content
cluster: athens-alpha-cluster
before_script:
- bash ci/verify-aws-fields.sh
script:
- aws ecs update-service --cluster $cluster --service $service --force-new-deployment

View File

@ -12,31 +12,22 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
<p>{{ .Content }}</p> <p>{{ .Content }}</p>
{{ $colors := slice "cyan" "yellow" "pink"}}
{{ if hasPrefix $path "files" }} {{ if hasPrefix $path "files" }}
{{ $colors := slice "cyan" "yellow" "pink"}} {{ range $folder, $files := .Params.folders }}
{{ $opts := len $colors }} {{ $opt := mod (len $folder) (len $colors) }}
{{ range $i, $top := readDir "content/files/" }} <div class="card" style="border-color: {{ index $colors $opt }}">
<!-- Skip non - directories --> <h5 class="card-header postcard card-title">{{ $folder }}</h5>
{{ if eq $top.IsDir false }} {{ continue }} {{ end }} {{ range $file := $files }}
<!-- Generate card for each folder -->
<div class="card" style="border-color: {{ mod $i $opts | index $colors }}">
<h5 class="card-header postcard card-title">{{ $top.Name }}</h5>
<!-- generate links for all the folder's files -->
{{ range $file := print "content/files/" $top.Name | readDir }}
<ul> <ul>
<a href="{{ print "/files/" $top.Name "/" $file.Name }}"> <a href={{ print "/files/" $folder "/" $file }}>{{ $file}}</a>
{{ print $file.Name }}
</a>
</ul> </ul>
{{ end }} {{ end }}
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $colors := slice "cyan" "yellow" "pink"}}
{{ $opts := len $colors }}
{{ range $i, $page := .Pages.ByDate.Reverse }} {{ range $i, $page := .Pages.ByDate.Reverse }}
{{ $opt := mod $i $opts }} {{ $opt := mod $i (len $colors) }}
<div class="card" style="border-color: {{ index $colors $opt }}"> <div class="card" style="border-color: {{ index $colors $opt }}">
<a href="{{ anchorize .Page.Name }}"> <a href="{{ anchorize .Page.Name }}">
<h5 class="card-header postcard card-title">{{ .Title }}</h5> <h5 class="card-header postcard card-title">{{ .Title }}</h5>