Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b2d0825efd
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 82 lines (58 sloc) 1.88 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#!/bin/bash
#
# Do what's needed to initiate diaspora.
#
# Usage: sudo diaspora-setup [external hostname] [first user pw]
#
export PATH=$PATH:/usr/local/bin

arg_hostname="$1"
arg_pw="$2"

path=$( readlink -fn $0) && cd $(dirname $path)/../.. || \
    cd /usr/share/diaspora/master

test "$( perl -e 'print $<')" = "0" || {
    echo "You need to be root to do this, giving up"
    exit 2
}

. pkg/source/funcs.sh


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 || :

update-rc.d redis-server remove
/etc/init.d/redis-server stop

cd /usr/share/diaspora/master

libdir="/usr/lib"
[[ $(arch) == "x86_64" ]] && libdir="/usr/lib64"

rm -rf vendor
ln -s $libdir/diaspora-bundle/vendor .
ln -sf $libdir/diaspora-bundle/Gemfile .
ln -sf $libdir/diaspora-bundle/Gemfile.lock .

mkdir -p /var/run/diaspora
chown diaspora /var/run/diaspora

test -e config/app_config.yml ||
    cp config/app_config.yml.example config/app_config.yml

[ -e lib/tasks/jasmine.rake ] &&
    sudo mv lib/tasks/jasmine.rake lib/tasks/jasmine.no-rake

cp pkg/ubuntu/diaspora-daemon script

redis_config

init_appconfig config/app_config.yml $arg_hostname

init_db $arg_pw|| {
    cat <<- EOF
Database config failed. You might want to
- Check that mongod is running: service mongodb status
- Repair database files: mongod --repair
- Drop the diaspora mongo database:
% bundle exec rake db:purge
- Remove all db files: rm -rf /var/lib/mongodb/*
- Reset the config file by
'cp config/app_config.yml.example config/app_config.yml'
EOF
}

init_public

chown -R diaspora /var/log/diaspora


sed -i '/socket_pidfile:/s|:.*|: /var/run/diaspora/diaspora-wsd.pid|' \
    config/app_config.yml

Something went wrong with that request. Please try again.