copy the installation script on a ubuntu server 18.04 (could work with another deb)
curl -o chemotion_ELN_install.sh -L https://git.scc.kit.edu/complat/chemotion_ELN_server/raw/development/scripts/install_production.sh
check the variables at the beginning of the file, but also check the whole script to see what it is doing.
TLDR: it will ...
- install OS package dependencies
- install passenger
- create a new user
- install ruby and nodejs for the user
- create a postgresql DB
- copy the chemotion_ELN code and prepare basic config files
- do a capistrano app deploy
- config nginx (NB: no ssl set) and UFW
When ready, make the script executable and run it as a non-root user (but in the sudo group):
`chmod 700 chemotion_ELN_install.sh
sudo ./chemotion_ELN_install.sh
After reboot the application should be up and running at the ip of the machine (http://...) An admin account should have been created (email: eln-admin@kit.edu, pw: PleaseChangeYourPassword)
To update the application code for such an installation, use the update script:
curl -o chemotion_ELN_update.sh -L https://git.scc.kit.edu/complat/chemotion_ELN_server/raw/development/scripts/update_production.sh
If needed, edit the file (change the variables or comments out parts to disable), then
chmod 700 chemotion_ELN_update.sh`
sudo ./chemotion_ELN_update.sh
This is a setup for a 'pseudo' production stage using passenger and aimed for user testing. (For the development environment, change 'RAILS_ENV' to 'development' in docker-compose.yml) Make sure you have finished the BASIC SETUP FIRST
- Build the image from Dockerfile
docker-compose build
or pull the image:docker-compose pull
- Initialize database FIRST:
docker-compose run app bundle exec rake db:create
docker-compose run app bundle exec rake db:migrate
docker-compose run app bundle exec rake db:seed
(optional). A "seed" user will be inserted into the db with the information as below: template.moderator@eln.edu - password: "@eln.edu"docker-compose run app rake ketcherails:import:common_templates
(optional)
- Precompile assets:
docker-compose run app bundle exec rake assets:precompile
- To start the server:
docker-compose up
or start server and detach:docker-compose up -d
-
Start interactive shell with docker:
docker-compose run app /bin/bash
-
NOTE: In this Docker image, we disabled the email verification progress
-
To enable email confirmation, uncomment ":confirmable" at line 5 of
app/models/user.rb
, stop thedocker-compose
bydocker-compose stop
and startdocker-compose
.
- Copy
config/database.yml.example
toconfig/database.yml
and enter your database connection information. - Copy
config/storage.yml.example
toconfig/storage.yml
and enter your database connection information. - Copy
.ruby-gemset.example
to.ruby-gemset
. - Copy
.ruby-version.example
to.ruby-version
. (Skip this step if you want to use Docker) - Reload directory to create rvm gemset.
- Execute
bundle install
. - Execute
rake db:reset
(this creates and seeds the database).
Production
cp .env.production{.example,} # optionally enter SFTP credentials
-
copy the config example file and edit the entries
-
create device entries and configure their profiles
cp db/datacollectors.yml.example db/datacollectors.yml
If you like to reset the database, you have to execute the following commands (under the assumption your production database is called chemotion
)
sudo -u postgres psql -d chemotion -c 'DROP SCHEMA public CASCADE;CREATE SCHEMA public; GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO public;'
or alternatively, drop and recreate DB using rake task:
RAILS_ENV=production bundle exec rake db:drop db:create
then, create DB extensions:
sudo -u postgres psql -d chemotion -c 'CREATE EXTENSION IF NOT EXISTS "pg_trgm"; CREATE EXTENSION IF NOT EXISTS "hstore"; CREATE EXTENSION IF NOT EXISTS "uuid-ossp";'
and run DB migrations:
RAILS_ENV=production bundle exec rake db:migrate db:seed
- Install
nvm
:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/0.34.0/install.sh | bash
(see https://github.com/nvm-sh/nvm#installation) or for OSX:brew install nvm && echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.profile
- Execute
nvm install 10.15.3
- Execute
npm install -g npm@6.11.3
- Execute
npm install
.
Run rake jobs:work
for asynchronous handling of email notifications. Run mailcatcher
in your console and go to localhost:1080
to see all sent mails.
- put new icons as SVG files (e.g. '<ICON_NAME>.svg') in
app/assets/images/svg_icons
- run
rake icons:compile
Icons are now available as css classes: '.icon-<ICON_NAME'
if there are errors with nokogiri compilation with new xcode7:
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2 --use-system-libraries
-
Require
- CMake (the
cmake
package in Ubuntu) - Eigen (the
libeigen2-dev
orlibeigen3-dev
package in Ubuntu) - Swig (the
swig
package in Ubuntu) - libxml2 (the
libxml2-dev
package in Ubuntu)
- CMake (the
-
openbabel will be automatically installed through
bundle install
brew install imagemagick gs
for OSXapt-get install libmagickcore-dev libmagickwand-dev
for linux- if installing the rmagick gem fails you may try:
IM_PREFIX=$(brew list imagemagick 2>&1 | grep -E 'identify$' | sed 's/bin\/identify$//g') PKG_CONFIG_PATH=${IM_PREFIX}lib/pkgconfig/ C_INCLUDE_PATH=${IM_PREFIX}include/ImageMagick*/ gem install rmagick
(OSX only)
sudo apt-get install inkscape
for Linux- For Mac OSX, you need to install XQuartz before inkscape:
brew install Caskroom/cask/xquartz
, andbrew install homebrew/gui/inkscape
.
brew install imagemagick mplayer
for OSXsudo apt-get -y install imagemagick mplayer
for Linux
brew install fontforge --with-python
brew install eot-utils