Native Installation
This documentation describes an installation solution of the chemotion ELN system for development purposes with Rails 5 on Ubuntu 20.04.
Before Installation
The installation script installs ELN through a default user, which is created during the installation. If you want to use another user or use an existing user, download the installation script (see Get installation script) and change the varibale PROD at the top of the script.
For the default user a random password is generated when newly created. If you want to login to the user after installation you can change the password in the script. For that search for the command chpasswd
in the script.
Get the installation script
Download the current development installation script (14.07.2021) from GitHub and make it executable:
curl -o install_development.sh -L https://raw.githubusercontent.com/ComPlat/chemotion_ELN/development-5/scripts/install_development.sh
chmod 700 install_development.sh
sudo ./install_development.sh
Or install the current script directly via curl:
sudo curl -o- https://raw.githubusercontent.com/ComPlat/chemotion_ELN/development-5/scripts/install_development.sh | bash
Errors during installation
nvm install vxx.xx.x
Run the installation script again:
sudo ./install_development.sh
Another solution could be to comment out PART_5 in the installation script, where nvm and Node will be installed and run again:
sudo ./install_development.sh
Extended error message:
Warning: Failed to create the file /tmp/x.x.x: Permission
Warning: denied
0 13.6M 0 1369 0 0 8398 0 0:28:19 --:--:-- 0:28:19 8398
curl: (23) Failed writing body (0 != 1369)
000:09 removing tmp files..
000:09 removing tmp repo..
000:09 An error has occured
This may occure if you install the chemotion ELN for multiple users on the same machine, because the global packages to be installed already exists, so either comment out the installation of the package which causes the problem or delete it.
After Installation
Git clone
After the installation of the desired libraries to use the chemotion ELN you need to clone the source code from GitHub.
Change configuration files
Before using the chemotion ELN you have to change some configurations. Change to the root folder of your ELN (e. g. cd ~/chemotion_ELN
) and paste the following commands at once in your terminal:
cp Gemfile.plugin.example Gemfile.plugin ;
cp .ruby-gemset.example .ruby-gemset ;
cp .ruby-version.example .ruby-version ;
cp ./config/database.yml.example ./config/database.yml ;
cp ./config/datacollectors.yml.example ./config/datacollectors.yml ;
cp ./config/editors.yml.example ./config/editors.yml ;
cp ./config/inference.yml.example ./config/inference.yml ;
cp ./config/spectra.yml.example ./config/spectra.yml ;
cp ./config/storage.yml.example ./config/storage.yml ;
cp ./config/user_props.yml.example ./config/user_props.yml
Install Ruby libraries
Change to the root folder of your ELN (e. g. cd ~/chemotion_ELN
) where the Gemfile
is located and type:
source ~/.rvm/scripts/rvm && bundle install
Errors
sudo apt-get install ruby-full
Install node_modules
source ~/.nvm/nvm.sh && yarn install
Errors
sudo apt-get remove --purge cmdtest
source ~/.nvm/nvm.sh && nvm use 14.16.0 && npm install -g yarn && yarn install
Update database
sudo -u postgres psql
ALTER USER postgres PASSWORD '<your password>';
Open file ./config/databse.yml
, change host in development to localhost
and update your password that you set above.
Errors
Either the database settings in the yml configuration file needs to be changed or the database needs to be created in Postgres.
Migrate data
bundle exec rake db:create RAILS_ENV=development
bundle exec rake db:migrate RAILS_ENV=development
Run the app
You need to run two servers simultaneously in two different terminals: one for the rails app and one for webpack:
bundle exec rails s
bundle exec bin/webpack-dev-server
Potentially a restart of the Rails server is needed because changes in JavaScript files below app/
are monitored by the webpack server process.
Errors
Open Gemfile
and add:
gem 'bigdecimal', '1.3.5'
Run again:
bundle install
Restart the servers.
error Command "webpack" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
source ~/.nvm/nvm.sh && nvm use 14.16.0 && yarn install
Restart the servers.
Update test data
Open web browser, signup and login. Download and import data from here.
Run:
bundle exec bin/delayed_job start
For old installations: Upgrade from Rails 4 to Rails 5
If you have an existing installation with Rails 4 and want to upgrade to Rails 5 you need to "update" your Ruby gems and node modules with yarn after checking out the development-5 branch:
bundle install
source ~/.nvm/nvm.sh && nvm install 14.16.0
source ~/.nvm/nvm.sh && nvm use 14.16.0 && npm install -g npm && npm install -g yarn && yarn install
For a clean install it might be helpful - but not always required - to remove the previous packages that were installed by npm, only need to be done once:
rm -rf node_modules
source ~/.nvm/nvm.sh && nvm use 14.16.0 && yarn install
You need to run two servers simultaneously in two different terminals: one for the rails app and one for webpack:
bundle exec rails s
bundle exec bin/webpack-dev-server
Potentially a restart of the Rails server is needed because changes in the JavaScript files below app/
are monitored by the webpack server process.