-
Notifications
You must be signed in to change notification settings - Fork 0
Setup Guide
-
Clone BE repository and run
npm install -D
to install all required dependencies -
Create Docker PostgreSQL container. Skip this step if you have already installed PostgreSQL/pgAdmin locally.
- Use
docker pull postgres:12.1-alpine
to download image.
PostgreSQL Docker image - https://hub.docker.com/_/postgres - Run image using the following command:
docker run --name ss-postgres --publish 5432:5432 postgres:12.1-alpine
(12.1-alpine is the current version as of 3.12.20.
It may be a different version now. Use the above link to check version and change run command as needed)
- Use
-
Add the following environment variables in a .env file, Note that the DATABASE_URL needs to match your local database settings, protocol://username:password@address:port/postgres
PORT=5000 JWT_SECRET=Its a secret (example - create your own) SECRET_SIGNATURE=Its a secret (example - create your own) DATABASE_URL=postgresql://postgres:1234@localhost:5432/postgres AWS_ACCESS_KEY='THE_EMAIL_AND_IMAGE_UPLOAD_SERVICE_AWS_ACCESS_KEY' AWS_SECRET_KEY='THE_EMAIL_AND_IMAGE_UPLOAD_SERVICE_AWS_SECRET_KEY' BE_ENV=development DS_API_URL=DS API URL DS_API_KEY=DS API Key
-
Run migrations and seeds using the following commands:
npm run latest
npm run seed
-
Start backend
npm start
- nodemon can be used, but may crash during image-upload from the Google-Vision library.
These instructions will help you quickly edit the database to get an active-prompt so you can submit ASAP without running the startGame function. (Due to the S3 Security settings, you cannot submit an image locally without letting us know so we can add your information!)
- Navigate to PGAdmin
- Under the database, open tables, then view all rows for
prompts
- Set one prompt to
active=true
(for this example set prompt id 6) and click save (the table icon) - Right click the prompt_queue table and open "Query-Tool"
- In the textbox, write:
UPDATE prompt_queue SET queue = '6';
and click the play button. - You should now have an active-prompt to submit to
For an account to have administrative route permissions, they must exist in the admins table. This table does not have an index, so you must query the id in similar to the following: INSERT INTO admins (uid) VALUES (<uid>)
which will then allow signed tokens from that user to have access to admin-restricted routes.
- npm run server/go to start the local server with auto restart on change - (May crash on image uploads)
- npm run start to start production version (Regular node)
- npm run rollback revert running most recent migration(s)
- npm run latest migrate database to the latest schema
- npm run seed wipe database and write seed data
- npm run dev wipe the database, migrate latest, run seeds