Last active
September 7, 2015 08:14
-
-
Save ohvitorino/9934022 to your computer and use it in GitHub Desktop.
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
################################################ | |
# This should install cartodb (development mode) | |
# in your Ubuntu 12.04 machine | |
################################################ | |
#!/bin/bash | |
sudo apt-get update | |
sudo apt-get safe-upgrade -y | |
# git:// port might be closed | |
git config --global url."https://".insteadOf "git://" | |
# Download CartoDB from GIT | |
git clone --recursive https://github.com/CartoDB/cartodb.git | |
# CartoDB repositories | |
#Add CartoDB GIS PPA | |
sudo add-apt-repository ppa:cartodb/gis | |
#Add CartoDB Mapnik PPA | |
sudo add-apt-repository ppa:cartodb/mapnik | |
#Add CartoDB Node PPA | |
sudo add-apt-repository ppa:cartodb/nodejs | |
#Add CartoDB Redis PPA | |
sudo add-apt-repository ppa:cartodb/redis | |
#Add CartoDB PostgreSQL PPA | |
sudo add-apt-repository ppa:cartodb/postgresql | |
#Add CartoDB Varnish PPA | |
sudo add-apt-repository ppa:cartodb/varnish | |
sudo apt-get update | |
sudo apt-get install curl vim unp zip git libgeos-c1 libgeos-dev gdal-bin libgdal1-dev libjson0 python-simplejson libjson0-dev proj-bin proj-data libproj-dev | |
sudo apt-get install postgresql-9.1 postgresql-client-9.1 postgresql-contrib-9.1 postgresql-server-dev-9.1 | |
sudo apt-get install postgresql-plpython-9.1 | |
# Currently there is an error with credential-based connections for development, | |
# and all connections must be performed using method "trust" inside config file pg_hba.conf | |
# And change inside all local connections from peer/md5/... to trust. | |
sudo vim /etc/postgresql/9.1/main/pg_hba.conf | |
sudo service postgresql restart | |
# Install PostGIS | |
wget http://download.osgeo.org/postgis/source/postgis-2.0.2.tar.gz | |
tar xzf postgis-2.0.2.tar.gz | |
cd postgis-2.0.2 | |
./configure --with-raster --with-topology | |
make | |
make install | |
sudo su - postgres | |
cd ~ | |
psql | |
# ALTER USER postgres WITH PASSWORD '<your-new-password>'; | |
# CREATE USER ubuntu WITH PASSWORD '<password>'; | |
# ALTER ROLE ubuntu SUPERUSER; | |
# \q | |
vim template # Add the following: | |
##### | |
#!/bin/bash | |
POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-2.0 | |
createdb -E UTF8 template_postgis | |
createlang -d template_postgis plpgsql | |
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis'" | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/legacy.sql | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/rtpostgis.sql | |
psql -d template_postgis -f $POSTGIS_SQL_PATH/topology.sql | |
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" | |
psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;" | |
##### | |
chmod +x template | |
./template | |
# Install Ruby | |
\curl -L https://get.rvm.io | bash | |
source /home/$USER/.rvm/scripts/rvm | |
rvm pkg install openssl | |
# rvm pkg install zlib | |
rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr # Not sure this needs to be specified | |
rvm use 1.9.3 | |
rvm use 1.9.3 --default | |
# Install Node.js | |
sudo apt-get install nodejs npm | |
# Install nvm | |
curl https://raw.github.com/creationix/nvm/master/install.sh | sh | |
nvm install v0.8.9 | |
nvm use 0.8.9 | |
# Install Redis | |
sudo apt-get install redis-server | |
# Python dependencies | |
sudo apt-get install python2.7-dev | |
sudo apt-get install build-essential | |
sudo apt-get install python-setuptools | |
sudo easy_install pip | |
cd cartodb | |
export CPLUS_INCLUDE_PATH=/usr/include/gdal | |
export C_INCLUDE_PATH=/usr/include/gdal | |
pip install --no-use-wheel -r python_requirements.txt | |
# If GDAL installation fails | |
sudo pip install --no-install GDAL | |
cd <path to GDAL download location> | |
python setup.py build_ext --include-dirs=/usr/include/gdal | |
pip install --no-download GDAL | |
# Repeat requirements installation | |
sudo pip install -r python_requirements.txt | |
sudo apt-get install varnish | |
# If the default varnish repository version >= 3, you might need | |
sudo apt-get install varnish=2.1.0-2cdb~precise1 | |
sudo add-apt-repository ppa:mapnik/boost | |
sudo apt-get update | |
sudo apt-get install libmapnik-dev python-mapnik mapnik-utils | |
sudo apt-get install imagemagick | |
cd ~ | |
# Get CartoDB-SQL-API | |
git clone git://github.com/CartoDB/CartoDB-SQL-API.git | |
cd CartoDB-SQL-API | |
git checkout master | |
npm install | |
./configure | |
cd ~ | |
# Get Windshaft | |
git clone git://github.com/CartoDB/Windshaft-cartodb.git | |
cd Windshaft-cartodb | |
git checkout master | |
npm install | |
./configure | |
# BEER BEER BEER BEER!!!! | |
cd ~/cartodb | |
export SUBDOMAIN=development | |
redis-server | |
# create a new gemset | |
rvm use 1.9.2@cartodb --create && bundle install | |
# Create a development user | |
# | |
# The script will ask you for passwords and email | |
# | |
# Read the script for more informations about how to perform | |
# individual steps of user creation and settings management | |
# | |
sh script/create_dev_user ${SUBDOMAIN} | |
# backup files | |
cp config/app_config.yml.sample config/app_config.yml | |
cp config/database.yml.sample config/database.yml | |
vim config/database.yml | |
vim config/app_config.yml | |
# Add entries to /etc/hosts needed in development | |
echo "127.0.0.1 ${SUBDOMAIN}.localhost.lan" | sudo tee -a /etc/hosts | |
# GOOD TO GO!! | |
rvmsudo bundle exec foreman start -p 3000 | |
exit | |
############################ | |
# USEFULL TIPS # | |
############################ | |
# | |
# Check | |
# tail -f /var/log/syslog | |
# If you're getting messages like | |
# | |
# 'Apr 7 12:34:50 cartodb varnishd[10868]: CLI telnet 127.0.0.1:50083 127.0.0.1:6082 Wr 101 Unknown request.#012Type 'help' for more info.' | |
# | |
# You may need to disable authentication (secret) in /etc/default/varnish | |
# | |
# You may need to update npm if you get erros doing some npm install | |
# npm update npm -g | |
# | |
# To install Grunt for compiling assets (js, css, etc) | |
# npm install -g grunt-cli |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment