Skip to content

Instantly share code, notes, and snippets.

@3rdLOF
Forked from nathanhaigh/install.sh
Created June 1, 2014 01:51
Show Gist options
  • Select an option

  • Save 3rdLOF/6d6c7d6b200e9214b8bd to your computer and use it in GitHub Desktop.

Select an option

Save 3rdLOF/6d6c7d6b200e9214b8bd to your computer and use it in GitHub Desktop.

Revisions

  1. Nathan S. Watson-Haigh revised this gist Jan 14, 2014. No changes.
  2. Nathan S. Watson-Haigh revised this gist Jan 14, 2014. 2 changed files with 297 additions and 272 deletions.
    560 changes: 297 additions & 263 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -2,293 +2,327 @@
    # You should clone this gist to obtain the installation and patch file
    # and then run it locally, after changing the below settings to something
    # suitable for your system. Something like this:
    # sudo apt-get install -y ssh git
    # sudo apt-get install -y ssh
    # cd
    # git clone https://gist.github.com/5635461.git gitorious_install
    # Edit the settings below, then run:
    # scp -r nhaigh@bioserver:git/sysadmin/generic/gitorious_install ./
    # Edit the settings below, then run the following as root:
    # cd gitorious_install && sh ./install.sh
    #
    #------------------------------------------------------------------------------
    # HELPFUL ONLINE DOCUMENTATION
    #------------------------------------------------------------------------------
    # https://gitorious.org/gitorious/pages/UbuntuInstallation
    # https://gitorious.org/gitorious/mainline/source/03c30468ccf79f3cde127c042dff59c9a63ccfe0:doc/setup-dev-env-ubuntu.sh#L72-181
    # http://blog.gitorious.org/2013/01/04/gitorious-3-0-lands-in-the-next-branch/
    # https://gitorious.org/gitorious/mainline/source/39de776f3988b8f7fc98085aaacae528eef39fe0:doc/upgrading-to-gitorious3.md
    # http://edin.no-ip.com/blog/hswong3i/gitorious-ubuntu-12-04-mini-howto
    # https://github.com/schacon/git-sphinx
    #------------------------------------------------------------------------------

    #------------------------------------------------------------------------------
    # SETTINGS
    #------------------------------------------------------------------------------
    source ~/gitorious_install/gitorious_settings.txt

    MYSQL_ROOT_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-15};echo;`
    MYSQL_GITORIOUS_USER=gitorious
    MYSQL_GITORIOUS_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-15};echo;`
    GITORIOUS_HOST=`hostname -f`
    GITORIOUS_DIR=/var/www/gitorious
    # SYSADMIN details i.e. the user running this script
    SYSADMIN=$USER
    SYSADMIN_EMAIL=${SYSADMIN}@$GITORIOUS_HOST
    # gitorious user details
    GITORIOUS_USER='git'
    #GITORIOUS_USER_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-15};echo;`
    # gitorious admin details
    GITORIOUS_ADMIN=$USER
    GITORIOUS_ADMIN_EMAIL=${GITORIOUS_ADMIN}@${GITORIOUS_HOST}
    GITORIOUS_ADMIN_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-15};echo;`

    cat > settings.txt <<__SCRIPT__
    ##############################
    Your gitorious install details
    ##############################
    MySQL passwords:
    root:${MYSQL_ROOT_PASSWORD}
    ${MYSQL_GITORIOUS_USER}:${MYSQL_GITORIOUS_PASSWORD}
    Gitorious Admin:
    ${GITORIOUS_ADMIN_EMAIL}:${GITORIOUS_ADMIN_PASSWORD}
    ##############################
    cat > ~/gitorious_settings.txt <<__SCRIPT__
    ################################
    # Your Gitorious install details
    # You can source this file to reset important variables
    ################################
    MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
    MYSQL_GITORIOUS_USER=${MYSQL_GITORIOUS_USER}
    MYSQL_GITORIOUS_PASSWORD=${MYSQL_GITORIOUS_PASSWORD}
    GITORIOUS_DIR=${GITORIOUS_DIR}
    GITORIOUS_USER=${GITORIOUS_USER}
    GITORIOUS_ADMIN_EMAIL=${GITORIOUS_ADMIN_EMAIL}
    GITORIOUS_ADMIN_PASSWORD=${GITORIOUS_ADMIN_PASSWORD}
    # MySQL passwords:
    # root:${MYSQL_ROOT_PASSWORD}
    # ${MYSQL_GITORIOUS_USER}:${MYSQL_GITORIOUS_PASSWORD}
    # Gitorious Dir:
    # ${GITORIOUS_DIR}
    # Gitorious User:
    # ${GITORIOUS_USER}
    # Gitorious Admin:
    # ${GITORIOUS_ADMIN_EMAIL}:${GITORIOUS_ADMIN_PASSWORD}
    ################################
    __SCRIPT__

    #------------------------------------------------------------------------------
    # INSTALLATION STARTS HERE
    #------------------------------------------------------------------------------

    # Binary packages
    # Configurations for automated install
    echo "postfix postfix/main_mailer_type select Internet Site" | sudo debconf-set-selections
    echo "postfix postfix/mailname string ${HOSTNAME}" | sudo debconf-set-selections

    sudo apt-get update
    sudo apt-get install -y build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick postfix

    # Packages built from sources

    mkdir ~/src
    cd ~/src

    # Ruby Enterprise

    re_version='1.8.7-2012.02'
    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-${re_version}.tar.gz
    tar zxf ruby-enterprise-${re_version}.tar.gz
    wget -c https://raw.github.com/gist/5635461/ruby-ee.patch
    patch -p0 < ruby-ee.patch
    sudo ruby-enterprise-${re_version}/installer --auto=/opt/ruby-enterprise-${re_version}
    sudo ln -s /opt/ruby-enterprise-${re_version}/ /opt/ruby-enterprise
    sudo ln -s /opt/ruby-enterprise/bin/ruby /opt/ruby-enterprise/bin/rake /opt/ruby-enterprise/bin/gem /usr/local/bin
    sudo ln -s /opt/ruby-enterprise/bin/irb /usr/bin/irb

    sudo sed -e '$ a\export PATH=\/opt\/ruby-enterprise\/bin:$PATH' -i /etc/profile
    sudo sed -e '$ a\export LD_LIBRARY_PATH=\"\/usr\/local\/lib\"' -i /etc/profile
    sudo sed -e '$ a\export LDFLAGS=\"-L\/usr\/local\/lib -Wl,-rpath,\/usr\/local\/lib\"' -i /etc/profile
    sudo sed -e '1 i\\/usr\/local\/lib' -i /etc/ld.so.conf

    source /etc/profile
    sudo ldconfig

    # MySQL

    echo "mysql-server-5.5 mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password seen true" | sudo debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password_again seen true" | sudo debconf-set-selections
    # Look in /var/cache/debconf/passwords.dat for details of the parameters to be used for the mysql installation

    sudo apt-get install -y mysql-client-5.5 mysql-server-5.5 libmysqlclient-dev
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE gitorious"
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE USER '${MYSQL_GITORIOUS_USER}'@'localhost' IDENTIFIED BY '$MYSQL_GITORIOUS_PASSWORD'"
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON gitorious.* TO '${MYSQL_GITORIOUS_USER}'@'localhost'"

    # Sphinx

    wget -c http://sphinxsearch.com/files/sphinxsearch_2.0.8-release-0ubuntu11~precise1_amd64.deb
    sudo dpkg -i sphinxsearch_2.0.8-release-0ubuntu11~precise1_amd64.deb

    # Memcached

    sudo update-rc.d memcached defaults

    # Adding gitorious group

    sudo groupadd gitorious
    sudo usermod -a -G gitorious $SYSADMIN

    # Cloning gitorious project

    sudo git clone https://git.gitorious.org/gitorious/mainline.git /var/www/gitorious
    sudo chown -R $SYSADMIN:gitorious /var/www/gitorious
    sudo chmod -R g+sw /var/www/gitorious

    sudo ln -s /var/www/gitorious/script/gitorious /usr/local/bin/gitorious
    cd /var/www/gitorious/
    git submodule init
    git submodule update
    #mv public/.htaccess public/.htaccess-DISABLED
    mkdir -p tmp/pids
    sudo chmod ug+x script/*
    sudo chmod -R g+w config/ log/ public/ tmp/

    sudo ln -s /var/www/gitorious/doc/templates/ubuntu/git-ultrasphinx /etc/init.d/git-ultrasphinx
    sudo ln -s /var/www/gitorious/doc/templates/ubuntu/git-daemon /etc/init.d/git-daemon
    sudo ln -s /var/www/gitorious/doc/templates/ubuntu/git-poller /etc/init.d/git-poller
    sudo ln -s /var/www/gitorious/doc/templates/ubuntu/stomp /etc/init.d/stomp

    sudo chmod +x /etc/init.d/git-ultrasphinx
    sudo chmod +x /etc/init.d/git-daemon
    sudo chmod +x /etc/init.d/git-poller
    sudo chmod +x /etc/init.d/stomp
    sudo update-rc.d -f git-daemon start 99 2 3 4 5 .
    sudo update-rc.d -f git-ultrasphinx start 99 2 3 4 5 .
    sudo update-rc.d -f git-poller start 99 2 3 4 5 .
    sudo update-rc.d -f stomp start 99 2 3 4 5 .

    sudo gem install --no-ri --no-rdoc bundler
    sudo ln -s /opt/ruby-enterprise/bin/bundle /usr/bin/bundle

    #cd /var/www/gitorious
    sudo bundle install
    sudo bundle pack
    sudo bundle install --path vendor/cache

    #sudo adduser git
    sudo adduser --system --home /var/www/gitorious/ --no-create-home --shell /bin/bash git
    sudo usermod -a -G gitorious git
    sudo groupadd git
    sudo usermod -a -G git git
    sudo mkdir /srv/git
    sudo ln -s /srv/git /var/git
    sudo mkdir /srv/git/repositories
    sudo mkdir /srv/git/tarballs
    sudo mkdir /srv/git/tarballs-work
    sudo chown -R git:gitorious /srv/git
    sudo chown -R git:gitorious /var/www/gitorious

    sudo su git -c "mkdir ~/.ssh"
    sudo su git -c "chmod 700 ~/.ssh"
    sudo su git -c "touch ~/.ssh/authorized_keys"

    sudo su git -c "touch ~/.bashrc"
    sudo su git -c "echo 'export RUBY_HOME=/opt/ruby-enterprise' >> ~/.bashrc"
    sudo su git -c "echo 'export GEM_HOME=\$RUBY_HOME/lib/ruby/gems/1.8/gems' >> ~/.bashrc"
    sudo su git -c "echo 'export PATH=\$RUBY_HOME/bin:\$PATH' >> ~/.bashrc"

    #cd /var/www/gitorious

    sudo bash -c "cat > config/broker.yml" << EOF
    production:
    adapter: stomp
    EOF

    sudo bash -c "cat > config/database.yml" << EOF
    production:
    adapter: mysql
    database: gitorious
    username: ${MYSQL_GITORIOUS_USER}
    password: $MYSQL_GITORIOUS_PASSWORD
    host: localhost
    encoding: utf8
    EOF

    sudo bash -c "cat > config/gitorious.yml" << EOF
    production:
    cookie_secret: `< /dev/urandom tr -dc A-Za-z0-9 | head -c64`
    repository_base_path: "/srv/git/repositories"
    extra_html_head_data:
    system_message:
    gitorious_client_port: 80
    gitorious_client_host: $GITORIOUS_HOST
    gitorious_host: $GITORIOUS_HOST
    gitorious_user: git
    exception_notification_emails: $SYSADMIN_EMAIL
    mangle_email_addresses: true
    public_mode: false
    locale: en
    archive_cache_dir: "/srv/git/tarballs"
    archive_work_dir: "/srv/git/tarballs-work"
    only_site_admins_can_create_projects: true
    hide_http_clone_urls: true
    is_gitorious_dot_org: false
    use_ssl: false
    EOF

    sudo env RAILS_ENV=production rake _0.8.7_ db:migrate

    sudo cat | sudo env RAILS_ENV=production script/create_admin << EOF
    $GITORIOUS_ADMIN_EMAIL
    $GITORIOUS_ADMIN_PASSWORD
    EOF

    sudo cat | script/console production << EOF
    user = User.first
    user.login = "$GITORIOUS_ADMIN"
    user.activate
    user.accept_terms
    user.save
    EOF

    sudo RAILS_ENV=production bundle exec rake thinking_sphinx:configure
    sudo RAILS_ENV=production bundle exec rake thinking_sphinx:index

    cd /var/www/gitorious
    sudo chown -R git:gitorious config/environment.rb script/poller log tmp
    sudo chmod -R g+w config/environment.rb script/poller log tmp
    sudo chmod ug+x script/poller
    sudo chmod g-w /var/www/gitorious

    sudo gem install stompserver
    sudo ln -s /opt/ruby-enterprise/bin/stompserver /usr/bin/stompserver
    sudo /etc/init.d/stomp start

    sudo env RAILS_ENV=production /etc/init.d/git-daemon start
    sudo /etc/init.d/git-poller start

    sudo gem install --no-ri --no-rdoc passenger --version 3.0.19
    sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module
    #sudo RAILS_ENV=production bundle exec rake apache2

    sudo bash -c "cat > passenger.load" << EOF
    LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-4.0.3/libout/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-4.0.3
    PassengerRuby /opt/ruby-enterprise/bin/ruby
    EOF

    sudo mv passenger.load /etc/apache2/mods-available/
    sudo a2enmod passenger
    sudo a2enmod rewrite
    sudo a2enmod deflate
    sudo a2enmod expires

    sudo bash -c "cat > gitorious" << EOF
    apt-get update && apt-get dist-upgrade -y
    # install some useful packages
    apt-get install -y colordiff locate ntp pwgen rsync vim

    # install postfix for sending out emails to users etc
    echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections
    echo "postfix postfix/mailname string ${HOSTNAME}" | debconf-set-selections
    apt-get install -y postfix

    # install MySQL 5.5
    echo "mysql-server-5.5 mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password seen true" | debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password_again seen true" | debconf-set-selections
    apt-get install -y mysql-server mysql-client

    # Install the apache2 webserver and enable module Rewrite
    apt-get install -y apache2 memcached
    a2enmod rewrite && service apache2 restart

    # Install Ruby, Interactive Ruby, SSL support for Ruby, and update system Gems
    apt-get install -y \
    ruby1.9.1 ruby1.9.1-dev rdoc1.9.1 \
    irb1.9.1 ri1.9.1 \
    libopenssl-ruby1.9.1 libssl-dev \
    build-essential
    REALLY_GEM_UPDATE_SYSTEM=1 gem update --system
    gem install -b --no-ri --no-rdoc bundler

    # Fetch Gitorious
    # See what rake tasks can be done: bundle exec ${GITORIOUS_DIR}/bin/rake --tasks
    apt-get install -y git
    git clone git://gitorious.org/gitorious/mainline.git ${GITORIOUS_DIR}
    cd ${GITORIOUS_DIR}
    git submodule update --init --recursive
    # Fix a bug in the Gemfile syntax
    sed -i.old -e 's/\(git\|branch\|submodules\): /:\1 => /g' Gemfile
    ln -s ${GITORIOUS_DIR}/bin/gitorious /usr/bin

    # Download and install the required Gems using bundler but first, lets install some package dependencies
    apt-get install -y libxml2-dev libxslt1-dev libicu-dev libmysqlclient-dev libpq-dev
    # check we have bundle >= 1.3.5 before we continue
    bundle -v
    bundle --deployment
    #bundle pack --all
    #bundle install

    # Setup the web/application server side of things
    #####
    # Install the Ruby application server, called passenger, and install the passenger module for apache2 from the phusionpassenger repo
    gem install -b --no-ri --no-rdoc passenger
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
    cat > /etc/apt/sources.list.d/passenger.list << __PASSENGER__
    deb https://oss-binaries.phusionpassenger.com/apt/passenger precise main
    __PASSENGER__
    chmod 600 /etc/apt/sources.list.d/passenger.list
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
    apt-get update
    apt-get install -y libapache2-mod-passenger

    # Create apache2 site config file for gitorious
    cat > /etc/apache2/sites-available/gitorious << __GITORIOUS_SITE__
    <VirtualHost *:80>
    <Directory /var/www/gitorious/public>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from All
    </Directory>
    DocumentRoot /var/www/gitorious/public
    ServerName $GITORIOUS_HOST
    # Gzip/Deflate
    # http://fluxura.com/2006/5/19/apache-for-static-and-mongrel-for-rails-with-mod_deflate-and-capistrano-support
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    # Far future expires date
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    ExpiresActive On
    ExpiresDefault "access plus 1 year"
    </FilesMatch>
    # No Etags
    FileETag None
    RewriteEngine On
    # Check for maintenance file and redirect all requests
    RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
    RewriteCond %{SCRIPT_FILENAME} !maintenance.html
    RewriteRule ^.*$ /system/maintenance.html [L]
    ServerName `hostname --all-fqdns`
    DocumentRoot ${GITORIOUS_DIR}/public
    </VirtualHost>
    EOF

    sudo mv gitorious /etc/apache2/sites-available/
    sudo a2ensite gitorious

    sudo a2dissite default
    sudo a2dissite default-ssl

    sudo invoke-rc.d apache2 restart

    sudo chmod g-w /var/www/gitorious
    sudo chown -R git:gitorious /var/www/gitorious
    __GITORIOUS_SITE__

    # Create the SSL version of gitorious
    a2enmod ssl
    cat > /etc/apache2/sites-available/gitorious-ssl << __GITORIOUS_SSL_SITE__
    <IfModule mod_ssl.c>
    <VirtualHost _default_:443>
    DocumentRoot ${GITORIOUS_DIR}/public
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
    BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    </VirtualHost>
    </IfModule>
    __GITORIOUS_SSL_SITE__

    # Configure Gitorious and setup the relevant files/directories/user
    cp ~/gitorious_install/config/gitorious.yml config/
    mkdir -p /var/git/{repositories,tarballs-work,tarballs}
    adduser --system --home ${GITORIOUS_DIR} --no-create-home --group --shell /bin/bash ${GITORIOUS_USER}
    mkdir ${GITORIOUS_DIR}/.ssh
    touch ${GITORIOUS_DIR}/.ssh/authorized_keys
    chmod 700 ${GITORIOUS_DIR}/.ssh
    chmod 600 ${GITORIOUS_DIR}/.ssh/authorized_keys

    # copy the backup repositories into /var/git/repositories
    tar -xf ~/gitorious_install/gitorious_snapshot.tar --directory /tmp && mv -r /tmp/tmp-backup-workdir/repos/* /var/git/repositories/
    # ensure ${GITORIOUS_USER} is the owner of everything under /var/git
    chown -R ${GITORIOUS_USER}:${GITORIOUS_USER} /var/git

    # Setup the MySQL databases
    #####
    cp ~/gitorious_install/config/database.yml config/
    # Create the gitorious MySQL Database and grant access to it by the user MySQL gitorious user
    mysql -u root --password=${MYSQL_ROOT_PASSWORD} -e "CREATE DATABASE gitorious"
    mysql -u root --password=${MYSQL_ROOT_PASSWORD} -e "CREATE DATABASE gitorious_dev"
    mysql -u root --password=${MYSQL_ROOT_PASSWORD} -e "CREATE DATABASE gitorious_test"
    mysql -u root --password=${MYSQL_ROOT_PASSWORD} -e "CREATE USER '${MYSQL_GITORIOUS_USER}'@'localhost' IDENTIFIED BY '$MYSQL_GITORIOUS_PASSWORD'"
    mysql -u root --password=${MYSQL_ROOT_PASSWORD} -e "GRANT ALL PRIVILEGES ON gitorious.* TO '${MYSQL_GITORIOUS_USER}'@'localhost'"
    mysql -u root --password=${MYSQL_ROOT_PASSWORD} -e "GRANT ALL PRIVILEGES ON gitorious_dev.* TO '${MYSQL_GITORIOUS_USER}'@'localhost'"
    mysql -u root --password=${MYSQL_ROOT_PASSWORD} -e "GRANT ALL PRIVILEGES ON gitorious_test.* TO '${MYSQL_GITORIOUS_USER}'@'localhost'"
    # Import an existing database generated from mysqldump
    mysql -u ${MYSQL_GITORIOUS_USER} --password=$MYSQL_GITORIOUS_PASSWORD gitorious < ~/gitorious_install/gitorious_db.dump
    mysql -u ${MYSQL_GITORIOUS_USER} --password=$MYSQL_GITORIOUS_PASSWORD gitorious_dev < ~/gitorious_install/gitorious_db.dump

    # ensure ${GITORIOUS_USER} is the owner of the everything under ${GITORIOUS_DIR}
    chown -R ${GITORIOUS_USER}:${GITORIOUS_USER} ${GITORIOUS_DIR}

    # Migrate the imported data to the DB schema of the current Gitorious Install and Precompile all assets
    bin/rake db:migrate
    bin/rake assets:precompile

    # Disable the default sites and enable the Gitorious sites
    a2dissite default && a2dissite default-ssl && a2ensite gitorious && a2ensite gitorious-ssl && service apache2 reload
    touch tmp/restart.txt

    a2ensite default && a2ensite default-ssl && a2dissite gitorious && a2dissite gitorious-ssl && service apache2 reload
    # apache2ctl start

    touch tmp/restart.txt

    # Setup all the services
    ######
    # Install the Redis key-value server and enable memory over commit for it
    apt-get install -y redis-server
    cat >> /etc/sysctl.conf << __REDIS_CONFIG__
    vm.overcommit_memory=1
    __REDIS_CONFIG__
    service redis-server restart
    # Install Sphinx Search Engine
    SPHINXSEARCH_VERSION='2.1.4'
    apt-get install -y libodbc1 unixodbc libltdl7 odbcinst1debian2 odbcinst
    wget --directory-prefix ~/ -c http://sphinxsearch.com/files/sphinxsearch_${SPHINXSEARCH_VERSION}-release-0ubuntu11~precise_amd64.deb
    dpkg -i ~/sphinxsearch_${SPHINXSEARCH_VERSION}-release-0ubuntu11~precise_amd64.deb

    # Ensure everything comes up when we reboot. We'll use upstart config files supplied as templates for this
    #####
    # git-daemon and git-proxy - Add them to the init directory and let upstart know about them
    sed -i.old -e 's/\/var\/www\/gitorious\/repositories/\/var\/git\/repositories/' ${GITORIOUS_DIR}/doc/templates/upstart/git-daemons.conf
    sed -i.old -e 's/\/app//' ${GITORIOUS_DIR}/doc/templates/upstart/git-proxy.conf
    ln -s ${GITORIOUS_DIR}/doc/templates/upstart/git-daemons.conf /etc/init/
    ln -s ${GITORIOUS_DIR}/doc/templates/upstart/git-proxy.conf /etc/init/
    initctl reload-configuration
    start git-daemons

    # Redis key-value server and resque-worker
    update-rc.d redis-server defaults # Maybe change to upstart?
    sed -i.old -e 's/\/app//' ${GITORIOUS_DIR}/doc/templates/upstart/resque-worker.conf
    ln -s ${GITORIOUS_DIR}/doc/templates/upstart/resque-worker.conf /etc/init/
    initctl reload-configuration
    start resque-worker

    # Thinking Sphinx search engine
    # rebuild search index
    bin/rake ts:configure
    ${GITORIOUS_DIR}/bin/rake ts:index

    cat > ${GITORIOUS_DIR}/doc/templates/upstart/thinking-sphinx.conf <<__THINKING_SPHINX__
    description "Sphinx Upstart script"
    start on startup
    stop on shutdown
    console output
    respawn
    script
    env RAILS_ENV=production
    exec sudo -u git -i /usr/bin/searchd --config ${GITORIOUS_DIR}/config/production.sphinx.conf --nodetach
    end script
    __THINKING_SPHINX__
    ln -s ${GITORIOUS_DIR}/doc/templates/upstart/thinking-sphinx.conf /etc/init/
    initctl reload-configuration
    start thinking-sphinx

    # Add a cron job to rebuild sphinx indexes evey 30mins between 06:00-21:00 Mon-Fri
    #crontab -u ${GITORIOUS_USER} -e
    cat >> /var/spool/cron/crontabs/${GITORIOUS_USER} <<__SPHINX_REBUILD_CRONTAB__
    */30 6-21 * * 1-5 ${GITORIOUS_DIR}/bin/rake ts:rebuild > /dev/null
    __SPHINX_REBUILD_CRONTAB__
    chown ${GITORIOUS_USER}:crontab /var/spool/cron/crontabs/${GITORIOUS_USER}
    chmod 600 /var/spool/cron/crontabs/${GITORIOUS_USER}

    # Configure Gitorious for hosts without a valid SSL certificate
    cat >> ${GITORIOUS_DIR}/config/smtp.yml << __GITORIOUS_SMTP_CONFIG__
    address: localhost
    port: 25
    enable_starttls_auto: false
    openssl_verify_mode: none
    __GITORIOUS_SMTP_CONFIG__
    touch tmp/restart.txt

    #####
    # FINAL CHECKS
    #####
    # Check for certain that all relevant directories/files are owned by ${GITORIOUS_USER}:${GITORIOUS_USER}
    chown -R ${GITORIOUS_USER}:${GITORIOUS_USER} ${GITORIOUS_DIR} /var/git
    # Ensure we have a symlink to the ${GITORIOUS_DIR}/data/hooks directory in the top of the repositories directory
    # TODO Maybe use script/fixup_hooks script?
    ln -s ${GITORIOUS_DIR}/data/hooks /var/git/repositories/.hooks
    # Restore the .ssh/authorized_keys from backup if necessary otherwise all keys will need to be added back again via the UI
    su -c "scp nhaigh@bioserver:git/sysadmin/generic/gitorious_install/authorized_keys ${GITORIOUS_DIR}/.ssh/authorized_keys" ${GITORIOUS_USER}
    # Run tests
    su - -c "${GITORIOUS_DIR}/bin/rake test:micros" ${GITORIOUS_USER}
    touch tmp/restart.txt

    #####
    # TODO Log rotate
    # TODO Check apache2 configuration for tarball generation/downloads in gitorious
    #####

    # sudo apt-get install -y build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick postfix
    #sudo a2enmod deflate
    #sudo bash -c "cat > gitorious" << EOF
    #<VirtualHost *:80>
    # <Directory /var/www/gitorious/public>
    # Options FollowSymLinks
    # AllowOverride None
    # Order allow,deny
    # Allow from All
    # </Directory>
    #
    # DocumentRoot /var/www/gitorious/public
    # ServerName $GITORIOUS_HOST
    #
    # # Gzip/Deflate
    # # http://fluxura.com/2006/5/19/apache-for-static-and-mongrel-for-rails-with-mod_deflate-and-capistrano-support
    # AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
    # BrowserMatch ^Mozilla/4 gzip-only-text/html
    # BrowserMatch ^Mozilla/4\.0[678] no-gzip
    # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    #
    # # Far future expires date
    # <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    # ExpiresActive On
    # ExpiresDefault "access plus 1 year"
    # </FilesMatch>
    #
    # # No Etags
    # FileETag None
    #
    # RewriteEngine On
    #
    # # Check for maintenance file and redirect all requests
    # RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
    # RewriteCond %{SCRIPT_FILENAME} !maintenance.html
    # RewriteRule ^.*$ /system/maintenance.html [L]
    #</VirtualHost>
    #EOF
    9 changes: 0 additions & 9 deletions ruby-ee.patch
    Original file line number Diff line number Diff line change
    @@ -1,9 +0,0 @@
    --- ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-02-19 15:09:11.000000000 +0100
    +++ ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-07-05 13:34:17.677491684 +0200
    @@ -1669,5 +1669,5 @@
    MallocHook::InvokeNewHook(result, size);
    return result;
    }
    -void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
    +void *(* volatile __memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
    #endif // #ifndef TCMALLOC_FOR_DEBUGALLOCATION
  3. Nathan S. Watson-Haigh revised this gist Jan 14, 2014. 1 changed file with 0 additions and 9 deletions.
    9 changes: 0 additions & 9 deletions ruby-ee.patch
    Original file line number Diff line number Diff line change
    @@ -1,9 +0,0 @@
    --- ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-02-19 15:09:11.000000000 +0100
    +++ ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-07-05 13:34:17.677491684 +0200
    @@ -1669,5 +1669,5 @@
    MallocHook::InvokeNewHook(result, size);
    return result;
    }
    -void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
    +void *(* volatile __memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
    #endif // #ifndef TCMALLOC_FOR_DEBUGALLOCATION
  4. temp revised this gist Dec 19, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -41,6 +41,9 @@ __SCRIPT__
    #------------------------------------------------------------------------------

    # Binary packages
    # Configurations for automated install
    echo "postfix postfix/main_mailer_type select Internet Site" | sudo debconf-set-selections
    echo "postfix postfix/mailname string ${HOSTNAME}" | sudo debconf-set-selections

    sudo apt-get update
    sudo apt-get install -y build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick postfix
  5. temp revised this gist Dec 18, 2013. 1 changed file with 14 additions and 7 deletions.
    21 changes: 14 additions & 7 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@
    # You should clone this gist to obtain the installation and patch file
    # and then run it locally, after changing the below settings to something
    # suitable for your system. Something like this:
    # sudo apt-get install -y ssh git
    # cd
    # git clone https://gist.github.com/5635461.git gitorious_install
    # Edit the settings below, then run:
    # cd gitorious_install && sh ./install.sh
    @@ -22,13 +24,18 @@ GITORIOUS_ADMIN=$USER
    GITORIOUS_ADMIN_EMAIL=${GITORIOUS_ADMIN}@${GITORIOUS_HOST}
    GITORIOUS_ADMIN_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-15};echo;`

    echo "#################################################"
    echo "Your installation passwords are as follows:"
    echo " MySQL password for user, root, is: ${MYSQL_ROOT_PASSWORD}"
    echo " MySQL password for user, ${MYSQL_GITORIOUS_USER}, is: ${MYSQL_GITORIOUS_PASSWORD}"
    echo " Initial Gitorious Admin user, ${GITORIOUS_ADMIN_EMAIL}, is: ${GITORIOUS_ADMIN_PASSWORD}"
    echo "#################################################"
    exit
    cat > settings.txt <<__SCRIPT__
    ##############################
    Your gitorious install details
    ##############################
    MySQL passwords:
    root:${MYSQL_ROOT_PASSWORD}
    ${MYSQL_GITORIOUS_USER}:${MYSQL_GITORIOUS_PASSWORD}
    Gitorious Admin:
    ${GITORIOUS_ADMIN_EMAIL}:${GITORIOUS_ADMIN_PASSWORD}
    ##############################
    __SCRIPT__

    #------------------------------------------------------------------------------
    # INSTALLATION STARTS HERE
    #------------------------------------------------------------------------------
  6. @nathanhaigh nathanhaigh revised this gist May 29, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,7 @@ exit
    # Binary packages

    sudo apt-get update
    sudo apt-get install -y build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick
    sudo apt-get install -y build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick postfix

    # Packages built from sources

  7. temp revised this gist May 28, 2013. 1 changed file with 11 additions and 4 deletions.
    15 changes: 11 additions & 4 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -10,18 +10,25 @@
    # SETTINGS
    #------------------------------------------------------------------------------

    MYSQL_ROOT_PASSWORD=password
    MYSQL_ROOT_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-15};echo;`
    MYSQL_GITORIOUS_USER=gitorious
    MYSQL_GITORIOUS_PASSWORD=password
    MYSQL_GITORIOUS_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-15};echo;`
    GITORIOUS_HOST=`hostname -f`
    # SYSADMIN details i.e. the user running this script
    SYSADMIN=$USER
    SYSADMIN_EMAIL=${SYSADMIN}@$GITORIOUS_HOST
    # gitorious admin details
    GITORIOUS_ADMIN=$USER
    GITORIOUS_ADMIN_EMAIL=${GITORIOUS_ADMIN}@${GITORIOUS_HOST}
    GITORIOUS_ADMIN_PASSWORD=password

    GITORIOUS_ADMIN_PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-15};echo;`

    echo "#################################################"
    echo "Your installation passwords are as follows:"
    echo " MySQL password for user, root, is: ${MYSQL_ROOT_PASSWORD}"
    echo " MySQL password for user, ${MYSQL_GITORIOUS_USER}, is: ${MYSQL_GITORIOUS_PASSWORD}"
    echo " Initial Gitorious Admin user, ${GITORIOUS_ADMIN_EMAIL}, is: ${GITORIOUS_ADMIN_PASSWORD}"
    echo "#################################################"
    exit
    #------------------------------------------------------------------------------
    # INSTALLATION STARTS HERE
    #------------------------------------------------------------------------------
  8. temp revised this gist May 28, 2013. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -16,9 +16,9 @@ MYSQL_GITORIOUS_PASSWORD=password
    GITORIOUS_HOST=`hostname -f`
    # SYSADMIN details i.e. the user running this script
    SYSADMIN=$USER
    SYSADMIN_EMAIL=${USER}@$GITORIOUS_HOST
    SYSADMIN_EMAIL=${SYSADMIN}@$GITORIOUS_HOST
    # gitorious admin details
    GITORIOUS_ADMIN=${SYSADMIN}
    GITORIOUS_ADMIN=$USER
    GITORIOUS_ADMIN_EMAIL=${GITORIOUS_ADMIN}@${GITORIOUS_HOST}
    GITORIOUS_ADMIN_PASSWORD=password

    @@ -123,6 +123,8 @@ sudo bundle install --path vendor/cache
    #sudo adduser git
    sudo adduser --system --home /var/www/gitorious/ --no-create-home --shell /bin/bash git
    sudo usermod -a -G gitorious git
    sudo groupadd git
    sudo usermod -a -G git git
    sudo mkdir /srv/git
    sudo ln -s /srv/git /var/git
    sudo mkdir /srv/git/repositories
  9. temp revised this gist May 26, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ SYSADMIN_EMAIL=${USER}@$GITORIOUS_HOST
    # gitorious admin details
    GITORIOUS_ADMIN=${SYSADMIN}
    GITORIOUS_ADMIN_EMAIL=${GITORIOUS_ADMIN}@${GITORIOUS_HOST}
    GITORIOUS_ADMIN_PASSWORD=PASSWORD
    GITORIOUS_ADMIN_PASSWORD=password

    #------------------------------------------------------------------------------
    # INSTALLATION STARTS HERE
  10. temp revised this gist May 26, 2013. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,7 @@
    #------------------------------------------------------------------------------

    MYSQL_ROOT_PASSWORD=password
    MYSQL_GITORIOUS_USER=gitorious
    MYSQL_GITORIOUS_PASSWORD=password
    GITORIOUS_HOST=`hostname -f`
    # SYSADMIN details i.e. the user running this script
    @@ -65,8 +66,8 @@ echo "mysql-server-5.5 mysql-server/root_password_again seen true" | sudo debcon

    sudo apt-get install -y mysql-client-5.5 mysql-server-5.5 libmysqlclient-dev
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE gitorious"
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE USER 'gitorious'@'localhost' IDENTIFIED BY '$MYSQL_GITORIOUS_PASSWORD'"
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON gitorious.* TO 'gitorious'@'localhost'"
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE USER '${MYSQL_GITORIOUS_USER}'@'localhost' IDENTIFIED BY '$MYSQL_GITORIOUS_PASSWORD'"
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON gitorious.* TO '${MYSQL_GITORIOUS_USER}'@'localhost'"

    # Sphinx

    @@ -150,7 +151,7 @@ sudo bash -c "cat > config/database.yml" << EOF
    production:
    adapter: mysql
    database: gitorious
    username: gitorious
    username: ${MYSQL_GITORIOUS_USER}
    password: $MYSQL_GITORIOUS_PASSWORD
    host: localhost
    encoding: utf8
  11. temp revised this gist May 26, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -211,6 +211,7 @@ sudo /etc/init.d/git-poller start

    sudo gem install --no-ri --no-rdoc passenger --version 3.0.19
    sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module
    #sudo RAILS_ENV=production bundle exec rake apache2

    sudo bash -c "cat > passenger.load" << EOF
    LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-4.0.3/libout/apache2/mod_passenger.so
  12. temp revised this gist May 26, 2013. 1 changed file with 11 additions and 8 deletions.
    19 changes: 11 additions & 8 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -13,10 +13,13 @@
    MYSQL_ROOT_PASSWORD=password
    MYSQL_GITORIOUS_PASSWORD=password
    GITORIOUS_HOST=`hostname -f`
    # SYSADMIN user must exist
    # SYSADMIN details i.e. the user running this script
    SYSADMIN=$USER
    SYSADMIN_EMAIL=git@$GITORIOUS_HOST
    SYSADMIN_PASSWORD=password
    SYSADMIN_EMAIL=${USER}@$GITORIOUS_HOST
    # gitorious admin details
    GITORIOUS_ADMIN=${SYSADMIN}
    GITORIOUS_ADMIN_EMAIL=${GITORIOUS_ADMIN}@${GITORIOUS_HOST}
    GITORIOUS_ADMIN_PASSWORD=PASSWORD

    #------------------------------------------------------------------------------
    # INSTALLATION STARTS HERE
    @@ -178,13 +181,13 @@ EOF
    sudo env RAILS_ENV=production rake _0.8.7_ db:migrate

    sudo cat | sudo env RAILS_ENV=production script/create_admin << EOF
    $SYSADMIN_EMAIL
    $SYSADMIN_PASSWORD
    $GITORIOUS_ADMIN_EMAIL
    $GITORIOUS_ADMIN_PASSWORD
    EOF

    sudo cat | script/console production << EOF
    user = User.first
    user.login = "$SYSADMIN"
    user.login = "$GITORIOUS_ADMIN"
    user.activate
    user.accept_terms
    user.save
    @@ -210,8 +213,8 @@ sudo gem install --no-ri --no-rdoc passenger --version 3.0.19
    sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module

    sudo bash -c "cat > passenger.load" << EOF
    LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.19
    LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-4.0.3/libout/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-4.0.3
    PassengerRuby /opt/ruby-enterprise/bin/ruby
    EOF

  13. temp revised this gist May 26, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ MYSQL_ROOT_PASSWORD=password
    MYSQL_GITORIOUS_PASSWORD=password
    GITORIOUS_HOST=`hostname -f`
    # SYSADMIN user must exist
    SYSADMIN=sysadmin
    SYSADMIN=$USER
    SYSADMIN_EMAIL=git@$GITORIOUS_HOST
    SYSADMIN_PASSWORD=password

  14. temp revised this gist May 26, 2013. 1 changed file with 0 additions and 0 deletions.
    Empty file modified install.sh
    100644 → 100755
    Empty file.
  15. temp revised this gist May 26, 2013. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,10 @@

    MYSQL_ROOT_PASSWORD=password
    MYSQL_GITORIOUS_PASSWORD=password
    GITORIOUS_HOST=gitorious
    GITORIOUS_HOST=`hostname -f`
    # SYSADMIN user must exist
    SYSADMIN=ubuntu
    SYSADMIN_EMAIL=ubuntu@$GITORIOUS_HOST
    SYSADMIN=sysadmin
    SYSADMIN_EMAIL=git@$GITORIOUS_HOST
    SYSADMIN_PASSWORD=password

    #------------------------------------------------------------------------------
    @@ -37,7 +37,7 @@ cd ~/src
    re_version='1.8.7-2012.02'
    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-${re_version}.tar.gz
    tar zxf ruby-enterprise-${re_version}.tar.gz
    #wget -c https://raw.github.com/gist/1122244/ruby-ee.patch
    wget -c https://raw.github.com/gist/5635461/ruby-ee.patch
    patch -p0 < ruby-ee.patch
    sudo ruby-enterprise-${re_version}/installer --auto=/opt/ruby-enterprise-${re_version}
    sudo ln -s /opt/ruby-enterprise-${re_version}/ /opt/ruby-enterprise
    @@ -58,6 +58,7 @@ echo "mysql-server-5.5 mysql-server/root_password password $MYSQL_ROOT_PASSWORD"
    echo "mysql-server-5.5 mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password seen true" | sudo debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password_again seen true" | sudo debconf-set-selections
    # Look in /var/cache/debconf/passwords.dat for details of the parameters to be used for the mysql installation

    sudo apt-get install -y mysql-client-5.5 mysql-server-5.5 libmysqlclient-dev
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE gitorious"
  16. @nathanhaigh nathanhaigh revised this gist May 24, 2013. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,10 @@
    #!/bin/bash
    # You should clone this gist to obtain the installation and patch file
    # and then run it locally, after changing the below settings to something
    # suitable for your system. Something like this:
    # git clone https://gist.github.com/5635461.git gitorious_install
    # Edit the settings below, then run:
    # cd gitorious_install && sh ./install.sh

    #------------------------------------------------------------------------------
    # SETTINGS
    @@ -31,7 +37,7 @@ cd ~/src
    re_version='1.8.7-2012.02'
    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-${re_version}.tar.gz
    tar zxf ruby-enterprise-${re_version}.tar.gz
    wget -c https://raw.github.com/gist/1122244/ruby-ee.patch
    #wget -c https://raw.github.com/gist/1122244/ruby-ee.patch
    patch -p0 < ruby-ee.patch
    sudo ruby-enterprise-${re_version}/installer --auto=/opt/ruby-enterprise-${re_version}
    sudo ln -s /opt/ruby-enterprise-${re_version}/ /opt/ruby-enterprise
  17. @nathanhaigh nathanhaigh revised this gist May 23, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -129,7 +129,7 @@ sudo su git -c "echo 'export RUBY_HOME=/opt/ruby-enterprise' >> ~/.bashrc"
    sudo su git -c "echo 'export GEM_HOME=\$RUBY_HOME/lib/ruby/gems/1.8/gems' >> ~/.bashrc"
    sudo su git -c "echo 'export PATH=\$RUBY_HOME/bin:\$PATH' >> ~/.bashrc"

    cd /var/www/gitorious
    #cd /var/www/gitorious

    sudo bash -c "cat > config/broker.yml" << EOF
    production:
  18. @nathanhaigh nathanhaigh revised this gist May 23, 2013. 1 changed file with 13 additions and 14 deletions.
    27 changes: 13 additions & 14 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,9 @@
    MYSQL_ROOT_PASSWORD=password
    MYSQL_GITORIOUS_PASSWORD=password
    GITORIOUS_HOST=gitorious
    SYSADMIN=sysadmin
    SYSADMIN_EMAIL=git@$GITORIOUS_HOST
    # SYSADMIN user must exist
    SYSADMIN=ubuntu
    SYSADMIN_EMAIL=ubuntu@$GITORIOUS_HOST
    SYSADMIN_PASSWORD=password

    #------------------------------------------------------------------------------
    @@ -18,23 +19,22 @@ SYSADMIN_PASSWORD=password
    # Binary packages

    sudo apt-get update
    sudo apt-get -y install build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick
    sudo apt-get install -y build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick

    # Packages built from sources

    mkdir ~/src
    cd ~/src

    # Ruby Enterprise

    cd ~/src

    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz
    tar zxf ruby-enterprise-1.8.7-2012.02.tar.gz
    #wget -c https://raw.github.com/gist/1122244/ruby-ee.patch
    re_version='1.8.7-2012.02'
    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-${re_version}.tar.gz
    tar zxf ruby-enterprise-${re_version}.tar.gz
    wget -c https://raw.github.com/gist/1122244/ruby-ee.patch
    patch -p0 < ruby-ee.patch
    sudo ruby-enterprise-1.8.7-2012.02/installer
    cd /opt
    sudo ln -s ruby-enterprise-1.8.7-2012.02/ ruby-enterprise
    sudo ruby-enterprise-${re_version}/installer --auto=/opt/ruby-enterprise-${re_version}
    sudo ln -s /opt/ruby-enterprise-${re_version}/ /opt/ruby-enterprise
    sudo ln -s /opt/ruby-enterprise/bin/ruby /opt/ruby-enterprise/bin/rake /opt/ruby-enterprise/bin/gem /usr/local/bin
    sudo ln -s /opt/ruby-enterprise/bin/irb /usr/bin/irb

    @@ -60,7 +60,6 @@ mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON gitori

    # Sphinx

    cd ~/src
    wget -c http://sphinxsearch.com/files/sphinxsearch_2.0.8-release-0ubuntu11~precise1_amd64.deb
    sudo dpkg -i sphinxsearch_2.0.8-release-0ubuntu11~precise1_amd64.deb

    @@ -83,7 +82,7 @@ sudo ln -s /var/www/gitorious/script/gitorious /usr/local/bin/gitorious
    cd /var/www/gitorious/
    git submodule init
    git submodule update
    mv public/.htaccess public/.htaccess-DISABLED
    #mv public/.htaccess public/.htaccess-DISABLED
    mkdir -p tmp/pids
    sudo chmod ug+x script/*
    sudo chmod -R g+w config/ log/ public/ tmp/
    @@ -105,7 +104,7 @@ sudo update-rc.d -f stomp start 99 2 3 4 5 .
    sudo gem install --no-ri --no-rdoc bundler
    sudo ln -s /opt/ruby-enterprise/bin/bundle /usr/bin/bundle

    cd /var/www/gitorious
    #cd /var/www/gitorious
    sudo bundle install
    sudo bundle pack
    sudo bundle install --path vendor/cache
  19. @nathanhaigh nathanhaigh revised this gist May 23, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ SYSADMIN_PASSWORD=password
    # Binary packages

    sudo apt-get update
    sudo apt-get install build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick
    sudo apt-get -y install build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick

    # Packages built from sources

  20. @nathanhaigh nathanhaigh revised this gist May 23, 2013. 1 changed file with 5 additions and 9 deletions.
    14 changes: 5 additions & 9 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,7 @@ cd ~/src

    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz
    tar zxf ruby-enterprise-1.8.7-2012.02.tar.gz
    wget -c https://raw.github.com/gist/1122244/ruby-ee.patch
    #wget -c https://raw.github.com/gist/1122244/ruby-ee.patch
    patch -p0 < ruby-ee.patch
    sudo ruby-enterprise-1.8.7-2012.02/installer
    cd /opt
    @@ -61,12 +61,8 @@ mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON gitori
    # Sphinx

    cd ~/src
    wget -c http://sphinxsearch.com/files/sphinx-0.9.9.tar.gz
    tar zxf sphinx-0.9.9.tar.gz
    cd sphinx-0.9.9
    ./configure
    make
    sudo make install
    wget -c http://sphinxsearch.com/files/sphinxsearch_2.0.8-release-0ubuntu11~precise1_amd64.deb
    sudo dpkg -i sphinxsearch_2.0.8-release-0ubuntu11~precise1_amd64.deb

    # Memcached

    @@ -188,7 +184,8 @@ user.accept_terms
    user.save
    EOF

    sudo env RAILS_ENV=production rake _0.8.7_ ultrasphinx:bootstrap
    sudo RAILS_ENV=production bundle exec rake thinking_sphinx:configure
    sudo RAILS_ENV=production bundle exec rake thinking_sphinx:index

    cd /var/www/gitorious
    sudo chown -R git:gitorious config/environment.rb script/poller log tmp
    @@ -265,4 +262,3 @@ sudo invoke-rc.d apache2 restart

    sudo chmod g-w /var/www/gitorious
    sudo chown -R git:gitorious /var/www/gitorious

  21. Brian Moore revised this gist Apr 8, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -203,7 +203,7 @@ sudo /etc/init.d/stomp start
    sudo env RAILS_ENV=production /etc/init.d/git-daemon start
    sudo /etc/init.d/git-poller start

    sudo gem install --no-ri --no-rdoc passenger --version 3.0.18
    sudo gem install --no-ri --no-rdoc passenger --version 3.0.19
    sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module

    sudo bash -c "cat > passenger.load" << EOF
  22. Brian Moore revised this gist Mar 22, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -207,8 +207,8 @@ sudo gem install --no-ri --no-rdoc passenger --version 3.0.18
    sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module

    sudo bash -c "cat > passenger.load" << EOF
    LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.18
    LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.19
    PassengerRuby /opt/ruby-enterprise/bin/ruby
    EOF

  23. Brian Moore revised this gist Dec 10, 2012. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -136,12 +136,12 @@ sudo su git -c "echo 'export PATH=\$RUBY_HOME/bin:\$PATH' >> ~/.bashrc"

    cd /var/www/gitorious

    sudo cat > config/broker.yml << EOF
    sudo bash -c "cat > config/broker.yml" << EOF
    production:
    adapter: stomp
    EOF

    sudo cat > config/database.yml << EOF
    sudo bash -c "cat > config/database.yml" << EOF
    production:
    adapter: mysql
    database: gitorious
    @@ -151,7 +151,7 @@ production:
    encoding: utf8
    EOF

    sudo cat > config/gitorious.yml << EOF
    sudo bash -c "cat > config/gitorious.yml" << EOF
    production:
    cookie_secret: `< /dev/urandom tr -dc A-Za-z0-9 | head -c64`
    repository_base_path: "/srv/git/repositories"
    @@ -173,9 +173,9 @@ production:
    use_ssl: false
    EOF

    RAILS_ENV=production rake _0.8.7_ db:migrate
    sudo env RAILS_ENV=production rake _0.8.7_ db:migrate

    sudo cat | RAILS_ENV=production script/create_admin << EOF
    sudo cat | sudo env RAILS_ENV=production script/create_admin << EOF
    $SYSADMIN_EMAIL
    $SYSADMIN_PASSWORD
    EOF
    @@ -188,7 +188,7 @@ user.accept_terms
    user.save
    EOF

    RAILS_ENV=production rake _0.8.7_ ultrasphinx:bootstrap
    sudo env RAILS_ENV=production rake _0.8.7_ ultrasphinx:bootstrap

    cd /var/www/gitorious
    sudo chown -R git:gitorious config/environment.rb script/poller log tmp
    @@ -203,12 +203,12 @@ sudo /etc/init.d/stomp start
    sudo env RAILS_ENV=production /etc/init.d/git-daemon start
    sudo /etc/init.d/git-poller start

    sudo gem install --no-ri --no-rdoc passenger --version 3.0.11
    sudo gem install --no-ri --no-rdoc passenger --version 3.0.18
    sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module

    sudo cat > passenger.load << EOF
    LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.11
    sudo bash -c "cat > passenger.load" << EOF
    LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.18
    PassengerRuby /opt/ruby-enterprise/bin/ruby
    EOF

    @@ -218,7 +218,7 @@ sudo a2enmod rewrite
    sudo a2enmod deflate
    sudo a2enmod expires

    sudo cat > gitorious << EOF
    sudo bash -c "cat > gitorious" << EOF
    <VirtualHost *:80>
    <Directory /var/www/gitorious/public>
    Options FollowSymLinks
  24. Brian Moore revised this gist Dec 7, 2012. 1 changed file with 11 additions and 10 deletions.
    21 changes: 11 additions & 10 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -123,15 +123,16 @@ sudo mkdir /srv/git/repositories
    sudo mkdir /srv/git/tarballs
    sudo mkdir /srv/git/tarballs-work
    sudo chown -R git:gitorious /srv/git
    sudo chown -R git:gitorious /var/www/gitorious

    sudo su git -c "mkdir ~/.ssh"
    sudo su git -c "chmod 700 ~/.ssh"
    sudo su git -c "touch ~/.ssh/authorized_keys"

    sudo su git -c "touch .bashrc"
    sudo su git -c "echo 'export RUBY_HOME=/opt/ruby-enterprise' >> .bashrc"
    sudo su git -c "echo 'export GEM_HOME=\$RUBY_HOME/lib/ruby/gems/1.8/gems' >> .bashrc"
    sudo su git -c "echo 'export PATH=\$RUBY_HOME/bin:\$PATH' >> .bashrc"
    sudo su git -c "touch ~/.bashrc"
    sudo su git -c "echo 'export RUBY_HOME=/opt/ruby-enterprise' >> ~/.bashrc"
    sudo su git -c "echo 'export GEM_HOME=\$RUBY_HOME/lib/ruby/gems/1.8/gems' >> ~/.bashrc"
    sudo su git -c "echo 'export PATH=\$RUBY_HOME/bin:\$PATH' >> ~/.bashrc"

    cd /var/www/gitorious

    @@ -140,7 +141,7 @@ production:
    adapter: stomp
    EOF

    cat > config/database.yml << EOF
    sudo cat > config/database.yml << EOF
    production:
    adapter: mysql
    database: gitorious
    @@ -150,7 +151,7 @@ production:
    encoding: utf8
    EOF

    cat > config/gitorious.yml << EOF
    sudo cat > config/gitorious.yml << EOF
    production:
    cookie_secret: `< /dev/urandom tr -dc A-Za-z0-9 | head -c64`
    repository_base_path: "/srv/git/repositories"
    @@ -174,12 +175,12 @@ EOF

    RAILS_ENV=production rake _0.8.7_ db:migrate

    cat | RAILS_ENV=production script/create_admin << EOF
    sudo cat | RAILS_ENV=production script/create_admin << EOF
    $SYSADMIN_EMAIL
    $SYSADMIN_PASSWORD
    EOF

    cat | script/console production << EOF
    sudo cat | script/console production << EOF
    user = User.first
    user.login = "$SYSADMIN"
    user.activate
    @@ -205,7 +206,7 @@ sudo /etc/init.d/git-poller start
    sudo gem install --no-ri --no-rdoc passenger --version 3.0.11
    sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module

    cat > passenger.load << EOF
    sudo cat > passenger.load << EOF
    LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.11
    PassengerRuby /opt/ruby-enterprise/bin/ruby
    @@ -217,7 +218,7 @@ sudo a2enmod rewrite
    sudo a2enmod deflate
    sudo a2enmod expires

    cat > gitorious << EOF
    sudo cat > gitorious << EOF
    <VirtualHost *:80>
    <Directory /var/www/gitorious/public>
    Options FollowSymLinks
  25. @padcom padcom revised this gist Jul 5, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ruby-ee.patch
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    --- src/ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-02-19 15:09:11.000000000 +0100
    +++ src/ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-07-05 13:34:17.677491684 +0200
    --- ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-02-19 15:09:11.000000000 +0100
    +++ ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-07-05 13:34:17.677491684 +0200
    @@ -1669,5 +1669,5 @@
    MallocHook::InvokeNewHook(result, size);
    return result;
  26. @padcom padcom revised this gist Jul 5, 2012. 2 changed files with 11 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,8 @@ cd ~/src

    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz
    tar zxf ruby-enterprise-1.8.7-2012.02.tar.gz
    wget -c https://raw.github.com/gist/1122244/ruby-ee.patch
    patch -p0 < ruby-ee.patch
    sudo ruby-enterprise-1.8.7-2012.02/installer
    cd /opt
    sudo ln -s ruby-enterprise-1.8.7-2012.02/ ruby-enterprise
    9 changes: 9 additions & 0 deletions ruby-ee.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    --- src/ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-02-19 15:09:11.000000000 +0100
    +++ src/ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/tcmalloc.cc 2012-07-05 13:34:17.677491684 +0200
    @@ -1669,5 +1669,5 @@
    MallocHook::InvokeNewHook(result, size);
    return result;
    }
    -void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
    +void *(* volatile __memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
    #endif // #ifndef TCMALLOC_FOR_DEBUGALLOCATION
  27. @padcom padcom revised this gist Jul 5, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ MYSQL_ROOT_PASSWORD=password
    MYSQL_GITORIOUS_PASSWORD=password
    GITORIOUS_HOST=gitorious
    SYSADMIN=sysadmin
    SYSADMIN_EMAIL=[email protected]
    SYSADMIN_EMAIL=git@$GITORIOUS_HOST
    SYSADMIN_PASSWORD=password

    #------------------------------------------------------------------------------
  28. @padcom padcom revised this gist Jul 5, 2012. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -28,11 +28,11 @@ mkdir ~/src

    cd ~/src

    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.03.tar.gz
    tar zxf ruby-enterprise-1.8.7-2011.03.tar.gz
    sudo ruby-enterprise-1.8.7-2011.03/installer
    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz
    tar zxf ruby-enterprise-1.8.7-2012.02.tar.gz
    sudo ruby-enterprise-1.8.7-2012.02/installer
    cd /opt
    sudo ln -s ruby-enterprise-1.8.7-2011.03/ ruby-enterprise
    sudo ln -s ruby-enterprise-1.8.7-2012.02/ ruby-enterprise
    sudo ln -s /opt/ruby-enterprise/bin/ruby /opt/ruby-enterprise/bin/rake /opt/ruby-enterprise/bin/gem /usr/local/bin
    sudo ln -s /opt/ruby-enterprise/bin/irb /usr/bin/irb

  29. @padcom padcom revised this gist Jul 5, 2012. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -46,12 +46,12 @@ sudo ldconfig

    # MySQL

    echo "mysql-server-5.1 mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
    echo "mysql-server-5.1 mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
    echo "mysql-server-5.1 mysql-server/root_password seen true" | sudo debconf-set-selections
    echo "mysql-server-5.1 mysql-server/root_password_again seen true" | sudo debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password seen true" | sudo debconf-set-selections
    echo "mysql-server-5.5 mysql-server/root_password_again seen true" | sudo debconf-set-selections

    sudo apt-get install -y mysql-client-5.1 mysql-server-5.1 libmysqlclient-dev
    sudo apt-get install -y mysql-client-5.5 mysql-server-5.5 libmysqlclient-dev
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE gitorious"
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE USER 'gitorious'@'localhost' IDENTIFIED BY '$MYSQL_GITORIOUS_PASSWORD'"
    mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON gitorious.* TO 'gitorious'@'localhost'"
  30. @padcom padcom revised this gist Jul 5, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ mkdir ~/src

    cd ~/src

    wget http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.03.tar.gz
    wget -c http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.03.tar.gz
    tar zxf ruby-enterprise-1.8.7-2011.03.tar.gz
    sudo ruby-enterprise-1.8.7-2011.03/installer
    cd /opt
    @@ -59,7 +59,7 @@ mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON gitori
    # Sphinx

    cd ~/src
    wget http://sphinxsearch.com/files/sphinx-0.9.9.tar.gz
    wget -c http://sphinxsearch.com/files/sphinx-0.9.9.tar.gz
    tar zxf sphinx-0.9.9.tar.gz
    cd sphinx-0.9.9
    ./configure