[DRE-commits] [diaspora] 164/257: use environment variable to pass pod url

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Sun Apr 12 14:17:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository diaspora.

commit 417461cd7581442198d8ed93b36729dd40ca9c0b
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Fri Nov 28 02:21:07 2014 +0530

    use environment variable to pass pod url
---
 debian/config   | 11 +++++++++++
 debian/postinst | 28 +++++++++++++++++++---------
 2 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/debian/config b/debian/config
index 097210d..cb50717 100644
--- a/debian/config
+++ b/debian/config
@@ -19,3 +19,14 @@ fi
 # What is your pod address?
 db_input high diaspora/url || true
 db_go
+
+# Configure pod address.
+db_get diaspora/url
+if ! grep ENVIRONMENT_URL /etc/diaspora.conf >/dev/null
+	then echo export ENVIRONMENT_URL=$RET >> /etc/diaspora.conf
+fi
+
+if [ "$RET" = "false" ]; then
+    db_go
+fi
+
diff --git a/debian/postinst b/debian/postinst
index 973a81c..f688fa0 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -47,7 +47,7 @@ case "$1" in
 		then gem install backbone-on-rails
 	fi
 	
-	if ! gem list handlebars_asstes | grep handlebars_assets
+	if ! gem list handlebars_assets | grep handlebars_assets
 		then gem install handlebars_assets
 	fi
 	
@@ -66,18 +66,28 @@ case "$1" in
 	if ! gem list rails-assets-jquery-idletimer | grep rails-assets-jquery-idletimer
 		then gem install --source https://rails-assets.org rails-assets-jquery-idletimer
 	fi
+	if ! grep RAILS_ENV /etc/diaspora.conf
+		then echo export RAILS_ENV=production >> /etc/diaspora.conf
+	fi
 
+	if ! grep DB /etc/diaspora.conf 
+		then echo export DB=postgres >> /etc/diaspora.conf
+	fi
+	
+	# source diaspora variables	
+	. /etc/diaspora.conf
 	echo "Verifying we have all required libraries..."
-	sudo -u diaspora bundle install --local
+	sudo -u diaspora -E bundle install --local
 	echo "Initializing database..."
-	sudo -u diaspora RAILS_ENV=production DB=postgres bundle exec rake db:create db:schema:load
+	sudo -u diaspora -E bundle exec rake db:create db:schema:load
 	echo "Precompiling assets..."
-	sudo -u diaspora RAILS_ENV=production DB=postgres bundle exec rake assets:precompile
-	echo "Now start the service by running"
-	echo "# cd /usr/share/diaspora"
-	echo "# touch public/source.tar.gz"
-	echo "# sudo -u diaspora RAILS_ENV=production DB=postgres ./script/server"
-	echo "and visit your pod at http://localhost:3000"
+	sudo -u diaspora -E bundle exec rake assets:precompile
+	sudo -u diaspora  touch public/source.tar.gz
+	echo "Starting diaspora service..."
+	sudo -u diaspora -E nohup ./script/server &
+	echo "visit your pod at $ENVIRONMENT_URL"
+	echo "To stop diaspora, run # killall -9 unicorn_rails foreman sidekiq"
+	echo "To see the service status, run # tail -f /usr/share/diaspora/nohup.out"
    ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/diaspora.git



More information about the Pkg-ruby-extras-commits mailing list