Once you've handled all previous steps in the "Getting started" folder, you can deploy an instance of Library right away by pressing the "Deploy to Heroku" button in the readme.
Configuring Heroku
Clicking the button will redirect you to Heroku. Either sign up or log into your account and then create a name for your new Library installation.
Set APPROVED_DOMAINS
to be a comma separated list of approved access domains. Only people who have this email domain will be able to see your Library instance.
If you wish to deploy Library with customizations, create a git repo with the files you would like to include. Set the CUSTOMIZATION_GIT_REPO
environment variable to the HTTPS cloning URL. SSH URLs will result in the following error: fatal: Could not read from remote repository
. Files in the repo and packages specified in the package.json
will be included in your Library installation.
Set DRIVE_ID
to the ID of your team's drive or shared folder. This is the string of random numbers and letters at the end of your team drive or shared folder's URL. Set DRIVE_TYPE
to folder
if you are using a shared folder, and drive
if you are using a shared drive. Note that shared drive is a paid product, so if you are creating the Library site with a free account you will likely need to use folder
.
Next, set GCP_PROJECT_ID
to the same project ID you used to set up the Cloud Datastore API when configuring API services. To find your project ID, navigate to the "IAM & admin" menu and select "Settings". Copy the value in the "Project ID" box.
GOOGLE_APPLICATION_CREDENTIALS
should always be set to parse_json
. The reasoning for this is best explained in the user authentication code.
Paste the contents of your service account JSON file into the GOOGLE_APPLICATION_JSON
field, keeping a copy of the file in a secure location. We recommend using a password manager like LastPass to keep your credentials secure and accessible. (If you haven’t completed the service account creation step, you’ll need to do that to generate this file)
You'll use your OAuth client to set the GOOGLE_CLIENT_ID
, and GOOGLE_CLIENT_SECRET
credentials. If you kept the popup open from the previous step, you can just copy/paste the values from there; if not, you can get the ID and secret by going to the “Credentials” the "Credentials" page of the console's "APIs & Services" menu and clicking on the service account name.
After adding the required information, copy and paste the client ID and client secret into GOOGLE_CLIENT_ID
, and GOOGLE_CLIENT_SECRET
, respectively.
If you want to use private NPM modules (only applicable if you are using a customization repo) you can set theNPM_TOKEN
config var. If you are using the open source release as-is, you do not need to do this.
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
Press "Deploy app" at the bottom of the screen. You’re almost done!
Finalizing the Oauth client
When the deploy completes, you’ll get a “View” button that takes you to the url for your Heroku app. The last step is we need to allow the Oauth account we configured later to work for the domain of the Library site you just created.
Back in the Google Cloud console, go to the “Credentials” section one last time.
Click the name of the OAuth client you created earlier. On the next screen click the button beneath a section labeled Authorized redirect URIs labeled “ADD URI”.
In the field that appears, paste the url for your Heroku app, adding on /auth/redirect
at the end. Note that the default Heroku install of Library uses http (not https) for the initial oauth redirect. For example:
Click “Save.” Your Library site should now be ready for use! Use the “View” below the Heroku install to get started.