Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Bootstrap for dev/prod environment for QuestionIt.space

Notifications You must be signed in to change notification settings

alkihis/questionit.bootstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

QuestionIt.space developer environment

QuestionIt Logo

Contribute

Feature request? Bug?

Don't create an issue on that repository!

Create an issue either on client (if this is related to QuestionIt.space website) either on server (if this is related to API) repository.

Setup environment

Developer environment requires:

Clone repositories

git clone [email protected]:alkihis/questionit.bootstrap.git bootstrap
cd bootstrap

git clone [email protected]:alkihis/questionit.api-v2.git server
git clone [email protected]:alkihis/questionit.space-v2.git client

Setup environment variables

Copy bootstrap.env.dist to bootstrap.env, and fill it with your own variables.

Warning: Fill bootstrap.env before starting any container!

Init project

docker volume create migrate_mysql_db
docker volume create psql_db
docker volume create redis_single_persist

docker compose up -d postgres
docker compose exec postgres psql -U postgres
CREATE DATABASE questionit;
\c questionit

-- The super user, which can start migrations
CREATE USER questionitsu SUPERUSER PASSWORD 'xxxxx';

-- The regular user, used by the server
CREATE USER questionit NOSUPERUSER NOCREATEDB NOCREATEROLE PASSWORD 'xxxxx';

-- Create unaccent extension
CREATE EXTENSION unaccent;
\q
docker compose build api
docker compose run -e NODE_ENV=development api yarn
# Needed to have dist/ folder
docker compose run -e NODE_ENV=production api yarn build

# Build all empty database tables
docker compose run api yarn run:migration

# Allow usage of db to classic user
docker compose exec postgres psql -U postgres
\c questionit
GRANT CONNECT ON DATABASE questionit TO questionit;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO questionit;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO questionit;
\q

You're ready to start services!

Start services

docker compose up -d web

About

Bootstrap for dev/prod environment for QuestionIt.space

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published