diff --git a/pkg/fedora/README.md b/pkg/fedora/README.md index 8060df3a69dc96b53e571ab8e49b7ac38f30dcfe..e294302ce1a4a0818b4dce98fce5bed4d04a1028 100644 --- a/pkg/fedora/README.md +++ b/pkg/fedora/README.md @@ -1,7 +1,5 @@ ## Diaspora RPM tools -NOTE: This does not work ATM, see http://bugs.joindiaspora.com/issues/372 - Creates diaspora source tarballs and RPM packages An alternative to the capistrano system, providing classic, binary RPM @@ -11,9 +9,17 @@ aimed for packaging purposes. #### Fedora RPM synopsis -*Prerequisites*: ruby-1.8, rubygem and other packages as described in -http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora -or http://github.com/diaspora/diaspora/wiki/Installing-on-CentOS-Fedora +Prerequisites: + +- ruby-1.8, rubygem, git and rake as described in + http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora + or http://github.com/diaspora/diaspora/wiki/Installing-on-CentOS-Fedora + +- A personal environment to build RPM:s, also described in + http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora + +Install g++ (possibly unnnecessary?): + % yum install gcc-c++ Create source tarballs like dist/diaspora-0.0-1010041233_fade4231.tar.gz and dist/diaspora-bundle-0.0-1010041233_fade4231.tar.gz: @@ -63,12 +69,12 @@ The source tarball could be used as-is, by unpacking add making a % This file can be installed anywhere. To use it, add a symlink from vendor/bundle -to the bundle's master directory. Reasonable defaults are to install -diaspora in /var/diaspora and bundle in /usr/lib/diaspora-bundle. With these, +to the bundle's bundle directory. Reasonable defaults are to install +diaspora in /usr/share/diaspora and bundle in /usr/lib/diaspora-bundle. With these, the link is - % rm -rf /var/diaspora/master/vendor/bundle - % ln -sf /usr/lib/diaspora-bundle/master/bundle \ - > /var/diaspora/master/vendor + % rm -rf /usr/share/diaspora/master/vendor/bundle + % ln -sf /usr/lib/diaspora-bundle/bundle \ + > /usr/share/diaspora/master/vendor % The directories tmp, log, and public/uploads needs to be writable. If using @@ -83,27 +89,20 @@ The source tarball is as retrieved from diaspora with following differences: - The .git directories are removed (freeing more than 50% of the size). - A new file /master/config/gitversion is created. - - The file public/source.tar is generated. + - The file public/source.tar.gz is generated. - The file .bundle/config is patched. Remove before doing *bundle install* ./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The root cause is a bad Gemfile in the git repo. Possible fixes includes using a older version known to work: - % ./make-dist.sh -c c818885b6 bundle % ./make-dist.sh -c c818885b6 source or forcing a complete update of Gemfile.lock using 'bundle update' (a -potential problematic operation): - +potentially problematic operation): % ./make-dist.sh -f bundle - -Routines uses last available version from master branch at github. The -version contains a time stamp and an abbreviated git commit id. -Using -c, a specific commit can be used for source build. - *make-dist prepare* creates links also for all files listed in SOURCES. Typically, this is secondary sources. *make-dist.sh sources* applies all patches named *.patch in this directory after checking out @@ -150,24 +149,24 @@ diaspora app. This is more or less as mandated by LSB and Fedora packaging rule #### Discussion -For better or worse, this installation differs from the procedure outlined in the -original README.md: +For better or worse, this installation differs from the procedure outlined +in the original README.md: -- All configuration is done in /usr/share/diaspore. No global ur user installed bundles - are involved. Easier to maintain, but a mess if there should be parallel - installations. +- All configuration is done in /usr/share/diaspore. No global or user + installed bundles are involved. Easier to maintain, but a mess if there + should be parallel installations. - Service is run under it's own uid, not root or an ordinary user account. -- Using the pre-packaged mongod server means that the DB has reasonable permissions, - not 777. +- Using the pre-packaged mongod server means that the DB has reasonable + permissions, not 777. -- Splitting in two packages makes sense IMHO. The bundle is not changed that often, - but is quite big: ~30M without test packages (the default) or ~55M with test - packages. The application is just ~3M, and is fast to deploy even with these - tools (yes, I know, capistrano is much faster...) +- Splitting in two packages makes sense IMHO. The bundle is not changed + that often, but is quite big: ~35M without test packages (the default) or + ~55M with test packages. The application is just ~3M, and is fast to + deploy even with these tools (yes, I know, capistrano is much faster...) -- Many, roughly 50% of the packages in the bundle are already packaged for Fedora - i. e., they could be removed from the bundle and added as dependencies instead. - This is likely to make things more stable in the long run. - diaspora.spec has a list. +- Many, roughly 50% of the packages in the bundle are already packaged + for Fedora i. e., they could be removed from the bundle and added as + dependencies instead. This is likely to make things more stable in the + long run. diaspora.spec has a list. diff --git a/pkg/fedora/diaspora-bundle.spec b/pkg/fedora/diaspora-bundle.spec index 5e66dcc75eaf80d32b0a76e9dbe68ba367dbfac8..a4ab0e6effaecb93273f07940e4c8acef2fbd875 100644 --- a/pkg/fedora/diaspora-bundle.spec +++ b/pkg/fedora/diaspora-bundle.spec @@ -174,7 +174,7 @@ popd getent group diaspora >/dev/null || groupadd -r diaspora getent passwd diaspora >/dev/null || \ useradd -r -g diaspora \ - -md /var/lib/diaspora -s /sbin/nologin \ + -md /var/lib/diaspora -s /bin/bash \ -c "Diaspora daemon" diaspora exit 0 diff --git a/pkg/fedora/diaspora-setup b/pkg/fedora/diaspora-setup index eaa9192c06d7a2fbf2b7953031a61050358f0085..a1df72fbcf26291013fe500ffbfb1826f512f38b 100755 --- a/pkg/fedora/diaspora-setup +++ b/pkg/fedora/diaspora-setup @@ -2,6 +2,10 @@ # # Do what's needed to initiate diaspora. # +# Usage: # ./diaspora-setup [external hostname] +# + +arg_hostname="$1" test $UID = "0" || { echo "You need to be root to do this, giving up" @@ -37,6 +41,13 @@ fi # %attr(0777, diaspora, diaspora) doesn't work in specfile due to umask 022. chmod 777 /var/lib/diaspora/uploads +chown -R diaspora /var/log/diaspora + +if [ -n "$arg_hostname" ]; then + sed -i "/pod_url:/s/$hostname/$arg_hostname/g" config/app_config.yml && + echo "config/app_config.yml updated." + exit 0 +fi hostname=$( awk '/pod_url:/ { print $2; exit }' <config/app_config.yml) while : ; do diff --git a/pkg/fedora/make-dist.sh b/pkg/fedora/make-dist.sh index 18dbfff9bec6d3f404e5a89134da3d5dc0ec6b77..6777ae773be9faeeb7a9907e1275883fa516f2f9 100755 --- a/pkg/fedora/make-dist.sh +++ b/pkg/fedora/make-dist.sh @@ -162,8 +162,8 @@ function make_src ( cd ${RELEASE_DIR}/master git show --name-only > config/gitversion - tar cf public/source.tar \ - --exclude='source.tar' -X .gitignore * + tar czf public/source.tar.gz \ + --exclude='source.tar.gz' -X .gitignore * find $PWD -name .git\* | xargs rm -rf rm -rf .bundle /usr/bin/patch -p1 -s <../../../add-bundle.diff @@ -192,6 +192,8 @@ set -x mkdir -p $bundle_name/bundle pushd diaspora > /dev/null if [ "$BUNDLE_FIX" = 'yes' ]; then + rm -f Gemfile.lock + rm -rf .bundle bundle update fi bundle install --deployment \ @@ -286,7 +288,7 @@ function usage() commit='HEAD' BUNDLE_FIX='no' -while getopts ":r:c:fh" opt +while getopts ":r:c:u:fh" opt do case $opt in u) GIT_REPO="$OPTARG" diff --git a/pkg/ubuntu/README.md b/pkg/ubuntu/README.md index ee78f6df78e3e1c4d78e380350612aa68b52eaf7..15a4947dc941419a594437973e0badfd29d1e636 100644 --- a/pkg/ubuntu/README.md +++ b/pkg/ubuntu/README.md @@ -1,32 +1,30 @@ ## Package-oriented install for ubuntu. -NOTE: This does not work ATM, see http://bugs.joindiaspora.com/issues/372 - -Here are somediaspora-installdiaspora-install scripts to install diaspora on Ubuntu. They are designed to +Here are 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-core - git clone git://github.com/diaspora/diaspora.git - cd diaspora/pkg/ubuntu + % sudo apt-get install git-core + % git clone git://github.com/diaspora/diaspora.git + % cd diaspora/pkg/ubuntu -Install the dependencies (a good time for a coffe break) - sudo ./diaspora-install-deps +Install the dependencies (a good time for a coffe break): + % sudo ./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 bundle + % sudo ./diaspora-bundle-install dist/diaspora-bundle-*.tar.gz - ./make-dist.sh source - sudo ./diaspora-install dist/diaspora-0.0*.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 + % sudo ./diaspora-setup + % sudo su - diaspora + % cd /usr/share/diaspora/master + % ./script/server ### Upgrading @@ -36,18 +34,22 @@ The normal procedure to update is to just $ ./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 +And then use diaspora-install and diaspora-install-bundle as above. +It's necessary to always have the correct bundle. The *./make-dist.sh bundle* +above will use a cached bundle if it's still valid, else build a new. +In most cases only source will need to be built, which is fast. - Repo: http://github.com/diaspora/diaspora.git - Bundle: dist/diaspora-bundle-0.0-1010111342_afad554.tar.gz +### Notes -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. +./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The +root cause is a bad Gemfile.lock in the git repo. Possible fixes includes +using a older version known to work: + % ./make-dist.sh -c c818885b6 bundle + % ./make-dist.sh -c c818885b6 source -### Notes +or forcing a complete update of Gemfile.lock using 'bundle update' (a +potentially problematic operation): + % ./make-dist.sh -f bundle ./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The root cause is a bad Gemfile.lock in the git repo. Possible fixes includes @@ -73,22 +75,20 @@ the stuff using git in this case. The user diaspora is added during install. Tools used for building package are installed globally. All of diasporas -dependencies lives in the nothing is insalled by user or on system level. - -make-dist.sh accepts arguments to get a specified commit and/or use another -repo. +dependencies lives in the application - nothing is installed by user or +on system level. This has been tested on a Ubuntu 32-bit 10.10 , clean server and on 10.04 Lucid desktop, also clean installation. mongodb is having problems occasionally. Sometimes the dependencies are not -installed, and mongod refuses to start. invoke /usr/bin/mongod -f /etc/mongodb.conf -fo test. The lockfile /var/lib/mongodb/mongod.conf is also a potential -problem. Remove to make it start again. +installed, and mongod refuses to start. invoke */usr/bin/mongod -f +/etc/mongodb.conf* to test. The lockfile /var/lib/mongodb/mongod.conf is +also a potential problem. Remove to make it start again. The diaspora-wsd is just placeholder FTM, it does **not** work. -Please, report any problems! + diff --git a/pkg/ubuntu/diaspora-install b/pkg/ubuntu/diaspora-install index 8717f8d566aca80a50ce5d8ac09c19d05f33f6d6..e7cef8f31b345fd2f038246459be251dba56fab8 100755 --- a/pkg/ubuntu/diaspora-install +++ b/pkg/ubuntu/diaspora-install @@ -9,8 +9,6 @@ test "$(perl -e 'print $>')" = "0" || { exit 2 } -set -x - getent group diaspora >/dev/null || groupadd -r diaspora getent passwd diaspora >/dev/null || \ useradd -r -g diaspora \ diff --git a/pkg/ubuntu/diaspora-install-deps b/pkg/ubuntu/diaspora-install-deps index e3a307ef747ee0262fb72614468b2a1c21a3ae6f..388dc39e034432164c67008b68badeb980221a1c 100755 --- a/pkg/ubuntu/diaspora-install-deps +++ b/pkg/ubuntu/diaspora-install-deps @@ -11,11 +11,18 @@ grep -v '^#' /etc/apt/sources.list | grep -q universe || { EOF sleep 2 } +release=$( lsb_release -a | awk '/Release:/ {print $2}') sudo apt-get update -sudo apt-get install -qy --ignore-missing build-essential libxslt1-dev \ - libxml2 ruby-full mongodb rake python-software-properties git-core \ - imagemagick libmagick9-dev xulrunner-1.9 +sudo apt-get install -qy build-essential libxslt1-dev libxml2 \ + ruby-full mongodb rake python-software-properties git-core \ + imagemagick libmagick9-dev +if [ "$release" = "10.04" ]; then + # See: https://bugs.launchpad.net/ubuntu/+source/mongodb/+bug/557024 + sudo apt-get install xulrunner-1.9 + xulversion=$( xulrunner --gre-version) + sudo ln -sf "/usr/lib/xulrunner-$xulversion/libmozjs.so" /usr/lib +fi sudo add-apt-repository ppa:maco.m/ruby sudo apt-get update sudo apt-get install -qy rubygems diff --git a/pkg/ubuntu/diaspora-setup b/pkg/ubuntu/diaspora-setup index 9e7da6fc23a155b1b1234c6799361ae1db46ad0f..4b9207fd314d9962102da2b7cf986ffb2d709703 100755 --- a/pkg/ubuntu/diaspora-setup +++ b/pkg/ubuntu/diaspora-setup @@ -2,12 +2,16 @@ # # 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" @@ -42,6 +46,12 @@ fi chmod 777 /var/lib/diaspora/uploads chown -R diaspora /var/log/diaspora +if [ -n "$arg_hostname" ]; then + sed -i "/pod_url:/s/$hostname/$arg_hostname/g" config/app_config.yml && + echo "config/app_config.yml updated." + exit 0 +fi + hostname=$( awk '/pod_url:/ { print $2; exit }' <config/app_config.yml) while : ; do echo "Current hostname is \"$hostname\""