Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ebb43c155d
Fetching contributors…

Cannot retrieve contributors at this time

71 lines (61 sloc) 3.189 kb
GITDIR="/usr/share/webapps/gitorious"
BUNDLE="/opt/ruby-enterprise/bin/bundle"
post_install() {
SECRET=$(dd if=/dev/random count=1 2>/dev/null | sha256sum | awk '{print $1}')
sed -i "s|CHANGEME_SECRET|$SECRET|" /etc/webapps/gitorious/gitorious.yml
echo "Creating git user"
useradd git -MUd "$GITDIR" -s /bin/bash > /dev/null 2>&1
echo "* * * * * cd \"$GITDIR\" && bin/rake ultrasphinx:index RAILS_ENV=production 1>/dev/null" | crontab - -u git
cd "$GITDIR" || return 1
mkdir -p tmp tarballs repositories pids site/tmp/pids .ssh site/data/hooks/pre site/data/hooks/post
touch .ssh/authorized_keys
chmod -R 700 script
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
chmod 744 site/data/hooks/pre site/data/hooks/post
chown -R git:git "$GITDIR"
echo "Configuring mysql & sphinx:"
echo -n " - Creating database gitorious: "
echo 'CREATE DATABASE gitorious; GRANT ALL ON gitorious.* TO gitorious@localhost IDENTIFIED BY "G170r!oUs";' | mysql > /dev/null 2>&1 && echo ok || echo FAIL
echo -n " - db:setup "
su - git -c "bin/rake db:setup RAILS_ENV=production" > /dev/null 2>&1 && echo ok || echo FAIL
echo -n " - ultrasphinx:configure "
su - git -c "bin/rake ultrasphinx:configure RAILS_ENV=production" > /dev/null 2>&1 && echo ok || echo FAIL
echo -n " - ultrasphinx:bootstrap "
su - git -c "bin/rake ultrasphinx:bootstrap RAILS_ENV=production" > /dev/null 2>&1 && echo ok || echo FAIL
echo -n " - ultrasphinx:spelling:build "
cd $GITDIR && bin/rake ultrasphinx:spelling:build RAILS_ENV=production > /dev/null 2>&1 && echo ok || echo FAIL
echo "DONE."
echo
echo "If mysql was not running during install (or any of the previous steps failed)"
echo "you will need to create the database and run rake manually."
echo "# echo 'CREATE DATABASE gitorious; GRANT ALL ON gitorious.* TO gitorious@localhost IDENTIFIED BY \"G170r!oUs\";' | mysql"
echo "# su - git -c \"bin/rake db:setup RAILS_ENV=production\""
echo "# su - git -c \"bin/rake ultrasphinx:configure RAILS_ENV=production\""
echo "# su - git -c \"bin/rake ultrasphinx:bootstrap RAILS_ENV=production\""
echo "# cd $GITDIR && bin/rake ultrasphinx:spelling:build RAILS_ENV=production"
echo
echo "To create the admin user, issue the following command"
echo "# su - git -c \"env RAILS_ENV=production $BUNDLE exec script/create_admin\""
echo
echo "Gitorious is a ruby application and depends on the following daemons that must be running:"
echo "# /etc/rc.d/stompserver start"
echo "# /etc/rc.d/gitorious-daemon start"
echo "# /etc/rc.d/gitorious-poller start"
echo "# /etc/rc.d/gitorious-ultrasphinx start"
echo
echo "To run the application itself you can issue the following command:"
echo "# su - git -c \"$BUNDLE exec script/server -e production\""
echo "and visit http://localhost.localdomain:3000"
echo "or deploy it like any other ruby application (Ex: apache+passenger)"
}
post_upgrade() {
chown -R git:git "$GITDIR"
echo "The database may need to be migrated to reflect the latest changes in the application"
echo "To migrate run the following command:"
echo "# su - git -c \"bin/rake db:migrate RAILS_ENV=production\""
}
post_remove() {
userdel git
rm -f /var/spool/cron/git
}
Jump to Line
Something went wrong with that request. Please try again.