Skip to content

Installation guide

Ruslan edited this page Dec 30, 2019 · 12 revisions

Requirements

  • Google OAuth credentials (PRs for other auth methods are welcome)
  • SMTP server
  • PostgreSQL database
  • Docker

Step 1: Setup Google OAuth credentials

Go to https://console.cloud.google.com/apis/credentials and add new OAuth client ID with the following info:

Application type: Web application
Authorized JavaScript origins: YOUR_HOSTNAME
Authorized redirect URIs: YOUR_HOSTNAME/auth/google/callback

Step 2: Prepare SMTP credentials

Make sure that your SMTP is working correctly and you can send emails from a custom address that you’ll later add as SMTP_FROM_EMAIL config option.

Step 3: Prepare config file

Create a file 10books_config.list with following options:

Key Description
GOOGLE_OAUTH_ALLOWED_DOMAINS Whitelist of allowed domains for google OAuth e.g. gmail.com or gmail.com,10clouds.com
GOOGLE_OAUTH_CLIENT_ID Google OAuth client id
GOOGLE_OAUTH_CLIENT_SECRET Google OAuth client secret
SECRET_KEY Secret string of minimum 64 characters used to encrypt session cookies. You can generate one using docker run 10clouds/10books gen_session_key
HOSTNAME Hostname that is used to build links e.g. books.yourcompany.com
SMTP_FROM_EMAIL Notifications will be sent from this email
SMTP_SERVER -
SMTP_PORT -
SMTP_USERNAME -
SMTP_PASSWORD -
DB_USERNAME PostgreSQL username
DB_PASSWORD PostgreSQL password
DB_NAME PostgreSQL database name
DB_HOST PostgreSQL host

Example file:

  • Values MUST NOT have quotes.
  • Make sure that you have crated database for DB_NAME
GOOGLE_OAUTH_ALLOWED_DOMAINS=gmail.com
GOOGLE_OAUTH_CLIENT_ID=1042788706751-9blqj83j8r127qc0hlecf23is1erkhpc.apps.googleusercontent.com
GOOGLE_OAUTH_CLIENT_SECRET=UZUeRQHF6CljecqlQGOHECVO

SECRET_KEY=90TPoGdryieabz86ETtAfdDGRoPEiQS5hUwPPjW6knnwiyy6IOy84SSqdD6zhmiP
HOSTNAME=localhost

SMTP_FROM_EMAIL=books@10clouds.com
SMTP_SERVER=localhost
SMTP_PORT=25
SMTP_USERNAME=test
SMTP_PASSWORD=test

DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_NAME=prod_10books
DB_HOST=host.docker.internal

Step 4: Start a docker container

sudo docker run -d -p 80:80 --restart=unless-stopped --env-file ./10books_config.list 10clouds/10books

It should take about 30 seconds to start the app.

Step 5: Set an admin user

Each time a new user logs in with Google, a record in users table will be created.

To set up the first admin user you'll need to manually set is_admin to true for that user in PostgreSQL, for example, using SQL query UPDATE users SET is_admin = true WHERE email = 'ruslan.savenok@10clouds.com';

Once the first admin is assigned, they'll be able to add additional admins from a web UI /admin/users

Clone this wiki locally