#!/bin/bash # # Do what's needed to initiate diaspora. # # Usage: sudo diaspora-setup [external hostname] # test "$( perl -e 'print $<')" = "0" || { echo "You need to be root to do this, giving up" exit 2 } arg_hostname="$1" services=$( netstat -nl | grep '[^:]:3000[ \t]') test -n "$services" && { echo "Warning: something is already using port 3000" echo " $services" } service mongodb stop || : rm -f /var/lib/mongodb/mongod.lock service mongodb start || : cd /usr/share/diaspora/master test -e config/app_config.yml || cp config/app_config.yml.example config/app_config.yml sed -i '/socket_pidfile:/s|:.*|: /var/run/diaspora/diaspora-wsd.pid|' \ config/app_config.yml if rake db:seed:dev; then echo "Database config OK, new user tom/evankorth in place" else cat <<- EOF Database config failed. You might want to - Just remove the db lock file: rm /var/lib/mongodb/mongod.lock - Remove all db files: rm -rf /var/lib/mongodb/* - Reset the config file by cp config/app_config.yml.example config/app_config.yml Also, make sure the mongodb server is running e. g., using 'service mongod status'. EOF exit 1 fi chmod 777 /var/lib/diaspora/uploads chown -R diaspora /var/log/diaspora hostname=$( awk '/pod_url:/ { print $2; exit }'