From 54a75ffd7e9c62fd2b71dc6317ab1dc9b090b547 Mon Sep 17 00:00:00 2001 From: bmccandless Date: Thu, 26 Mar 2020 15:03:37 -0700 Subject: [PATCH] Add support to include static files into the eb deployment (#1305) Mostly this is just instructions for how to do this, with a small addition to the makefile. This enables support for serving the about_legal_tos and about_legal_privacy from the cellxgene server. --- server/eb/Makefile | 4 ++++ server/eb/README.md | 58 +++++++++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/server/eb/Makefile b/server/eb/Makefile index 66ab68a5..a99654c6 100644 --- a/server/eb/Makefile +++ b/server/eb/Makefile @@ -23,6 +23,10 @@ build: clean if [ -f config.yaml ] ; then \ cp config.yaml artifact.dir; \ fi; \ + if [ -d static ] ; then \ + mkdir -p artifact.dir/server/common/web/static/deploy; \ + cp -r static/* artifact.dir/server/common/web/static/deploy; \ + fi; \ (cd artifact.dir; \ cp -r server/common/web/static static; \ zip -r ../artifact.zip . --exclude server/test/\* server/eb/\* ; ); \ diff --git a/server/eb/README.md b/server/eb/README.md index c9c43864..0d529045 100644 --- a/server/eb/README.md +++ b/server/eb/README.md @@ -62,40 +62,68 @@ There are many more options to these commands that may be important or necessary and cannot be enabled using configuration. They may be enabled manually by modifying app.py, however this is not supported or recommended at this time. -4. Create the artifact.zip file for the application +4. Prepare static endpoints + + The cellxgene server can server additional static webpages that may be associated with the deployment. + These include the about_legal_tos (terms of service), and bout_legal_privacy, for example. + To use this feature, do the following: + + * In this directory, create a sub directory called "static". + * Copy the files you want to server into this directory + * modify your configuration file to set the location to these file: /static/deploy/ + + Example: you want to include an "about_legal_tos" and "about_legal_privacy" page to cellxgene. + Assume files called "tos.html" and "privacy.html" exist. ``` - make build + $ mkdir static + $ cp /tos.html static/tos.html + $ cp /privacy.html static/privacy.html + + # edit config.yaml + $ grep "/static/deploy" config.yaml + about_legal_tos: /static/deploy/tos.html + about_legal_privacy: /static/deploy/privacy.html ``` -5. Create an environment + The next step will place these files into the deployment. + +5. Create the artifact.zip file for the application + + ``` + $ make build + ``` + +6. Create an environment ``` # name of the environment - EB_ENV=cellxgene-env - # type of ec2 instance to run the cellxgene server. - EB_INSTANCE=m5.large - # One or both of the following environment variables needs to be set - CXG_DATAROOT= - CXG_CONFIG_FILE= + $ EB_ENV=cellxgene-env - eb create $EB_ENV --instance-type $EB_INSTANCE \ + # type of ec2 instance to run the cellxgene server (for example) + $ EB_INSTANCE=m5.large + + # One or both of the following environment variables needs to be set + $ CXG_DATAROOT= + $ CXG_CONFIG_FILE= + + $ eb create $EB_ENV --instance-type $EB_INSTANCE \ --envvars CXG_DATAROOT=$CXG_DATAROOT,CXG_CONFIG_FILE=$CXG_CONFIG_FILE ``` -6. Give the elastic beanstalk environment access to the S3 bucket. +7. Give the elastic beanstalk environment access to the S3 bucket. This link may provide some useful information: https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-s3-bucket-instance/ -7. Deploy the application +8. Deploy the application ``` - eb deploy $EB_ENV + $ eb deploy $EB_ENV ``` -7. Open the application in a browser +9. Open the application in a browser ``` - eb open $EB_ENV + $ eb open $EB_ENV ```