-
Notifications
You must be signed in to change notification settings - Fork 3
Setting up the development environment
The following repositories are needed:
- ontohub-backend
- ontohub-frontend
- ontohub-models
- ontohub-git-shell
- hets-agent
- indexer
- index
- bringit
- graphql-pundit
-
macOS only: Install Homebrew according to the "Install Homebrew" section at http://brew.sh.
-
Debian only: Install development libraries:
sudo apt install cmake libicu-dev
-
Install Ruby:
- Install chruby according to the chruby homepage. This allows you to have several independent ruby versions installed in your home directory. Do not forget to check the sections on configuration and auto-switching.
- Install ruby-install according to the ruby-install homepage. This allows you to build ruby versions with chruby.
- Install ruby by running
ruby-install "ruby-$(cat .ruby-version)"
in the directory of a ruby-based project (e.g. in ontohub-backend). - Install bundler:
gem install bundler
. - Install rubocop linter:
gem install rubocop
. - Optional: Install httpie to get more beautiful JSON output when making HTTP requests from the console. Read their Readme file.
-
Install frontend dependencies (Javascript):
- Install Yarn package manager
- Now would be the time, if you want to change yarn's global install directory.
- Install ESLint linter:
yarn global add eslint
.
-
Install PostgreSQL and create the databases:
- Installation
-
macOS:
Run
brew install postgresql
to install it. Then, runbrew services start postgresql
to start it with every boot. You can disable starting it with every boot withbrew services stop postgresql
. -
Arch Linux:
sudo pacman -Sy postgresql
. To put it in autostart, runsudo systemctl enable postgresql
. To remove it from autostart, runsudo systemctl disable postgresql
. -
Ubuntu Linux:
sudo apt install postgresql libpq-dev
.
-
macOS:
Run
-
Debian and Ubuntu: Loosen the super user restrictions such that any user may connect to the database server as the super user: Let the following lines be the only uncommented lines in the
/etc/postgresql/X.Y/main/pg_hba.conf
The first line is the most important line. We have changedlocal all all trust host all all 127.0.0.1/32 trust host all all ::1/128 trust
peer
totrust
. Make sure that no line withpeer
remains. After these changes, runsudo service postgresql restart
. -
All except Ubuntu >= 16.04: Initialize the database directory with
initdb /usr/local/var/postgres -E utf8
.- Debian user need to first login in as root with
su
(Note:sudo
does not work in this case). Then login as the userpostgres
withsu - postgres
. Then create the database with/usr/lib/postgresql/X.Y/bin/initdb -E utf8 --locale=en_US.utf8
- Debian user need to first login in as root with
-
All except Ubuntu >= 16.04 and Debian: Create the database user that is used by Ontohub with
createuser -d -w -s postgres
. - Run
bundle
to install the dependencies in each directory of the projects - Create the development database by running
bundle exec rails db:recreate
in the ontohub-backend project directory. This database is shared among the different projects. - Create the test databases by running
RAILS_ENV=test bundle exec rails db:recreate
in each directory of the projects (Note: You may need to installsubversion
and/orgit-svn
- Installation
-
Install RabbitMQ and plugins:
- RabbitMQ
-
macOS only:
Run
brew install rabbitmq
. To start rabbitmq with every boot, runbrew services start rabbitmq
. To disable autostart, runbrew services stop rabbitmq
. If you want to run in manually in the foreground, runrabbitmq-server
. -
Arch Linux:
sudo pacman -Sy rabbitmq
. To put it in autostart, runsudo systemctl enable rabbitmq
. To remove it from autostart, runsudo systemctl disable rabbitmq
. -
Ubuntu Linux:
sudo apt install rabbitmq-server
-
macOS only:
Run
- Enable the plugin
rabbitmq_recent_history_exchange
:-
macOS:
/usr/local/opt/rabbitmq/sbin/rabbitmq-plugins enable rabbitmq_recent_history_exchange
-
debian:
sudo /usr/sbin/rabbitmq-plugins enable rabbitmq_management
sudo /usr/sbin/rabbitmq-plugins enable rabbitmq_recent_history_exchange
-
other systems:
rabbitmq-plugins enable rabbitmq_recent_history_exchange
-
macOS:
- Set up the virtual host (for Debian, it is
/usr/sbin/rabbitmqctl
):sudo rabbitmqctl add_vhost ontohub_development
sudo rabbitmqctl set_permissions -p ontohub_development guest ".*" ".*" ".*"
- Adjust these for a production environment. The default virtual host for the production environment is
ontohub
.
- RabbitMQ
-
Install Chome/Chromium. This is used for the frontend tests.
-
Install Elasticsearch:
-
macOS:
brew install elasticsearch
. To put it in autostart, runbrew services start elasticsearch
. To remove it from autostart, runbrew services stop elasticsearch
. -
Arch Linux:
sudo pacman -Sy elasticsearch
. To put it in autostart, runsudo systemctl enable elasticsearch
. To remove it from autostart, runsudo systemctl disable elasticsearch
. - Ubuntu Linux: Install from APT repository as described on the Elasticsearch installation page.
-
macOS:
-
Install Hets-Server (not desktop):
-
macOS: First, obtain the package repository with
brew tap spechub/hets
and then, install Hets withbrew install hets-server
. -
Arch Linux: Install
hets-server
from the AUR. -
Ubuntu Linux: Run
sudo apt install hets-server
.
-
macOS: First, obtain the package repository with
To use the local repository of our gems, run the following commands:
bundle config --local local.ontohub-models <absolute path to the ontohub-models repository>
bundle config --local local.index <absolute path to the index repository>
bundle config --local local.bringit <absolute path to the bringit repository>
bundle config --local local.graphql-pundit <absolute path to the graphql-pundit repository>
In each repository (except ontohub-frontend
), starting with ontohub-models
, run the following command to install all the dependencies:
bundle
By default, yarn uses the same directories, that npm uses. This usually means that root is required to install new packages. You can change the install path to e.g. ~/.npm-packages
by running the following commands:
mkdir "$HOME/.npm-packages"
echo 'NPM_PACKAGES="$HOME/.npm-packages"' >> ~/.bashrc # or ~/.zshrc
echo 'PATH="$PATH:$NPM_PACKAGES/bin"' >> ~/.bashrc # or ~/.zshrc
echo 'prefix=${HOME}/.npm-packages' >> ~/.npmrc
Run the following commands in the frontend repository:
Restart your shell and run the following commands in the frontend repository directory:
yarn # install dependencies
To start the frontend, run yarn start
.