Docker Compose example:
version: '3.7'
services:
web:
image: ghcr.io/codeths/kitcoin/kitcoin:latest
restart: unless-stopped
init: true
ports:
- 8000:8000
container_name: kitcoin
volumes:
- './keys.json:/app/dist/config/keys.json'
- './uploads/storeitems:/app/uploads/storeitems'
Create a config file called keys.json in that direcory.
- Clone the repo:
git clone git@github.com:codeths/kitcoin.git
- Copy
src/config/keys.example.json
tosrc/config/keys.json
and set it up. See the config section for details. - Run
npm install
. - Run
npm run build
.
Use npm start
to run. pm2 or equivalent is recommended.
npm run dev
will start node and listen to commands to easily manage the process:
rs
,restart
,node
- Restart nodebuild
,gulp
- Run a full build (equivalent tonpm run build
)ts
,typescript
- Build typescript onlyfe
,frontend
- Build frontend onlycp
,copy
- Copy non-typescript files to diststop
,abort
,close
,cancel
,exit
- Stop node and exit prompt
All build commands will also restart node. Make sure to use build
the first time you start dev.
If you would like to watch for file changes and automatically execute the appropriate build command, use npm run watch
. This has the same commands available as above.
property | type | description | example |
---|---|---|---|
mongo | string | MongoDB Connection URL | mongodb://user:pass@127.0.0.1:27017/db |
port | number | port to listen on | 8000 |
client_id | string | Google OAuth client ID | |
client_secret | string | Google OAuth client secret | |
oauthDomain | string | null | Google OAuth domain, or null to disable | mydomain.com |
sessionSecret | string | Session secret for Mongo | |
weeklyBalance | number | Staff's weekly balance | 100 |
gadmin_domain | string | null | Domain to use for Google Admin syncing | mydomain.com |
gadmin_staff_ou | string[] | null | Staff OU names for Google Admin syncing | ["Staff", "Some OU/Admins"] |
gadmin_ignore_ou | string[] | null | Excluded OU names for Google Admin syncing | ["Old students"] |
gadmin_sync_user | string | null | User to run daily Google Admin/Sheets sync | |
sync_spreadsheet_id | string | null | Google Sheet for student ID sync |
- Create a Google Cloud Project
- Go to APIs & Services > Library. Enable the Google Classroom API, Google People API, Admin SDK API, and Google Sheets API.
- Go to APIs & Services > OAuth consent screen. Setup as desired.
- Go to APIs & Services > Credentials. Click "Create credentials" and select "OAuth client ID".
- Select "Web application" for the type. Add your domain to the authorized origins. For redirect URIs, add your domain with the path
/auth/cbk
. - Create the Client ID. Copy the client ID and client secret to the config file as shown above.