Simple gallery website for promoting an artist.
It takes google spreadsheets describing artworks and deploys a 100% front application to display them.
These are the step to follow in order to have your site deployed:
Choose an site_id for your site, something short and meaningful (with letters and digits).
You should have your google spreadsheet artworks catalog ready, with at least a few artworks in it to start with. Report to this doc for informations about gallery spreadsheet datasources and how to create one.
Create a folder named like your site_id in the folder sites
.
Create a file sites/[site_id]/input/config.json
, you can copysites/demo/input/config.json
to create your own and customize.
Report to this doc for detailed information.
it's time to absorb the content of the source spreadsheet, execute :
$ SITE=[site_id] ./gallery.sh ingest
This should produce a file : sites/[site_id]/public/artwork.json
Put the images corresponding to your artworks in a new folder sites/[site_id]/input/images
Each file should be named [artwork_id].[ext]
where artwork_id is the id of artwork in the source spreadsheet and ext is either 'jpg' either 'webp'.
For better results images shoéuld be in lossless webp format and width should be greater than 2400 pixels.
Ask the gallery CLI tool to do the resizing of the artworks images :
$ SITE=[site_id] ./gallery.sh resize
this should produce all variants of resized images in sites/[site_id]/public/artworks/images
.
It's now to build the web app.
$ SITE=[site_id] ./gallery.sh build_front
now you should be able to preview using
$ SITE=[site_id] ./gallery.sh preview_front
terraform does the provisionning of the needed resource on GCP :
- buckets (one per site), public access
- static IP to be attached to the server virtual machine
- artifact repository for storing docker images of the server
It can be done only when the first site is configured.
$ ./gallery.sh terraform_config # this create the terraform configuration file : terraform/terraform.tfvars.json
$ ./gallery.sh terraform init # terrform will load GCP related terraform providers : should be done once only
$ ./gallery.sh terraform apply # this does the provisionning
once the infrastructure is created you'll need to map your domain names to the reserved static IP.
find the static ip using
$ ./gallery.sh terraform output
# outputs:
# gallery_server_ip = "xxx.xxx.xxx.xxx"
Go to your domain name registrar and create/update the A records so that it points to that IP.
NAME TYPE DATA
@ A <you static ip>
TODO maybe
Here are all available CLI commands and what they do. Details in the next sections
command | purpose |
---|---|
Common | |
ingest | read spreadsheet of a site to generate the artworks.json database file |
assets | reduce and upload all assets of site in a dedicated bucket |
This the operation reading the source speadsheet of a site and generating the artworks.json file from it.
$ SITE=[site_id] ./gallery.sh ingest
creates resized versions of source artworks
$ SITE=[site_id] ./gallery.sh resize
Sent all resized images to GCP buckets
$ SITE=[site_id] ./gallery.sh sync_bucket
Using SWS (+link)
$ ./gallery.sh build_server
then
$ ./gallery.sh deploy_server
option -d
for building dev image suitable for local testing.
Specificities:
- uses port 8080 on host to relay container port 80
- virtual host configuration refers to port 8080
In order to test the image locally you would have to
- first ingest the datasheet, the build the front
- modifiy
/etc/hosts
to have your domain names point to127.0.0.1
- don't forget to remove these lines when testing prod
- build image
$ ./gallery.sh build_server_dev
- run image
$ cd sites
$ docker build . -t gallery && docker run --rm --name gallery_instance -p 8080:80 gallery
- browse
http://<domain_name>:8080
$ SITE=X ./gallery.sh deploy_server
...
ERROR: (gcloud.compute.instances.create-with-container) Could not fetch resource:
---
code: ZONE_RESOURCE_POOL_EXHAUSTED
There is no available VM with requested specifications in the requested zone? Try another zone by chabnging server_zone in global configuration