Skip to content

How to use

laimikko1 edited this page Jun 7, 2018 · 5 revisions

Follow these steps in order.

(Use Linux.)

- Cloning the project

  • clone the project and create your own local copy of the repository

- Getting database up and running:


  • Option 1 (PREFERRED METHOD):

Download Docker. Follow the instructions on https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-from-a-package

Check to make sure Docker daemon is running by typing

sudo systemctl status docker

If it is not, type

sudo systemctl start docker

After you've downloaded Docker, you need to install Docker Compose. Follow the instructions on

https://docs.docker.com/compose/install/

Create docker-compose.yml into some directory outside of the project directory (one level up) with the content:

version: '2'
services:
   db:
    environment:
      PGDATA: /data/pg10.1_labtool_2018k
    image: postgres:10.1
    ports:
      - "5432:5432"
    restart: unless-stopped

You might have postgresql already on your system and running. To take care of that, type sudo service postgresql stop

Type the following in the directory you have docker-compose.yml:

sudo docker-compose up


  • Option 2 (DEPRICATED):

Install PostgreSQL (read more: https://www.postgresql.org/)

Please make sure your installation satisfies:

{
  "development": {
    "username": "postgres",
    "password": "test",
    "database": "labtool_development",
    "host": "127.0.0.1",
    "dialect": "postgres"
  }

- Creating the database and migrations, run project

Make sure you have npm installed to your system.

In the backend directory of the project make sure you have all the necessary packages installed by running the command: npm install

Configurate your .env file as adviced in https://github.com/labtool/labtool/wiki/Dotenv

Make sure you have Docker running in another console before continuing.

To get a fresh new start

  • Backend:
cd /path/to/the/project/directory
cd backend
npm install
npm run dropdb
npm run createdb
npm run migrate
npm run watch

For the backend, if you like, you can import the courses to your local development database by running while the backend is running the following:

cd /path/to/the/project/backend
npm run import_courses
  • Frontend:
cd /path/to/the/project/directory
cd labtool2.0
npm install
npm start

- Testing

see "Running tests"

- Code style

see "Linting"

Clone this wiki locally