From 600ffc75296917a25ae53c610b9bd6ae8a68f761 Mon Sep 17 00:00:00 2001 From: aymhce Date: Sat, 11 Jun 2016 12:43:17 +0000 Subject: [PATCH] upgrade package app for Yunohost 2.4, also update homepage andd readme --- README.md | 8 ++++--- conf/_show.html.haml | 6 +++--- conf/diaspora.target | 8 +++++++ conf/diaspora_appserver.service | 17 +++++++++++++++ conf/diaspora_worker1.service | 18 ++++++++++++++++ manifest.json | 20 +++++++++++------- scripts/install | 37 ++++++++------------------------- 7 files changed, 73 insertions(+), 41 deletions(-) create mode 100644 conf/diaspora.target create mode 100644 conf/diaspora_appserver.service create mode 100644 conf/diaspora_worker1.service diff --git a/README.md b/README.md index 4e0a982..2d8b12e 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,10 @@ Notes Before installing, you have to: -- get a valid SSL certificate (can use [startssl.com](https://www.startssl.com/)) - get a dedicated domain (must install under web root like **https://diaspora.example.com/** not **https://example.com/diaspora/**) +- get a valid SSL certificate + - can use [letsencrypt](https://letsencrypt.org/) with this fun [app](https://github.com/alexAubin/letsencrypt_ynh) of alexAubin :) + - or more hard, can use [startssl.com](https://www.startssl.com/) Installation effects: @@ -17,8 +19,8 @@ Installation effects: - The installation directory can take up to 700MB and app start time can be take 5 minutes. Make yourself (your account) an admin: -- https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers#What_are_roles_and_how_do_I_use_them.3F_.2F_Make_yourself_an_admin +- https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers#What_are_roles_and_how_do_I_use_them.3F_.2F_Make_yourself_an_admin_or_assign_moderators Not implement yet: -- There are not yet active SSO/LDAP integration. +- backup and restart scripts. diff --git a/conf/_show.html.haml b/conf/_show.html.haml index dd23a7a..17ca8cd 100644 --- a/conf/_show.html.haml +++ b/conf/_show.html.haml @@ -1,11 +1,11 @@ .container{style: "padding-top: 5%;"} .hero-unit - = image_tag "branding/logo.png" + %h2 diaspora* %hr/ %p %b Vous êtes sur le point de changer Internet en utilisant un réseau social anonyme et distribué. %br - %b Rejoignez-nous et récupérez votre liberté, votre vie privée et vos données YunoHost et diaspora* ! + %b Rejoignez-nous et récupérez votre liberté, votre vie privée et vos données avec YunoHost et diaspora* ! %p = link_to "Créer un compte ! »", new_user_registration_path, class: "btn btn-primary btn-large" .row @@ -16,7 +16,7 @@ %a.btn{:href => "https://diasporafoundation.org/"} Fondation Diaspora » .span4 %h2 Auto-hébergez-vous - %p Le site (pod) sur lequel vous êtes est propulsé par YunoHost. Une distribution simple d'outils libres pour créer votre propre "cloud" ! + %p Le site (pod) sur lequel vous êtes est propulsé par YunoHost. Une distribution simple basée sur des outils libres pour créer votre propre "cloud" ! %p %a.btn{:href => "https://yunohost.org/"} YunoHost » .span4 diff --git a/conf/diaspora.target b/conf/diaspora.target new file mode 100644 index 0000000..938aad1 --- /dev/null +++ b/conf/diaspora.target @@ -0,0 +1,8 @@ +[Unit] +Description=Diaspora social network +Wants=redis.service mysqld.service +After=redis.service mysqld.service +StopWhenUnneeded=true + +[Install] +WantedBy=multi-user.target diff --git a/conf/diaspora_appserver.service b/conf/diaspora_appserver.service new file mode 100644 index 0000000..194b76e --- /dev/null +++ b/conf/diaspora_appserver.service @@ -0,0 +1,17 @@ +[Unit] +Description=Diaspora social network (application server) +PartOf=diaspora.target +StopWhenUnneeded=true + +[Service] +User=diaspora +WorkingDirectory=/var/www/diaspora +Environment=RAILS_ENV=production +ExecStart=/var/www/diaspora/.rvm/scripts/extras/chruby.sh 2.2 -- bin/bundle exec puma -b unix:///var/run/diaspora/diaspora.sock -e $RAILS_ENV +Restart=always +CPUAccounting=true +MemoryAccounting=true +BlockIOAccounting=true + +[Install] +WantedBy=diaspora.target diff --git a/conf/diaspora_worker1.service b/conf/diaspora_worker1.service new file mode 100644 index 0000000..42d3b6c --- /dev/null +++ b/conf/diaspora_worker1.service @@ -0,0 +1,18 @@ +[Unit] +Description=Diaspora social network (worker %i) +PartOf=diaspora.target +StopWhenUnneeded=true + +[Service] +User=diaspora +WorkingDirectory=/var/www/diaspora +Environment=RAILS_ENV=production +ExecStart=/var/www/diaspora/.rvm/scripts/extras/chruby.sh 2.2 -- bin/bundle exec sidekiq +Restart=always +CPUAccounting=true +MemoryAccounting=true +BlockIOAccounting=true + +[Install] +WantedBy=diaspora.target +DefaultInstance=worker1 diff --git a/manifest.json b/manifest.json index 165b44e..074e96b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,20 +1,26 @@ { "name": "Diaspora", "id": "diaspora", + "url": "https://diasporafoundation.org", + "packaging_format": 1, "description": { "en": "Distributed social networking service", "fr": "Service de réseau social distribué" }, - "developer": { + "licence": "free", + "maintainer": { "name": "aymhce", - "email": "aymhce@gmail.com", - "url": "https://diasporafoundation.org" + "email": "aymhce@gmail.com" }, - "multi_instance": "true", + "requirements": { + "yunohost": ">> 2.3.12.1" + }, + "multi_instance": "false", "arguments": { "install" : [ { "name": "domain", + "type": "domain", "ask": { "en": "Choose a domain for diaspora*", "fr": "Choisissez un domaine pour diaspora*" @@ -22,13 +28,13 @@ "example": "domain.org" }, { - "name": "public_site", + "name": "site_public", + "type": "boolean", "ask": { "en": "Is it a public Diaspora site?", "fr": "Est-ce un site public ?" }, - "choices": ["yes", "YES", "Yes", "no", "NO", "No"], - "default": "Yes" + "default": true } ] } diff --git a/scripts/install b/scripts/install index 96e9a06..e6563d1 100755 --- a/scripts/install +++ b/scripts/install @@ -2,18 +2,10 @@ # Retrieve arguments domain=$1 -#user=$2 is_public=$2 -versionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}') - -# Check user parameter -#sudo yunohost user list --json | grep -q "\"username\": \"$user\"" -#if [[ ! $? -eq 0 ]]; then -# echo "Wrong user" -# exit 1 -#fi -#sudo yunohost app setting diaspora admin_user -v $user +# Source YunoHost helpers +. /usr/share/yunohost/helpers # Check domain/path availability sudo yunohost app checkurl $domain -a diaspora @@ -28,30 +20,18 @@ full_url=https://$domain sudo yunohost app setting diaspora final_path -v $final_path -# Configure system apt-get -cat /etc/os-release | grep -q wheezy -if [ $? = 0 ] -then - cat /etc/apt/sources.list | grep -q backports - if [ $? != 0 ] - then - sudo su -c "echo 'deb http://http.debian.net/debian wheezy-backports main' >> /etc/apt/sources.list" - fi -fi - # Get sys deps sudo apt-get update sudo apt-get install -y -- \ gawk libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake bison libffi-dev \ build-essential libssl-dev libcurl4-openssl-dev libxml2-dev libxslt-dev imagemagick ghostscript git curl libmysqlclient-dev \ - libmagickwand-dev nodejs-legacy npm - -[ "$versionname" == "wheezy" ] && sudo apt-get install -t wheezy-backports redis-server -y -[ "$versionname" != "wheezy" ] && sudo apt-get install redis-server -y + libmagickwand-dev nodejs-legacy npm redis-server # Get source code git clone -b master git://github.com/diaspora/diaspora.git +echo $(pwd) + sudo mkdir -p $final_path tar -cf source.tar.gz diaspora/ mv source.tar.gz diaspora/public/source.tar.gz @@ -61,11 +41,11 @@ sudo cp -ar diaspora $final_path/../. db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p') # Use 'diaspora' as database name and user -db_user=diaspora +db_user=diaspora # Initialize database and store mysql password for upgrade -sudo yunohost app initdb $db_user -p $db_pwd -d diaspora_production -sudo yunohost app setting diaspora mysqlpwd -v $db_pwd +sudo yunohost app setting diaspora mysqlpwd -v "$db_pwd" +ynh_mysql_create_db diaspora_production "$db_user" "$db_pwd" # prepare and copy diaspora config file sed -i "s@FULLURLTOCHANGE@$full_url@g" ../conf/diaspora.yml @@ -85,6 +65,7 @@ sudo chown -R diaspora:diaspora $final_path # Config RVM and force get app deps (for debug) sudo su - diaspora -c "curl --retry 5 -sSL https://rvm.io/mpapis.asc | gpg --import - ; curl --retry 5 -L dspr.tk/1t | bash;" +sudo su - diaspora -c "curl --retry 5 -sSL https://s.diaspora.software/1t | bash;" # Add user to sudoers for install DIASPORASUDOERSCONF="diaspora ALL=(ALL:ALL) NOPASSWD: ALL #yunhost_diaspora"