-
-
Notifications
You must be signed in to change notification settings - Fork 3
Setup
Welcome! We're excited that you are interested in checking out this project and maybe hacking on it. That's great! ✨
If you're looking to get set up, please follow these instructions for getting a local development environment up and running. By the end of this you should be able to run this app successfully. If not, please feel free to create an issue to bring our attention to anything missing.
For this setup, please use the most recent version of OS X. If something doesn't work for you, or you'd just like to know more about a particular step, feel free to ask a developer (via slack).
-
Install the command line tools
xcode-select --install # and follow the prompts
-
Install Homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Install git.
brew install git
-
Install chruby.
brew install chruby echo 'source /usr/local/opt/chruby/share/chruby/chruby.sh' >> ~/.bash_profile
-
Install ruby-build.
brew install ruby-build
-
Install ruby 3.0.0
ruby-build 3.0.0 ~/.rubies/ruby-3.0.0
-
Install rbenv
brew install rbenv rbenv install 3.0.0
-
Set ruby version to 3.0.0
rbenv global 3.0.0
-
Install Bundler. Do not use sudo here. If stuck, ask a developer in slack.
gem install bundler
-
Install Rails, if you don't have it already.
gem install rails
-
Install the Heroku Toolbelt
brew tap heroku/brew && brew install heroku
-
Install ImageMagick for image processing.
brew install ImageMagick
-
Reload your shell.
source ~/.bash_profile
-
Install node
brew install node
-
Install Postgres.
brew install postgresql
-
Start postgres on boot:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
-
To start the server:
pg_ctl -D /usr/local/var/postgres -l logfile start
-
Initialize a postgres database
initdb /usr/local/var/postgres -E utf8
-
Create a postgres user.
createuser --superuser jelly
-
Create jelly development database:
createdb -U jelly jelly_development
-
Install the Postgres gem with architecture flags enabled.
env ARCHFLAGS="-arch x86_64" gem install pg
-
Install Puma gem w/ openssl options.
brew install openssl brew link --force openssl gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include
-
(optional) Install ElasticSearch.
If you're on a fresh install, install java with
brew cask install caskroom/versions/java8
And then put elasticsearch somewhere where you want it, e.g. home directory or your /usr/bin
curl -L -O https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.4.6.tar.gz
tar -xvf elasticsearch-2.4.6.tar.gz
-
Install redis
brew install redis
-
Start redis on boot:
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
For environment variables, go ahead and add placeholders in your dotfiles.
This setup was tested on Ubuntu 16.04. If something doesn't work for you, or you'd just like to know more about a particular step, feel free to ask a developer (via slack).
-
Install Homebrew. If there are issues, you can find more detailed installation instructions here.
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
-
Install git.
brew install git
-
Install chruby.
brew install chruby echo 'source /usr/local/opt/chruby/share/chruby/chruby.sh' >> ~/.bash_profile
-
Install ruby-build.
brew install ruby-build
-
Install ruby 3.0.0
ruby-build 3.0.0 ~/.rubies/ruby-3.0.0
-
Install rbenv
brew install rbenv rbenv install 3.0.0
-
Set ruby version to 3.0.0
rbenv global 3.0.0
-
Install Bundler. Do not use sudo here. If stuck, ask a developer in slack.
gem install bundler
-
Install Rails, if you don't have it already.
gem install rails
-
Install the Heroku Toolbelt
brew install heroku
-
Install ImageMagick for image processing.
brew install ImageMagick
-
Reload your shell.
source ~/.bash_profile
-
Install node.
brew install node
More detailed instructions for what is happening during these steps can be found here.
-
Install Postgres.
sudo apt update sudo apt install postgresql postgresql-contribbrew install postgresql
-
Start postgres on boot:
sudo -i -u postgres
-
Create a superuser with the same name as your username (referred to as "user") by following the prompts on this command.
sudo -u postgres createuser -s "user" -P
-
Store your username password as an environment variable.
echo 'export DB_PASSWORD="YOUR_PASSWORD"' >> ~/.bashrc echo 'export DB_USER="USER"' >> ~/.bashsrc source ~/.bashrc
-
Initialize a postgres database.
yarn install --check-files rails db:create
-
Install the Postgres gem with architecture flags enabled.
env ARCHFLAGS="-arch x86_64" gem install pg
-
Install Puma gem w/ openssl options.
brew install openssl brew link --force openssl gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include
More detailed instructions here.
-
Install redis.
sudo apt update sudo apt install redis-server
-
Open /etc/redis/redis.conf and replace
supervised no
withsupervised systemd
For this setup, please use Windows 10 Build 1909 and above. If something doesn't work for you, or you'd just like to know more about a particular step, feel free to ask a developer (via slack).
- Install Windows Subsystem for Linux (WSL). You may have to restart your computer after this.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
-
Install Ubuntu through the Windows App store here. The rest of the installation will be run through the Ubuntu shell.
-
Ensure Git is installed.
git --version
# if git isn't installed
sudo apt install git
- Install dependencies needed for Ruby.
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev
Additional info can be found here. 5. Install rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
- Install ruby-build.
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
- Install Ruby 3.0.0
rbenv install 3.0.0
rbenv global 3.0.0
ruby -v
- Install Bundler. Do not use sudo here. If stuck, ask a developer in slack.
gem install blunder
rbenv rehash
- Install node & yarn.
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt-get install -y nodejs yarn
- Install rails.
gem install rails -v 6.0.2.2
rbenv rehash
rails -v
- Install heroku toolbelt.
gem install heroku
- Install ImageMagick.
sudo apt update
sudo apt install imagemagick
- Install Postgres for Windows here.
- Connect Postgres with WSL.
sudo apt update
sudo apt install libpq-dev
-
To start the server:
pg_ctl -D /usr/local/var/postgres -l logfile start
-
Initialize a postgres database
initdb /usr/local/var/postgres -E utf8
-
Create a postgres user.
createuser --superuser jelly
-
Create jelly development database:
createdb -U jelly jelly_development
-
Install the Postgres gem with architecture flags enabled.
env ARCHFLAGS="-arch x86_64" gem install pg
-
Install redis.
sudo apt update
sudo apt install redis-server ``` 2. Update the redis config file.
sudo nano /etc/redis/redis.conf
Find supervised no
line and change to supervised systemd
since Ubuntu
uses the systemd
init system.
-
Add your SSH-Keys to Github if you haven't already.
-
Clone the Jellyposter project.
git clone [email protected]:jellypbc/poster.git
-
Go to the jellyposter project directory.
cd poster
-
Install gems.
bundle
-
Reload your shell.
source ~/.bash_profile
-
Log into Heroku with the Heroku Toolbelt and add your public key
heroku login heroku keys:add
-
Add Heroku repositories remotes (so you can deploy).
heroku git:remote -a jellyposter
-
Prepare the test database.
bundle exec rake db:test:prepare
-
Install yarn.
brew install yarn
-
Install packages.
yarn
-
Get the environment variables.
-
Boot up the server and be happy!
To start the rails server
bundle exec rails s
To start webpacker
bin/webpack-dev-server
To start sidekiq
bundle exec sidekiq
If you prefer to use Docker, you can set things up the first time using:
$ docker-compose build
$ docker-compose run app .docker/startup.sh
You can run the server and other services using the following command:
$ docker-compose up
This will start the rails server, sidekiq, webpacker, redis, postgres, grobid, and figures. If you just want to run the external services in docker, you can do so using:
$ docker-compose up grobid figures
To run an interactive rails console on the container:
docker exec -it $( docker ps | grep jelly | awk "{print \$1}" | head -n 1 ) bin/rails c