Last active
December 16, 2015 02:09
-
-
Save bradland/5360070 to your computer and use it in GitHub Desktop.
Install script for Tabula
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tabula installer for Ubuntu 12.10 | |
# This script will build a working install of Tabula in your cwd. I run this | |
# entire script as root because of the number of software installs. If you're | |
# not comfortable with that, you're probably able to figure out how to do this | |
# as a regular user. | |
# These scripts prefer apt packages that are available by default under Ubuntu | |
# 12.10, but will fall back to using source distributions where packages are not | |
# available in the default Ubuntu repositories. | |
# Also worth noting is that we're going to call ruby-build directly, rather than | |
# using rbenv. I prefer not to have to deal with rbenv in a server environment. | |
# Instead, I treat my VPS as a throw away container. You can upgrade Ruby in | |
# place for patch level releases by running ruby-build again, specifying the | |
# most recent patch release. For major version changes, you simply turn up a new | |
# VPS with the latest software and use the build script to turn up the new | |
# server, migrate your data over, and kill the old one. | |
# Dependencies installed by aptitude may be repeated in the interest of | |
# modularity. In general, you can edit one portion of this script without | |
# affecting another. | |
# Author: Brad Landers <[email protected]> | |
# Github: http://github.com/bradland | |
# Disclaimer: This isn't very good software. Run at your own risk. | |
# License: MIT (fulltext at bottom) | |
read -p "This script is fast and loose, so you should read the whole thing before you... Press y to continue?" -n 1 -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
### Ruby | |
# MRI Ruby deps | |
aptitude -y install bison zlib1g-dev libssl-dev libreadline6-dev libncurses5-dev file libyaml-dev libxslt1-dev libxml2-dev | |
# Java deps | |
aptitude -y install openjdk-7-jdk | |
# Install ruby-build | |
git clone git://github.com/sstephenson/ruby-build.git | |
cd ruby-build && ./install.sh | |
cd .. | |
# Install Rubies | |
ruby-build --verbose 1.9.3-p392 /usr/local | |
ruby-build --verbose jruby-1.7.3 /usr/local/jruby-1.7.3 | |
### Python | |
# Install from apt | |
aptitude -y install python2.7 python-dev python-numpy | |
### OpenCV | |
# Install from source :: https://github.com/DmitrySandalov/Install-OpenCV/blob/master/Ubuntu/2.4/opencv2_4_3.sh | |
wget https://raw.github.com/DmitrySandalov/Install-OpenCV/master/Ubuntu/2.4/opencv2_4_3.sh | |
chmod u+x opencv2_4_3.sh | |
./opencv2_4_3.sh | |
### Mupdf | |
# Install deps | |
aptitude -y install build-essential pkg-config libx11-dev libxext-dev | |
aptitude -y install libc6 libfreetype6 libjbig2dec0 libjpeg8 libopenjpeg2 libx11-6 libxext6 zlib1g | |
# Install from source | |
wget https://mupdf.googlecode.com/files/mupdf-1.2-source.zip | |
unzip mupdf-1.2-source.zip | |
cd mupdf-1.2-source | |
make | |
make prefix=/usr/local install | |
cd .. | |
### Redis | |
# Install redis | |
aptitude -y install redis-server | |
### Tabula | |
# Clone Tabula | |
git clone git://github.com/jazzido/tabula.git | |
cd tabula | |
gem install bundler | |
bundle install | |
if [ -f local_settings.rb ]; then | |
echo "WARN: File 'local_settings.rb' already exists! You may need to adjust paths. | |
JRUBY_PATH = '/usr/local/jruby-1.7.3/bin/jruby' | |
MUDRAW_PATH = '/usr/local/bin/mudraw'" | |
else | |
echo "INFO: We're writing 'local_settings.rb' with the paths used by this installer script." | |
cat <<EOF > local_settings.rb | |
module Settings | |
JRUBY_PATH = '/usr/local/jruby-1.7.3/bin/jruby' | |
MUDRAW_PATH = '/usr/local/bin/mudraw' | |
USE_GOOGLE_ANALYTICS = false | |
# uploaded pdfs and generated files go here. change if needed | |
DOCUMENTS_BASEPATH = File.join(File.expand_path(File.dirname(__FILE__)), 'static/pdfs') | |
ENABLE_DEBUG_METHODS = false | |
end | |
EOF | |
fi | |
echo 'WARN: We are about to start the app, after which you should do the following: | |
1. Verify that it works | |
2. Stop the app | |
3. Establish a non-root user to run this app | |
4. Move the files and chown them to that user | |
5. Secure Tabula from the outside world using the tools of your choice (web server with auth, firewall rules, etc) | |
6. DO NOT SKIP ANY OF THESE STEPS! | |
7. Somone WILL find your app eventually' | |
bundle exec foreman start | |
fi | |
# Copyright (c) 2013 Brad Landers | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# The above copyright notice and this permission notice shall be included in all | |
# copies or substantial portions of the Software. | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
# SOFTWARE. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remember to add "apt-get install git" :-)