The calendar needs a PostgreSQL database. You can set it up in a container or install it locally.
- Pull the PostgreSQL image:
docker pull postgres - Run the image with
docker run --name calendar-postgres -e POSTGRES_PASSWORD=some-password -p 5432:5432 -d postgres. (Name and password are just examples. If changed some of the following commands must be adjusted.) - Enter the container:
docker exec -it calendar-postgres bash. - Run
createuser -P -U postgres --superuser --login nodeand set the password to "node". - Run
createdb -U postgres schulcloud_calendar. - Run
psql -d schulcloud_calendar -U postgres. (Prompt will change toschulcloud_calendar=#.) - Grant user all permissions:
GRANT ALL PRIVILEGES ON DATABASE schulcloud_calendar TO node;(Feedback should be:GRANT) - Install uuid-ossp (install info) extension:
CREATE EXTENSION "uuid-ossp";(Feedback should be:CREATE EXTENSION) - Exit psql and the container (e.g. by pressing Ctrl+D).
- Copy files from the repository to the container:
docker cp schema.sql calendar-postgres:/tmpanddocker cp example_data.sql calendar-postgres:/tmp. - Enter the container again:
docker exec -it calendar-postgres bash. - Run
psql -U node -d schulcloud_calendar -a -f /tmp/schema.sqlto create tables. - Run
psql -U node -d schulcloud_calendar -a -f /tmp/example_data.sqlto insert example data.
PostgreSQL/bin/* folder must be accessable through shell/cmd (check environment variables) for this install guide to work. Check functionality with psql --version for example.
- Clone repository
- Install & start PostgreSQL, set and remember
postgresuser password during install - Create a user
node, without password:createuser -U postgres --superuser --login node - Create a database named
schulcloud_calendar:createdb -U postgres schulcloud_calendar - Connect to it:
psql -d schulcloud_calendar -U postgres(Prompt will change toschulcloud_calendar=#) - Grant user with
allpermissions for the db:grant all privileges on database schulcloud_calendar TO node;(Feedback should be:GRANT) - Install uuid-ossp (install info) extension:
CREATE EXTENSION "uuid-ossp";Feedback should be:CREATE EXTENSION - Create tables with
psql -U node -d schulcloud_calendar -a -f schema.sql - Insert example data using
psql -U node -d schulcloud_calendar -a -f example_data.sql
(If you get fe_sendauth: no password supplied errors on commands, edit your [installdir]\data\pg_hba.conf and set METHOD to trust in all lines.)
- Run
npm install - Run
npm start
- Create a database named
schulcloud_calendar_testand setup as described above - Create tables with
psql -U node -d schulcloud_calendar_test -a -f schema.sql - Run
npm test