From 674fbc050be44d792266232b3be147ac12cf9c4d Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 11 Oct 2010 16:01:16 -0700 Subject: [PATCH 01/16] Some readme modifications --- README.md | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 40447939b..8cde335d4 100644 --- a/README.md +++ b/README.md @@ -3,37 +3,36 @@ The privacy aware, personally controlled, do-it-all, open source social network. -**DISCLAIMER: THIS IS PRE-ALPHA SOFTWARE AND SHOULD BE TREATED ACCORDINGLY.** +**THIS IS PRE-ALPHA SOFTWARE AND SHOULD BE TREATED ACCORDINGLY.** **PLEASE, DO NOT RUN IN PRODUCTION. IT IS FUN TO GET RUNNING, BUT EXPECT THINGS TO BE BROKEN** -Initial installation instructions are [here](http://github.com/diaspora/diaspora/wiki/Installing-and-Running-Diaspora). +### Installation instructions are [here](http://github.com/diaspora/diaspora/wiki/Installing-and-Running-Diaspora). -We are continuing to build features and improve the code base. -When we think it is ready for general use, we will post more final -instructions. Issue tracking is at [bugs.joindiaspora.com](bugs.joindiaspora.com). +### Please report any bugs you see. Issue tracking is at [bugs.joindiaspora.com](http://bugs.joindiaspora.com). -## Commit Guidelines +## Contributing to Diaspora -You are welcome to contribute, add to and extend Diaspora however you see fit. We -will do our best to incorporate everything that meets our guidelines. +You can find an introduction to the source code [here](http://github.com/diaspora/diaspora/wiki/An-Introduction-to-the-Diaspora-Source). +Bugs and pending features are on our [issue tracker](http://bugs.joindiaspora.com). Here are a few good places to start: +- Run "rake spec" to run our [Rspec](http://blog.davidchelimsky.net/2007/05/14/an-introduction-to-rspec-part-i/) +unit test suite. Take a look at the pending specs, make one pass! +- Run "rake cucumber" to run our [Cucumber](http://rubylearning.com/blog/2010/10/05/outside-in-development/) +integration test suite. As you can see, we need more integration tests. Pick a feature and write one! +- Take a look at the [issue tracker](http://bugs.joindiaspora.com) and pick a bug. +Write a spec for it, so it's easy for another developer to fix it. -You can find an introduction to the source code [here](http://github.com/diaspora/diaspora/wiki/An-Introduction-to-the-Diaspora-Source). For an idea of where to start, look at our [issue tracker](bugs.joindiaspora.com). +Patches must be tested, and all your tests should be green, +unless you're marking an existing bug, before a pull request is sent. +Unit tests should be in Rspec, and integration tests should be in Cucumber. -Make a topic branch. By making your changes in a topic branch, you ensure that new commits to your master are not included in the pull request, and it's easier for us to merge your commits. +Please make your changes in a branch to ensure that new commits to your master are +not included in the pull request, and to make it easier for us to merge your commits. Please do not rebase our tree into yours. See [here](http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html) for when to rebase. -Patches must be tested, and all your tests should be green -before a pull request is sent. Please write your tests in Rspec. - -GEMS: We would like to keep external dependencies unduplicated. We're using -Nokogiri, Mongomapper, and EM::HttpRequest as much as possible. We have a few -gems in the project we'd rather not use, but if you can, use dependencies we -already have. - We need you to fill out a [contributor agreement form](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq) before we can accept your patches. The agreement gives Diaspora joint From be8b16c5cbd12433a56557b9607e7daf20fddddf Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 11 Oct 2010 16:32:28 -0700 Subject: [PATCH 02/16] ### looks bad --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8cde335d4..4b0157f93 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ network. **PLEASE, DO NOT RUN IN PRODUCTION. IT IS FUN TO GET RUNNING, BUT EXPECT THINGS TO BE BROKEN** -### Installation instructions are [here](http://github.com/diaspora/diaspora/wiki/Installing-and-Running-Diaspora). +Installation instructions are [here](http://github.com/diaspora/diaspora/wiki/Installing-and-Running-Diaspora). -### Please report any bugs you see. Issue tracking is at [bugs.joindiaspora.com](http://bugs.joindiaspora.com). +Please report any bugs you see. Issue tracking is at [bugs.joindiaspora.com](http://bugs.joindiaspora.com). ## Contributing to Diaspora From a372ec33be00e5937c616ce0a5078bf315aa3dc8 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 11 Oct 2010 16:36:34 -0700 Subject: [PATCH 03/16] fixing uninitialized constant in rake task --- lib/tasks/db.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 0b82b26a3..142b8323d 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -67,6 +67,7 @@ namespace :db do end task :move_private_key do + require File.dirname(__FILE__) + '/../../config/environment' User.all.each do |user| if user.private_key.nil? user.private_key = user.person.serialized_key From c8f864a69ba2fec18a972077faf070e31a289eb6 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 11 Oct 2010 17:22:53 -0700 Subject: [PATCH 04/16] Finish fixing move_private_key --- lib/tasks/db.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 142b8323d..a71ca72f0 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -69,12 +69,12 @@ namespace :db do task :move_private_key do require File.dirname(__FILE__) + '/../../config/environment' User.all.each do |user| - if user.private_key.nil? - user.private_key = user.person.serialized_key + if user.serialized_private_key.nil? + user.serialized_private_key = user.person.serialized_key user.save person = user.person person.serialized_key = nil - person.serialized_public_key = user.encryption_key.public_key + person.serialized_public_key = user.encryption_key.public_key.to_s person.save end end From b370f4c56089d579237c73adcc5de3a02f1619e5 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 11 Oct 2010 18:41:09 -0700 Subject: [PATCH 05/16] adjust readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 4b0157f93..4f6723507 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,13 @@ Please report any bugs you see. Issue tracking is at [bugs.joindiaspora.com](ht You can find an introduction to the source code [here](http://github.com/diaspora/diaspora/wiki/An-Introduction-to-the-Diaspora-Source). Bugs and pending features are on our [issue tracker](http://bugs.joindiaspora.com). Here are a few good places to start: + - Run "rake spec" to run our [Rspec](http://blog.davidchelimsky.net/2007/05/14/an-introduction-to-rspec-part-i/) unit test suite. Take a look at the pending specs, make one pass! + - Run "rake cucumber" to run our [Cucumber](http://rubylearning.com/blog/2010/10/05/outside-in-development/) integration test suite. As you can see, we need more integration tests. Pick a feature and write one! + - Take a look at the [issue tracker](http://bugs.joindiaspora.com) and pick a bug. Write a spec for it, so it's easy for another developer to fix it. From 2d57b5dc9a52d05d44d8f8d7cacb9caf43027c4b Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Mon, 11 Oct 2010 22:24:48 -0700 Subject: [PATCH 06/16] bash script to run specs against multiple versions of Ruby on CI --- ci.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 ci.sh diff --git a/ci.sh b/ci.sh new file mode 100644 index 000000000..63bab3bcf --- /dev/null +++ b/ci.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +echo "*************************************************************************************************" && +echo "* ruby 1.8.7-p249 build *" && +echo "*************************************************************************************************" && +echo "" && +source /usr/local/rvm/scripts/rvm && rvm use ruby-1.8.7-p249 && bundle install && bundle exec rake ci && +echo "" && +echo "*************************************************************************************************" && +echo "* ruby 1.9.2-p0 build *" && +echo "*************************************************************************************************" && +echo "" && +source /usr/local/rvm/scripts/rvm && rvm use ruby-1.9.2-p0 && bundle install && bundle exec rake ci \ No newline at end of file From e3e76ec3e0f1d2d9cf45c14a962f94d153b7f93b Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Mon, 11 Oct 2010 22:33:44 -0700 Subject: [PATCH 07/16] correct permissions on bash script for CI --- ci.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 ci.sh diff --git a/ci.sh b/ci.sh old mode 100644 new mode 100755 From 546401cbecb81bd151a2f874833b717c3b4d6ef0 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Mon, 11 Oct 2010 22:37:58 -0700 Subject: [PATCH 08/16] Gemfile.lock is different in 1.9.2, so we need to remove it after running specs so the next pull succeeds. --- ci.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ci.sh b/ci.sh index 63bab3bcf..e631517e1 100755 --- a/ci.sh +++ b/ci.sh @@ -4,10 +4,17 @@ echo "************************************************************************** echo "* ruby 1.8.7-p249 build *" && echo "*************************************************************************************************" && echo "" && -source /usr/local/rvm/scripts/rvm && rvm use ruby-1.8.7-p249 && bundle install && bundle exec rake ci && +source /usr/local/rvm/scripts/rvm && +rvm use ruby-1.8.7-p249 && +bundle install && +bundle exec rake ci && echo "" && echo "*************************************************************************************************" && echo "* ruby 1.9.2-p0 build *" && echo "*************************************************************************************************" && echo "" && -source /usr/local/rvm/scripts/rvm && rvm use ruby-1.9.2-p0 && bundle install && bundle exec rake ci \ No newline at end of file +source /usr/local/rvm/scripts/rvm && +rvm use ruby-1.9.2-p0 && +bundle install && +bundle exec rake ci && +rm Gemfile.lock \ No newline at end of file From 19b5fb0b84aac9513a5d83b00bdc1fa8d222ad36 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 12 Oct 2010 10:55:19 -0700 Subject: [PATCH 09/16] Delete instead of destroy to simulate a remote user --- spec/models/user/receive_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/user/receive_spec.rb b/spec/models/user/receive_spec.rb index 027645e39..581fd7d4d 100644 --- a/spec/models/user/receive_spec.rb +++ b/spec/models/user/receive_spec.rb @@ -81,7 +81,7 @@ describe User do user.raw_visible_posts.count.should == 1 person = user2.person - user2.destroy + user2.delete user.unfriend(person) user.reload From 6177362c4a2f832cedda95e574872ebabd2fe0d6 Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Tue, 12 Oct 2010 21:22:49 +0200 Subject: [PATCH 10/16] Adding the ubuntu install package, initial version. T --- .gitignore | 1 + pkg/fedora/diaspora.spec | 35 ++++++++++ pkg/fedora/make-dist.sh | 13 ++-- pkg/ubuntu/README.md | 57 ++++++++++++++++ pkg/ubuntu/add-bundle.diff | 11 ++++ pkg/ubuntu/diaspora-bundle-install | 26 ++++++++ pkg/ubuntu/diaspora-install | 68 +++++++++++++++++++ pkg/ubuntu/diaspora-install-deps | 14 ++++ pkg/ubuntu/diaspora-reset | 12 ++++ pkg/ubuntu/diaspora-setup | 53 +++++++++++++++ pkg/ubuntu/diaspora-wsd | 102 +++++++++++++++++++++++++++++ pkg/ubuntu/diaspora.logrotate | 13 ++++ pkg/ubuntu/make-dist.sh | 1 + 13 files changed, 400 insertions(+), 6 deletions(-) create mode 100644 pkg/ubuntu/README.md create mode 100644 pkg/ubuntu/add-bundle.diff create mode 100755 pkg/ubuntu/diaspora-bundle-install create mode 100755 pkg/ubuntu/diaspora-install create mode 100755 pkg/ubuntu/diaspora-install-deps create mode 100755 pkg/ubuntu/diaspora-reset create mode 100755 pkg/ubuntu/diaspora-setup create mode 100755 pkg/ubuntu/diaspora-wsd create mode 100644 pkg/ubuntu/diaspora.logrotate create mode 120000 pkg/ubuntu/make-dist.sh diff --git a/.gitignore b/.gitignore index 67221f5e4..8482dc230 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ nbproject gpg/diaspora-development/*.gpg gpg/diaspora-production/*.gpg gpg/*/random_seed +patches-* public/uploads/* public/source.tar tmp/**/* diff --git a/pkg/fedora/diaspora.spec b/pkg/fedora/diaspora.spec index 0d07ddb43..ba2456a43 100644 --- a/pkg/fedora/diaspora.spec +++ b/pkg/fedora/diaspora.spec @@ -34,6 +34,10 @@ find . -perm /u+x -type f -exec \ %build rm -rf master/vendor/bundle +<<<<<<< HEAD +mkdir master/tmp || : +======= +>>>>>>> upstream/master %install rm -fr $RPM_BUILD_ROOT @@ -55,7 +59,14 @@ cp %SOURCE3 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/diaspora mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora +<<<<<<< HEAD +cp -ar master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master +cp diaspora-setup $RPM_BUILD_ROOT/%{_datadir}/diaspora +mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads +mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp +======= cp %SOURCE2 $RPM_BUILD_ROOT/%{_datadir}/diaspora +>>>>>>> upstream/master mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads @@ -80,8 +91,25 @@ sed -i -e '\|.*/master/config.ru"$|d' \ %post +<<<<<<< HEAD +rm -f %{_datadir}/diaspora/master/vendor/bundle +rm -f %{_datadir}/diaspora/master/log +rm -f %{_datadir}/diaspora/master/public/uploads +rm -rf %{_datadir}/diaspora/master/tmp + +ln -s %{_localstatedir}/log/diaspora \ + %{_datadir}/diaspora/master/log || : +ln -s %{_libdir}/diaspora-bundle/master/vendor/bundle \ + %{_datadir}/diaspora/master/vendor || : +ln -s %{_localstatedir}/lib/diaspora/uploads \ + %{_datadir}/diaspora/master/public/uploads || : +ln -s %{_localstatedir}/lib/diaspora/tmp \ + %{_datadir}/diaspora/master/tmp || : +/sbin/chkconfig --add diaspora-ws || : +======= /sbin/chkconfig --add diaspora-wsd +>>>>>>> upstream/master %preun if [ $1 -eq 0 ] ; then @@ -96,15 +124,22 @@ rm -fr $RPM_BUILD_ROOT %files -f files %defattr(-, root, root, 0755) +<<<<<<< HEAD +%doc README.md GNU-AGPL-3.0 +======= %doc AUTHORS README.md GNU-AGPL-3.0 COPYRIGHT README-Fedora.md +>>>>>>> upstream/master %attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config.ru %attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config/environment.rb %attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora %attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/uploads %attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/tmp +<<<<<<< HEAD +======= %{_datadir}/diaspora/master/tmp %{_datadir}/diaspora/master/public/uploads %{_datadir}/diaspora/master/log +>>>>>>> upstream/master %config(noreplace) %{_sysconfdir}/logrotate.d/diaspora %{_sysconfdir}/init.d/diaspora-wsd diff --git a/pkg/fedora/make-dist.sh b/pkg/fedora/make-dist.sh index 3a24635ed..2ab4ccac5 100755 --- a/pkg/fedora/make-dist.sh +++ b/pkg/fedora/make-dist.sh @@ -126,8 +126,7 @@ function checkout() git clone --quiet $GIT_REPO; ( cd diaspora; - git remote add upstream \ - git://github.com/diaspora/diaspora.git + git remote add upstream $GIT_REPO for p in ../../*.patch; do git apply --whitespace=fix $p > /dev/null done &> /dev/null || : @@ -159,7 +158,6 @@ function make_src cd dist mkdir ${RELEASE_DIR}/master cp -ar diaspora/* diaspora/.git* ${RELEASE_DIR}/master - mv ${RELEASE_DIR}/master/diaspora.spec ${RELEASE_DIR} ( cd ${RELEASE_DIR}/master git show --name-only > config/gitversion @@ -168,6 +166,9 @@ function make_src find $PWD -name .git\* | xargs rm -rf rm -rf .bundle /usr/bin/patch -p1 -s <../../../add-bundle.diff + for p in ../../../*.patch; do + /usr/bin/patch -p1 -s < $p + done &> /dev/null || : ) tar czf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR} && \ rm -rf ${RELEASE_DIR} @@ -203,7 +204,8 @@ function make_bundle() cd .. } echo - echo "Bundle: dist/$bundle_name.tar.gz" + echo "Repo: $GIT_REPO" + echo "Bundle: dist/$bundle_name.tar.gz" } @@ -278,9 +280,8 @@ function usage() EOF } - commit='HEAD' -while getopts ":r:c:h" opt +while getopts ":r:c:u:h" opt do case $opt in u) GIT_REPO="$OPTARG" diff --git a/pkg/ubuntu/README.md b/pkg/ubuntu/README.md new file mode 100644 index 000000000..3aeaaab01 --- /dev/null +++ b/pkg/ubuntu/README.md @@ -0,0 +1,57 @@ +## Package-oriented install for ubuntu. + +Here are some scripts to install diaspora on Ubuntu. They are designed to +work as a first step towards packaging, but should be usable as is. + +### Synopsis + +Bootstrap the distribution from git: + git clone git://github.com/diaspora/diaspora.git + cd diaspora/pkg/ubuntu + +Install the dependencies (a good time for a coffe break) + ./diaspora-install-deps + +Create and install the diaspora bundle and application: + ./make-dist.sh bundle + sudo ./diaspora-bundle-install dist/diaspora-bundle-*.tar.gz + + ./make-dist.sh source + sudo ./diaspora-install dist/diaspora-0.0*.tar.gz + +Initiate and start the server; + sudo ./diaspora-setup + sudo su - diaspora + cd /usr/share/diaspora/master + ./script/server + +### Notes + +The application lives in /usr/share/diaspora/master. All writable areas +(log, uploads, tmp) are links to /var/lib/diaspora. The config file lives +in /etc/diaspora. All files in /usr/share are read-only, owned by root. + +The bundle lives in /usr/lib/diaspora-bundle, readonly,owned by root. +Application finds it through the patched .bundle/config in root dir. + +The user diaspora is added during install. + +The 'make-dist-source' prints a message about the version of the bundle +it needs. Normally, it doesn't change and it's a fast procedure to generate +and install the source tarball. Generating the bundle takes some time, though. + +make-dist.sh accepts arguments to get a specified commit and/or use another +repo. + +This has been tested on a Ubuntu 32-bit 10.10 , clean server. Since this +is a very small dist, the dependencies should possibly be complete. + +The diaspora-wsd is just placeholder FTM, it does **not** work. + +Please, report any problems! + + + + + + diff --git a/pkg/ubuntu/add-bundle.diff b/pkg/ubuntu/add-bundle.diff new file mode 100644 index 000000000..24c0f6035 --- /dev/null +++ b/pkg/ubuntu/add-bundle.diff @@ -0,0 +1,11 @@ +diff --git a/.bundle/config b/.bundle/config +new file mode 100644 +index 0000000..1c3e2ce +--- /dev/null ++++ b/.bundle/config +@@ -0,0 +1,5 @@ ++--- ++BUNDLE_FROZEN: "1" ++BUNDLE_DISABLE_SHARED_GEMS: "1" ++BUNDLE_WITHOUT: test:rdoc ++BUNDLE_PATH: vendor/bundle diff --git a/pkg/ubuntu/diaspora-bundle-install b/pkg/ubuntu/diaspora-bundle-install new file mode 100755 index 000000000..caf95d4e8 --- /dev/null +++ b/pkg/ubuntu/diaspora-bundle-install @@ -0,0 +1,26 @@ +#!/bin/sh + +test "$(perl -e 'print $>')" = "0" || { + echo "You need to be root to do this, giving up" + exit 2 +} + +test $# = "1" || { + echo "Usage: diaspora-bundle-install " + exit 1 +} + +test -r "$1" || { + echo "Cannot open $1" + exit 2 +} + +rm -rf /usr/lib/diaspora-bundle +tar xf $1 -C /usr/lib + +cd /usr/lib +mv $(basename $1 .tar.gz) diaspora-bundle +mkdir -p /usr/share/doc/diaspora-bundle || : +cd /usr/lib/diaspora-bundle + +cp AUTHORS GNU-AGPL-3.0 COPYRIGHT /usr/share/doc/diaspora-bundle diff --git a/pkg/ubuntu/diaspora-install b/pkg/ubuntu/diaspora-install new file mode 100755 index 000000000..53d09acc6 --- /dev/null +++ b/pkg/ubuntu/diaspora-install @@ -0,0 +1,68 @@ +#!/bin/bash +# +# Install a fedora source package +# +# Usage diaspora-install + +test "$(perl -e 'print $>')" = "0" || { + echo "You need to be root to do this, giving up" + exit 2 +} + +set -x + +getent group diaspora >/dev/null || groupadd -r diaspora +getent passwd diaspora >/dev/null || \ + useradd -r -g diaspora \ + -md /var/lib/diaspora \ + -s /bin/bash \ + -c "Diaspora daemon" diaspora + +sudo tar -C /usr/share -xzf $1 + +cd /usr/share; +rm -rf /usr/share/diaspora +mv $( basename $1 .tar.gz) diaspora +cd /usr/share/diaspora +find . -perm /u+x -type f -exec \ + sed -i 's|^#!/usr/local/bin/ruby|#!/usr/bin/ruby|' {} \; > /dev/null +rm -rf master/vendor/bundle master/public/uploads master/tmp master/log +sed -i '/BUNDLE_PATH/s|:.*|: /usr/lib/diaspora-bundle/bundle|' \ + master/.bundle/config + +cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS . +cp master/config/app_config.yml.example ./app_config.yml +cp master/pkg/ubuntu/diaspora-wsd /etc/init.d + +sed -i '/^cd /s|.*|cd /usr/share/diaspora/master|' /etc/init.d/diaspora-wsd + +cp master/pkg/ubuntu/diaspora.logrotate /etc/logrotate.d/diaspora + +cp master/pkg/ubuntu/diaspora-setup . + +mkdir -p /var/log/diaspora +mkdir -p /var/lib/diaspora/uploads +mkdir -p /var/lib/diaspora/tmp +mkdir -p /etc/diaspora + +ln -sf /var/log/diaspora ./master/log +cp master/config/app_config.yml.example /etc/diaspora/app_config.yml +ln -sf /etc/diaspora/app_config.yml master/config/app_config.yml +ln -sf /var/lib/diaspora/uploads master/public/ +ln -sf /var/lib/diaspora/tmp master +ln -sf /usr/lib/diaspora-bundle/bundle master/vendor + +rm -rf /usr/share/doc/diaspora +mkdir -p /usr/share/doc/diaspora +mv AUTHORS README.md GNU-AGPL-3.0 COPYRIGHT /usr/share/doc/diaspora + +find ./ -print | xargs chown root:root +rm -rf /usr/share/doc/diaspora +mkdir /usr/share/doc/diaspora + +chown diaspora:diaspora /usr/share/diaspora/master/config.ru +chown diaspora:diaspora /usr/share/diaspora/master/config/environment.rb +chown diaspora:diaspora /var/log/diaspora +chown diaspora:diaspora /var/lib/diaspora/uploads +chown diaspora:diaspora /var/lib/diaspora/tmp +chown diaspora:diaspora /var/lib/diaspora diff --git a/pkg/ubuntu/diaspora-install-deps b/pkg/ubuntu/diaspora-install-deps new file mode 100755 index 000000000..b919370d0 --- /dev/null +++ b/pkg/ubuntu/diaspora-install-deps @@ -0,0 +1,14 @@ +#!/bin/bash +# +# Install diaspora dependencies i. e., what apt-get will do +# +set -x + +sudo apt-get update +sudo apt-get install -qy build-essential libxslt1-dev libxml2 ruby-full mongodb \ +rake python-software-properties git imagemagick libmagick9-dev +[starts mongodb] +sudo add-apt-repository ppa:maco.m/ruby +sudo apt-get update +sudo apt-get install -qy rubygems +sudo gem install bundler --bindir /usr/local/bin diff --git a/pkg/ubuntu/diaspora-reset b/pkg/ubuntu/diaspora-reset new file mode 100755 index 000000000..a5919a635 --- /dev/null +++ b/pkg/ubuntu/diaspora-reset @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Try to revert to pristine state, deleting all users and +# configuration +# + +set -x +service mongodb stop +rm -rf /var/lib/mongodb/* +cp /usr/share/diaspora/master/config/app_config.yml.example \ + /usr/share/diaspora/master/config/app_config.yml +service mongodb start diff --git a/pkg/ubuntu/diaspora-setup b/pkg/ubuntu/diaspora-setup new file mode 100755 index 000000000..56940491f --- /dev/null +++ b/pkg/ubuntu/diaspora-setup @@ -0,0 +1,53 @@ +#!/bin/bash +# +# Do what's needed to initiate diaspora. +# + +test "$( perl -e 'print $<')" = "0" || { + echo "You need to be root to do this, giving up" + exit 2 +} + +services=$( netstat -nl | grep '[^:]:3000[ \t]') +test -n "$services" && { + echo "Warning: something is already using port 3000" + echo " $services" +} + +/usr/sbin/service mongodb start || : + +cd /usr/share/diaspora/master + +test -e config/app_config.yml || + cp config/app_config.yml.example 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 remove all db files with + 'rm -rf /var/lib/mongodb/*' and/or resetting the config file by + 'cp config/app_config.yml.example config/app_config.yml' before + making a new try. Also, make sure the mongodb server is running + e. g., using '/sbin/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 }' >$logfile 2>&1 &" + RETVAL=$? + echo + if test $RETVAL = 0; then + touch $lockfile + pgrep -f "$ruby_cmd" > $pidfile || { + echo "Warning: cannot find running diaspora-webserver" + exit 7 + } + fi +} + +stop() { + [ $UID -eq 0 ] || exit 4 + echo -n $"Stopping $prog: " + killproc -p $pidfile $exec + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f $lockfile + echo +} + +# +# See how we were called. +# +case "$1" in + start) + start + ;; + stop) + stop + ;; + force-reload|restart) + stop + sleep 1 + start + RETVAL=$? + ;; + condrestart|try-restart) + if [ -f $lockfile ]; then + stop + sleep 3 + start + fi + ;; + status) + status -p $pidfile $exec + RETVAL=$? + ;; + *) + echo $"Usage: $0 {condrestart|try-restart|start|stop|restart|force-reload|status}" + RETVAL=2 + [ "$1" = 'usage' ] && RETVAL=0 +esac + +exit $RETVAL diff --git a/pkg/ubuntu/diaspora.logrotate b/pkg/ubuntu/diaspora.logrotate new file mode 100644 index 000000000..28f158d2c --- /dev/null +++ b/pkg/ubuntu/diaspora.logrotate @@ -0,0 +1,13 @@ +/var/log/diaspora/*.log { + create 755 diaspora diaspora + weekly + rotate 10 + copytruncate + delaycompress + compress + notifempty + missingok + postrotate + ( /sbin/service diaspora-wsd condrestart ) >/dev/null 2>&1 + endscript +} diff --git a/pkg/ubuntu/make-dist.sh b/pkg/ubuntu/make-dist.sh new file mode 120000 index 000000000..f6ba9c6a2 --- /dev/null +++ b/pkg/ubuntu/make-dist.sh @@ -0,0 +1 @@ +../fedora/make-dist.sh \ No newline at end of file From 5bc174da151e9ba764f3136ebf641b93cd891e91 Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Tue, 12 Oct 2010 21:24:21 +0200 Subject: [PATCH 11/16] Well, another gitignore ;) --- pkg/ubuntu/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pkg/ubuntu/.gitignore diff --git a/pkg/ubuntu/.gitignore b/pkg/ubuntu/.gitignore new file mode 100644 index 000000000..cb1bf7741 --- /dev/null +++ b/pkg/ubuntu/.gitignore @@ -0,0 +1,3 @@ +patches-* +dist +series From fac76296106134ba546ddc9bbb63a2120b98f7e3 Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Tue, 12 Oct 2010 23:10:08 +0200 Subject: [PATCH 12/16] Minor bugfixes, discovered after checking in ubuntu stuff. --- pkg/ubuntu/README.md | 35 +++++++++++++++++++++++++++++------ pkg/ubuntu/diaspora-install | 3 +++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/pkg/ubuntu/README.md b/pkg/ubuntu/README.md index 3aeaaab01..3dd722626 100644 --- a/pkg/ubuntu/README.md +++ b/pkg/ubuntu/README.md @@ -1,11 +1,12 @@ ## Package-oriented install for ubuntu. -Here are some scripts to install diaspora on Ubuntu. They are designed to +Here are somediaspora-installdiaspora-install scripts to install diaspora on Ubuntu. They are designed to work as a first step towards packaging, but should be usable as is. ### Synopsis Bootstrap the distribution from git: + sudo apt-get install git git clone git://github.com/diaspora/diaspora.git cd diaspora/pkg/ubuntu @@ -25,20 +26,42 @@ Initiate and start the server; cd /usr/share/diaspora/master ./script/server +### Upgrading +Once diaspora ins installed ,makedist.sh et. al. are available in +/usr/share/diaspora/master/pkg/ubuntu, so there's no need to checkout +the stuff using git in this case. + +The normal procedure to update is to just + $ sudo su - diaspora + $ cd /usr/share/diaspora/master/pkg/ubuntu + $ ./make-dist.sh bundle + $ ./make-dist.sh source + +And then use diaspore-install and diaspora-install-bundle as above. + +It's necessary to always have the correct bundle. The easy way is to just + $ ./make-dist.sh bundle + + Repo: http://github.com/diaspora/diaspora.git + Bundle: dist/diaspora-bundle-0.0-1010111342_afad554.tar.gz + +The command will return the last built bundle (which is cached) if it's +OK to use. If it's not, it will build a new. + ### Notes The application lives in /usr/share/diaspora/master. All writable areas (log, uploads, tmp) are links to /var/lib/diaspora. The config file lives in /etc/diaspora. All files in /usr/share are read-only, owned by root. -The bundle lives in /usr/lib/diaspora-bundle, readonly,owned by root. +The bundle lives in /usr/lib/diaspora-bundle, readonly, owned by root. Application finds it through the patched .bundle/config in root dir. -The user diaspora is added during install. +Once diaspora ins installed ,makedist.sh et. al. are available in +/usr/share/diaspora/master/pkg/ubuntu, so there's no need to checkout +the stuff using git in this case. -The 'make-dist-source' prints a message about the version of the bundle -it needs. Normally, it doesn't change and it's a fast procedure to generate -and install the source tarball. Generating the bundle takes some time, though. +The user diaspora is added during install. make-dist.sh accepts arguments to get a specified commit and/or use another repo. diff --git a/pkg/ubuntu/diaspora-install b/pkg/ubuntu/diaspora-install index 53d09acc6..8717f8d56 100755 --- a/pkg/ubuntu/diaspora-install +++ b/pkg/ubuntu/diaspora-install @@ -44,6 +44,7 @@ mkdir -p /var/log/diaspora mkdir -p /var/lib/diaspora/uploads mkdir -p /var/lib/diaspora/tmp mkdir -p /etc/diaspora +mkdir -p /usr/share/diaspora/master/pkg/ubuntu/dist ln -sf /var/log/diaspora ./master/log cp master/config/app_config.yml.example /etc/diaspora/app_config.yml @@ -66,3 +67,5 @@ chown diaspora:diaspora /var/log/diaspora chown diaspora:diaspora /var/lib/diaspora/uploads chown diaspora:diaspora /var/lib/diaspora/tmp chown diaspora:diaspora /var/lib/diaspora +chown diaspora:diaspora /usr/share/diaspora/master/pkg/ubuntu/dist + From 00bcfaf34519ffe361af956b861b251360e8496a Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Tue, 12 Oct 2010 23:10:29 +0200 Subject: [PATCH 13/16] Check for universe enabled in diaspora-install-deps --- pkg/ubuntu/diaspora-install-deps | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/ubuntu/diaspora-install-deps b/pkg/ubuntu/diaspora-install-deps index b919370d0..56caa7200 100755 --- a/pkg/ubuntu/diaspora-install-deps +++ b/pkg/ubuntu/diaspora-install-deps @@ -2,12 +2,19 @@ # # Install diaspora dependencies i. e., what apt-get will do # -set -x + +grep -v '^#' /etc/apt/sources.list | grep -q universe || { + cat <<- EOF + "Warning: it looks like you have not enabled universe in your + /etc/apt/sources.list. Most likely, this means trouble. + But I will try anyway. + EOF + sleep 2 +} sudo apt-get update sudo apt-get install -qy build-essential libxslt1-dev libxml2 ruby-full mongodb \ -rake python-software-properties git imagemagick libmagick9-dev -[starts mongodb] + rake python-software-properties git imagemagick libmagick9-dev sudo add-apt-repository ppa:maco.m/ruby sudo apt-get update sudo apt-get install -qy rubygems From ca571432c2b9abe9688e283308cefabda245ac04 Mon Sep 17 00:00:00 2001 From: Shawn McGuire Date: Tue, 12 Oct 2010 12:20:22 -0700 Subject: [PATCH 14/16] Changed remaining http:// to git:// --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 0e74b4f45..63a350ef8 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'devise', '1.1.3' gem 'devise-mongo_mapper', :git => 'git://github.com/collectiveidea/devise-mongo_mapper' gem 'devise_invitable', '~> 0.3.4' #Mongo -gem 'mongo_mapper', :branch => 'rails3', :git => 'http://github.com/jnunemaker/mongomapper.git' +gem 'mongo_mapper', :branch => 'rails3', :git => 'git://github.com/jnunemaker/mongomapper.git' gem 'bson_ext', '1.1' gem 'bson', '1.1' @@ -32,7 +32,7 @@ gem 'thin' #Websocket gem 'em-websocket' -gem 'magent', :git => 'http://github.com/dcu/magent.git' +gem 'magent', :git => 'git://github.com/dcu/magent.git' #File uploading gem 'carrierwave', :git => 'git://github.com/rsofaer/carrierwave.git' , :branch => 'master' #Untested mongomapper branch From b5485205916eb61a6c45c5b65909d553d7a04a91 Mon Sep 17 00:00:00 2001 From: Shawn McGuire Date: Tue, 12 Oct 2010 16:40:10 -0500 Subject: [PATCH 15/16] Changed div.info color and font size to be larger and darker Issue #285 --- public/stylesheets/sass/application.sass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index d47f0d16f..1691755b3 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -266,8 +266,8 @@ li.message :size 14px div.info - :color #eee - :font-size 11px + :color #444 + :font-size 14px a :color #ccc .time From 900a085124a0c7b8f22a678479e3d8650fa4a2a7 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 12 Oct 2010 15:09:32 -0700 Subject: [PATCH 16/16] Merging in bigbash's fixes --- Gemfile.lock | 38 +++++++++++++++--------------- public/stylesheets/application.css | 4 ++-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a2a905cc5..d68bf5ce1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,6 +13,15 @@ GIT devise-mongo_mapper (0.0.1) devise (~> 1.1.0) +GIT + remote: git://github.com/dcu/magent.git + revision: fe08cc6e9d4c1772035f84bcfb665d17b00ac625 + specs: + magent (1.0.0) + em-websocket + mongo + uuidtools + GIT remote: git://github.com/igrigorik/em-http-request.git revision: bf62d67fc72d6e701be5037e239dd470194b8e45 @@ -22,6 +31,16 @@ GIT addressable (>= 2.0.0) eventmachine (>= 0.12.9) +GIT + remote: git://github.com/jnunemaker/mongomapper.git + revision: fd59b0ab068be7321f8e84b9dc12fb4fa6b8535d + branch: rails3 + specs: + mongo_mapper (0.8.4) + activemodel (~> 3.0.0) + activesupport (~> 3.0.0) + plucky (~> 0.3.6) + GIT remote: git://github.com/rsofaer/carrierwave.git revision: 9edb8bdddd2236742a85bfd7b260387498d01f88 @@ -47,25 +66,6 @@ GIT capistrano (>= 2.5.5) highline (>= 1.4.0) -GIT - remote: http://github.com/dcu/magent.git - revision: 5d664351b305141158fc69fc495456414821adb3 - specs: - magent (1.0.0) - em-websocket - mongo - uuidtools - -GIT - remote: http://github.com/jnunemaker/mongomapper.git - revision: fd59b0ab068be7321f8e84b9dc12fb4fa6b8535d - branch: rails3 - specs: - mongo_mapper (0.8.4) - activemodel (~> 3.0.0) - activesupport (~> 3.0.0) - plucky (~> 0.3.6) - GEM remote: http://rubygems.org/ specs: diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 15419a488..93f2efcf0 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -195,8 +195,8 @@ li.message { li.message .content .from a { font-weight: bold; } li.message .content div.info { - color: #eeeeee; - font-size: 11px; } + color: #444444; + font-size: 14px; } li.message .content div.info a { color: #cccccc; } li.message .content div.info .time {