mirror of
https://github.com/YunoHost-Apps/diaspora_ynh.git
synced 2024-09-03 18:26:13 +02:00
commit
9e99807ae4
30 changed files with 1179 additions and 1750 deletions
55
.github/ISSUE_TEMPLATE.md
vendored
Normal file
55
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**How to post a meaningful bug report**
|
||||||
|
1. *Read this whole template first.*
|
||||||
|
2. *Determine if you are on the right place:*
|
||||||
|
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
||||||
|
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
|
||||||
|
- *When in doubt, post here and we will figure it out together.*
|
||||||
|
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
|
||||||
|
*A clear and concise description of what the bug is.*
|
||||||
|
|
||||||
|
### Context
|
||||||
|
|
||||||
|
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
|
||||||
|
- YunoHost version: x.x.x
|
||||||
|
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
|
||||||
|
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
|
||||||
|
- If yes, please explain:
|
||||||
|
- Using, or trying to install package version/branch:
|
||||||
|
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
|
||||||
|
- *If you performed a command from the CLI, the command itself is enough. For example:*
|
||||||
|
```sh
|
||||||
|
sudo yunohost app install the_app
|
||||||
|
```
|
||||||
|
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
|
||||||
|
- *If the error occurs in your browser, explain what you did:*
|
||||||
|
1. *Go to '...'*
|
||||||
|
2. *Click on '...'*
|
||||||
|
3. *Scroll down to '...'*
|
||||||
|
4. *See error*
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
|
||||||
|
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
|
||||||
|
|
||||||
|
### Logs
|
||||||
|
|
||||||
|
*When an operation fails, YunoHost provides a simple way to share the logs.*
|
||||||
|
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
|
||||||
|
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
|
||||||
|
|
||||||
|
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
|
||||||
|
|
||||||
|
*If applicable and useful, add screenshots to help explain your problem.*
|
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
- *Description of why you made this PR*
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
- *And how do you fix that problem*
|
||||||
|
|
||||||
|
## PR Status
|
||||||
|
|
||||||
|
- [ ] Code finished and ready to be reviewed/tested
|
||||||
|
- [ ] The fix/enhancement were manually tested (if applicable)
|
||||||
|
|
||||||
|
## Automatic tests
|
||||||
|
|
||||||
|
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)
|
107
.github/workflows/updater.sh
vendored
Normal file
107
.github/workflows/updater.sh
vendored
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PACKAGE UPDATING HELPER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# This script is meant to be run by GitHub Actions
|
||||||
|
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
||||||
|
# Since each app is different, maintainers can adapt its contents so as to perform
|
||||||
|
# automatic actions when a new upstream release is detected.
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Fetching information
|
||||||
|
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
||||||
|
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||||
|
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||||
|
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
||||||
|
assets="https://github.com/diaspora/diaspora/archive/refs/tags/$version.tar.gz"
|
||||||
|
|
||||||
|
# Later down the script, we assume the version has only digits and dots
|
||||||
|
# Sometimes the release name starts with a "v", so let's filter it out.
|
||||||
|
# You may need more tweaks here if the upstream repository has different naming conventions.
|
||||||
|
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
|
||||||
|
version=${version:1}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Setting up the environment variables
|
||||||
|
echo "Current version: $current_version"
|
||||||
|
echo "Latest release from upstream: $version"
|
||||||
|
echo "VERSION=$version" >> $GITHUB_ENV
|
||||||
|
echo "REPO=$repo" >> $GITHUB_ENV
|
||||||
|
# For the time being, let's assume the script will fail
|
||||||
|
echo "PROCEED=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Proceed only if the retrieved version is greater than the current one
|
||||||
|
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
||||||
|
echo "::warning ::No new version available"
|
||||||
|
exit 0
|
||||||
|
# Proceed only if a PR for this new version does not already exist
|
||||||
|
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
||||||
|
echo "::warning ::A branch already exists for this update"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPDATE SOURCE FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Let's download source tarball
|
||||||
|
asset_url=$assets
|
||||||
|
|
||||||
|
echo "Handling asset at $asset_url"
|
||||||
|
|
||||||
|
src="app"
|
||||||
|
|
||||||
|
# Create the temporary directory
|
||||||
|
tempdir="$(mktemp -d)"
|
||||||
|
|
||||||
|
# Download sources and calculate checksum
|
||||||
|
filename=${asset_url##*/}
|
||||||
|
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
|
||||||
|
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||||||
|
|
||||||
|
# Delete temporary directory
|
||||||
|
rm -rf $tempdir
|
||||||
|
|
||||||
|
# Get extension
|
||||||
|
if [[ $filename == *.tar.gz ]]; then
|
||||||
|
extension=tar.gz
|
||||||
|
else
|
||||||
|
extension=${filename##*.}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rewrite source file
|
||||||
|
cat <<EOT > conf/$src.src
|
||||||
|
SOURCE_URL=$asset_url
|
||||||
|
SOURCE_SUM=$checksum
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=$extension
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
||||||
|
EOT
|
||||||
|
echo "... conf/$src.src updated"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPDATE STEPS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Any action on the app's source code can be done.
|
||||||
|
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Replace new version in manifest
|
||||||
|
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
||||||
|
|
||||||
|
# No need to update the README, yunohost-bot takes care of it
|
||||||
|
|
||||||
|
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||||
|
echo "PROCEED=true" >> $GITHUB_ENV
|
||||||
|
exit 0
|
49
.github/workflows/updater.yml
vendored
Normal file
49
.github/workflows/updater.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
|
||||||
|
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
|
||||||
|
# This file should be enough by itself, but feel free to tune it to your needs.
|
||||||
|
# It calls updater.sh, which is where you should put the app-specific update steps.
|
||||||
|
name: Check for new upstream releases
|
||||||
|
on:
|
||||||
|
# Allow to manually trigger the workflow
|
||||||
|
workflow_dispatch:
|
||||||
|
# Run it every day at 6:00 UTC
|
||||||
|
schedule:
|
||||||
|
- cron: '0 6 * * *'
|
||||||
|
jobs:
|
||||||
|
updater:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Fetch the source code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Run the updater script
|
||||||
|
id: run_updater
|
||||||
|
run: |
|
||||||
|
# Setting up Git user
|
||||||
|
git config --global user.name 'yunohost-bot'
|
||||||
|
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
||||||
|
# Run the updater script
|
||||||
|
/bin/bash .github/workflows/updater.sh
|
||||||
|
- name: Commit changes
|
||||||
|
id: commit
|
||||||
|
if: ${{ env.PROCEED == 'true' }}
|
||||||
|
run: |
|
||||||
|
git commit -am "Upgrade to v$VERSION"
|
||||||
|
- name: Create Pull Request
|
||||||
|
id: cpr
|
||||||
|
if: ${{ env.PROCEED == 'true' }}
|
||||||
|
uses: peter-evans/create-pull-request@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
commit-message: Update to version ${{ env.VERSION }}
|
||||||
|
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||||
|
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||||
|
signoff: false
|
||||||
|
base: testing
|
||||||
|
branch: ci-auto-update-v${{ env.VERSION }}
|
||||||
|
delete-branch: true
|
||||||
|
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||||
|
body: |
|
||||||
|
Upgrade to v${{ env.VERSION }}
|
||||||
|
draft: false
|
24
README.md
24
README.md
|
@ -5,7 +5,8 @@ It shall NOT be edited by hand.
|
||||||
|
|
||||||
# Diaspora for YunoHost
|
# Diaspora for YunoHost
|
||||||
|
|
||||||
[![Integration level](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)
|
[![Integration level](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![Working status](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)
|
||||||
|
|
||||||
[![Install Diaspora with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=diaspora)
|
[![Install Diaspora with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=diaspora)
|
||||||
|
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
*[Lire ce readme en français.](./README_fr.md)*
|
||||||
|
@ -17,9 +18,11 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
Distributed social networking service
|
Distributed social networking service
|
||||||
|
|
||||||
**Shipped version:** 0.7.17.0~ynh1
|
**Shipped version:** 0.7.18.1~ynh1
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![Screenshot of Diaspora](./doc/screenshots/Diaspora_latest.png)
|
||||||
|
|
||||||
## Disclaimers / important information
|
## Disclaimers / important information
|
||||||
|
|
||||||
|
@ -30,22 +33,23 @@ Distributed social networking service
|
||||||
|
|
||||||
## Documentation and resources
|
## Documentation and resources
|
||||||
|
|
||||||
* Official app website: https://diasporafoundation.org/
|
* Official app website: <https://diasporafoundation.org/>
|
||||||
* Official user documentation: https://wiki.diasporafoundation.org/FAQ_for_users
|
* Official user documentation: <https://wiki.diasporafoundation.org/FAQ_for_users>
|
||||||
* Official admin documentation: https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers
|
* Official admin documentation: <https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers>
|
||||||
* Upstream app code repository: https://github.com/diaspora/diaspora
|
* Upstream app code repository: <https://github.com/diaspora/diaspora>
|
||||||
* YunoHost documentation for this app: https://yunohost.org/app_diaspora
|
* YunoHost documentation for this app: <https://yunohost.org/app_diaspora>
|
||||||
* Report a bug: https://github.com/YunoHost-Apps/diaspora_ynh/issues
|
* Report a bug: <https://github.com/YunoHost-Apps/diaspora_ynh/issues>
|
||||||
|
|
||||||
## Developer info
|
## Developer info
|
||||||
|
|
||||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing).
|
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing).
|
||||||
|
|
||||||
To try the testing branch, please proceed like that.
|
To try the testing branch, please proceed like that.
|
||||||
```
|
|
||||||
|
``` bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
|
||||||
or
|
or
|
||||||
sudo yunohost app upgrade diaspora -u https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
|
sudo yunohost app upgrade diaspora -u https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||||
|
|
36
README_fr.md
36
README_fr.md
|
@ -1,21 +1,28 @@
|
||||||
|
<!--
|
||||||
|
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||||
|
It shall NOT be edited by hand.
|
||||||
|
-->
|
||||||
|
|
||||||
# Diaspora pour YunoHost
|
# Diaspora pour YunoHost
|
||||||
|
|
||||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)
|
[![Niveau d’intégration](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)
|
||||||
|
|
||||||
[![Installer Diaspora avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=diaspora)
|
[![Installer Diaspora avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=diaspora)
|
||||||
|
|
||||||
*[Read this readme in english.](./README.md)*
|
*[Read this readme in english.](./README.md)*
|
||||||
*[Lire ce readme en français.](./README_fr.md)*
|
|
||||||
|
|
||||||
> *Ce package vous permet d'installer Diaspora rapidement et simplement sur un serveur YunoHost.
|
> *Ce package vous permet d’installer Diaspora rapidement et simplement sur un serveur YunoHost.
|
||||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.*
|
||||||
|
|
||||||
## Vue d'ensemble
|
## Vue d’ensemble
|
||||||
|
|
||||||
Service de réseau social distribué
|
Service de réseau social distribué
|
||||||
|
|
||||||
**Version incluse :** 0.7.17.0~ynh1
|
**Version incluse :** 0.7.18.1~ynh1
|
||||||
|
|
||||||
|
## Captures d’écran
|
||||||
|
|
||||||
|
![Capture d’écran de Diaspora](./doc/screenshots/Diaspora_latest.png)
|
||||||
|
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
|
@ -26,22 +33,23 @@ Service de réseau social distribué
|
||||||
|
|
||||||
## Documentations et ressources
|
## Documentations et ressources
|
||||||
|
|
||||||
* Site officiel de l'app : https://diasporafoundation.org/
|
* Site officiel de l’app : <https://diasporafoundation.org/>
|
||||||
* Documentation officielle utilisateur : https://wiki.diasporafoundation.org/FAQ_for_users
|
* Documentation officielle utilisateur : <https://wiki.diasporafoundation.org/FAQ_for_users>
|
||||||
* Documentation officielle de l'admin : https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers
|
* Documentation officielle de l’admin : <https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers>
|
||||||
* Dépôt de code officiel de l'app : https://github.com/diaspora/diaspora
|
* Dépôt de code officiel de l’app : <https://github.com/diaspora/diaspora>
|
||||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_diaspora
|
* Documentation YunoHost pour cette app : <https://yunohost.org/app_diaspora>
|
||||||
* Signaler un bug : https://github.com/YunoHost-Apps/diaspora_ynh/issues
|
* Signaler un bug : <https://github.com/YunoHost-Apps/diaspora_ynh/issues>
|
||||||
|
|
||||||
## Informations pour les développeurs
|
## Informations pour les développeurs
|
||||||
|
|
||||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing).
|
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing).
|
||||||
|
|
||||||
Pour essayer la branche testing, procédez comme suit.
|
Pour essayer la branche testing, procédez comme suit.
|
||||||
```
|
|
||||||
|
``` bash
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
|
sudo yunohost app install https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
|
||||||
ou
|
ou
|
||||||
sudo yunohost app upgrade diaspora -u https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
|
sudo yunohost app upgrade diaspora -u https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
|
@ -1,16 +1,18 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld"
|
||||||
path="/path" (PATH)
|
admin="john"
|
||||||
admin="john" (USER)
|
password="1Strong-Password"
|
||||||
admin_password="pass"
|
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0 # not supported upstream
|
setup_sub_dir=0 # not supported upstream
|
||||||
setup_root=1
|
setup_root=1
|
||||||
setup_nourl=0
|
setup_nourl=0
|
||||||
upgrade=1
|
upgrade=1
|
||||||
upgrade=1 from_commit=0.7.16.0-ynh1
|
# 0.7.16.0-ynh1
|
||||||
|
upgrade=1 from_commit=ee7996edba39c1978b0986aabc89042f949e335f
|
||||||
|
# 0.7.17.0~ynh1
|
||||||
|
upgrade=1 from_commit=f6bc22257c54478420ed42480f346f25601ee87a
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
@ -19,7 +21,6 @@
|
||||||
Email=
|
Email=
|
||||||
Notification=none
|
Notification=none
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=CommitHash
|
; commit=ee7996edba39c1978b0986aabc89042f949e335f
|
||||||
name=Name and date of the commit.
|
name=0.7.16.0-ynh1.
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
manifest_arg=domain=DOMAIN&admin=USER&admin_password=pass
|
||||||
|
|
||||||
|
|
7
conf/app.src
Normal file
7
conf/app.src
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SOURCE_URL=https://github.com/diaspora/diaspora/archive/refs/tags/v0.7.18.1.tar.gz
|
||||||
|
SOURCE_SUM=9dba7fc8ec261bc00c4f5d45af38e3c7aa9e44204dce3b2b79feeed3a120d148
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
|
@ -2,8 +2,8 @@ postgresql: &postgresql
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
host: "localhost"
|
host: "localhost"
|
||||||
port: 5432
|
port: 5432
|
||||||
username: "{{ app }}"
|
username: "__DB_USER__"
|
||||||
password: "{{ db_pass }}"
|
password: "__DB_PWD__"
|
||||||
encoding: unicode
|
encoding: unicode
|
||||||
|
|
||||||
mysql: &mysql
|
mysql: &mysql
|
||||||
|
@ -42,7 +42,7 @@ development:
|
||||||
database: diaspora_development
|
database: diaspora_development
|
||||||
production:
|
production:
|
||||||
<<: *combined
|
<<: *combined
|
||||||
database: {{ app }}
|
database: __DB_NAME__
|
||||||
test:
|
test:
|
||||||
<<: *combined
|
<<: *combined
|
||||||
database: diaspora_test
|
database: diaspora_test
|
||||||
|
|
|
@ -36,7 +36,7 @@ configuration: ## Section
|
||||||
## However changing http to https is okay and has no consequences.
|
## However changing http to https is okay and has no consequences.
|
||||||
## If you do change the URL, you will have to start again as the URL
|
## If you do change the URL, you will have to start again as the URL
|
||||||
## will be hardcoded into the database.
|
## will be hardcoded into the database.
|
||||||
url: "https://{{ domain }}"
|
url: "https://__DOMAIN__"
|
||||||
|
|
||||||
## Set the bundle of certificate authorities (CA) certificates.
|
## Set the bundle of certificate authorities (CA) certificates.
|
||||||
## This is specific to your operating system.
|
## This is specific to your operating system.
|
||||||
|
@ -176,10 +176,10 @@ configuration: ## Section
|
||||||
#listen: 'unix:tmp/diaspora.sock'
|
#listen: 'unix:tmp/diaspora.sock'
|
||||||
#listen: 'unix:/run/diaspora/diaspora.sock'
|
#listen: 'unix:/run/diaspora/diaspora.sock'
|
||||||
#listen: '127.0.0.1:3000'
|
#listen: '127.0.0.1:3000'
|
||||||
listen: unix:/run/{{ app }}/diaspora.sock
|
listen: unix:/run/__APP__/diaspora.sock
|
||||||
|
|
||||||
## Set the path for the PID file of the unicorn master process (default=tmp/pids/web.pid)
|
## Set the path for the PID file of the unicorn master process (default=tmp/pids/web.pid)
|
||||||
pid: '/run/{{ app }}/diaspora.pid'
|
pid: '/run/__APP__/diaspora.pid'
|
||||||
|
|
||||||
## Rails environment (default='development').
|
## Rails environment (default='development').
|
||||||
## The environment in which the server should be started by default.
|
## The environment in which the server should be started by default.
|
||||||
|
@ -553,7 +553,7 @@ configuration: ## Section
|
||||||
enable: true
|
enable: true
|
||||||
|
|
||||||
## Sender address used in mail sent by Diaspora.
|
## Sender address used in mail sent by Diaspora.
|
||||||
sender_address: 'no-reply@{{ domain }}'
|
sender_address: 'no-reply@__DOMAIN__'
|
||||||
|
|
||||||
## This selects which mailer should be used. Use 'smtp' for a smtp
|
## This selects which mailer should be used. Use 'smtp' for a smtp
|
||||||
## connection or 'sendmail' to use the sendmail binary.
|
## connection or 'sendmail' to use the sendmail binary.
|
||||||
|
@ -606,10 +606,10 @@ configuration: ## Section
|
||||||
## This doesn't make the user an admin but is used when a generic
|
## This doesn't make the user an admin but is used when a generic
|
||||||
## admin contact is needed, much like the postmaster role in mail
|
## admin contact is needed, much like the postmaster role in mail
|
||||||
## systems. Set only the username, NOT the full ID.
|
## systems. Set only the username, NOT the full ID.
|
||||||
account: "{{ admin }}"
|
account: "__ADMIN__"
|
||||||
|
|
||||||
## E-mail address to contact the administrator.
|
## E-mail address to contact the administrator.
|
||||||
podmin_email: '{{ admin_email }}'
|
podmin_email: '__ADMIN_MAIL__'
|
||||||
|
|
||||||
## Settings related to relays
|
## Settings related to relays
|
||||||
relay: ## Section
|
relay: ## Section
|
||||||
|
|
|
@ -3,29 +3,32 @@ Description=Diaspora social network (sidekiq - instance __APP__)
|
||||||
PartOf=__APP__.target
|
PartOf=__APP__.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Environment=RAILS_ENV=production
|
WorkingDirectory=__FINALPATH__/live
|
||||||
WorkingDirectory=__FINALPATH__/diaspora
|
Environment="__LD_PRELOAD__"
|
||||||
ExecStart=/bin/bash -lc "bin/bundle exec sidekiq"
|
Environment="RAILS_ENV=production"
|
||||||
|
Environment="__YNH_RUBY_LOAD_PATH__"
|
||||||
|
ExecStart=__FINAL_PATH__/live/bin/bundle exec sidekiq
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
# Sandboxing options to harden security
|
# Sandboxing options to harden security
|
||||||
# Depending on specificities of your service/app, you may need to tweak these
|
# Depending on specificities of your service/app, you may need to tweak these
|
||||||
# .. but this should be a good baseline
|
# .. but this should be a good baseline
|
||||||
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||||
NoNewPrivileges=yes
|
NoNewPrivileges=no
|
||||||
PrivateTmp=yes
|
PrivateTmp=yes
|
||||||
PrivateDevices=yes
|
#PrivateDevices=yes
|
||||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
#RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
|
||||||
RestrictNamespaces=yes
|
#RestrictNamespaces=yes
|
||||||
RestrictRealtime=yes
|
#RestrictRealtime=yes
|
||||||
DevicePolicy=closed
|
DevicePolicy=closed
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
ProtectControlGroups=yes
|
ProtectControlGroups=yes
|
||||||
ProtectKernelModules=yes
|
#ProtectKernelModules=yes
|
||||||
ProtectKernelTunables=yes
|
#ProtectKernelTunables=yes
|
||||||
LockPersonality=yes
|
#LockPersonality=yes
|
||||||
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
|
#SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
|
||||||
|
|
||||||
# Denying access to capabilities that should not be relevant for webapps
|
# Denying access to capabilities that should not be relevant for webapps
|
||||||
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
||||||
|
|
|
@ -3,11 +3,14 @@ Description=Diaspora social network (unicorn - instance __APP__)
|
||||||
PartOf=__APP__.target
|
PartOf=__APP__.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Environment=RAILS_ENV=production
|
WorkingDirectory=__FINALPATH__/live
|
||||||
WorkingDirectory=__FINALPATH__/diaspora
|
Environment="__LD_PRELOAD__"
|
||||||
|
Environment="RAILS_ENV=production"
|
||||||
|
Environment="__YNH_RUBY_LOAD_PATH__"
|
||||||
PIDFile=/run/__APP__/diaspora.pid
|
PIDFile=/run/__APP__/diaspora.pid
|
||||||
ExecStart=/bin/bash -lc "bin/bundle exec unicorn -c config/unicorn.rb -E production"
|
ExecStart=__FINAL_PATH__/live/bin/bundle exec unicorn -c config/unicorn.rb -E production
|
||||||
ExecReload=/bin/kill -USR2 $MAINPID
|
ExecReload=/bin/kill -USR2 $MAINPID
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
|
@ -18,7 +21,7 @@ Restart=always
|
||||||
NoNewPrivileges=yes
|
NoNewPrivileges=yes
|
||||||
PrivateTmp=yes
|
PrivateTmp=yes
|
||||||
PrivateDevices=yes
|
PrivateDevices=yes
|
||||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
|
||||||
RestrictNamespaces=yes
|
RestrictNamespaces=yes
|
||||||
RestrictRealtime=yes
|
RestrictRealtime=yes
|
||||||
DevicePolicy=closed
|
DevicePolicy=closed
|
||||||
|
@ -41,6 +44,5 @@ CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
||||||
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
||||||
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
||||||
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=__APP__.target
|
WantedBy=__APP__.target
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,8 @@
|
||||||
# Proxy if requested file not found
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
location / {
|
location __PATH__/ {
|
||||||
|
|
||||||
root __FINALPATH__/diaspora/public;
|
# Path to source
|
||||||
|
alias __FINALPATH__/live/public/;
|
||||||
|
|
||||||
# Configure maximum picture size
|
# Configure maximum picture size
|
||||||
# Note that Diaspora has a client side check set at 4M
|
# Note that Diaspora has a client side check set at 4M
|
||||||
|
@ -11,7 +12,7 @@ location / {
|
||||||
# Proxy if requested file not found
|
# Proxy if requested file not found
|
||||||
try_files $uri @diaspora;
|
try_files $uri @diaspora;
|
||||||
|
|
||||||
location /assets/ {
|
location __PATH__/assets/ {
|
||||||
expires max;
|
expires max;
|
||||||
more_set_headers 'Cache-Control: public';
|
more_set_headers 'Cache-Control: public';
|
||||||
}
|
}
|
||||||
|
@ -28,5 +29,4 @@ location @diaspora {
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
|
|
||||||
proxy_pass http://unix:/run/__NAME__/diaspora.sock;
|
proxy_pass http://unix:/run/__NAME__/diaspora.sock;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
||||||
|
|
||||||
mQINBFglzSYBEADfGIe+NZMt2ymkKz6QvgG7Kwu54s5E/rikRNRKviysO7O3NWC8
|
|
||||||
P6FQ80kf4s1OhMF+//xnQTXiqFyjCFqftbEM2ApK9YHTUoVFF8I6Ed3uRxP9H3fO
|
|
||||||
dkn3nkvWjSUNo35DkBpGtV6XcMRqHbjGWtjahfrYuqa4oh4ZbY3i3kxUIWTKar+U
|
|
||||||
k7FEigw2znfRjgDT1aX9gLfq2z7GzBwO73HcX4oDJ2Q+T2g/IJ5SusUF2SoEUEUE
|
|
||||||
+phi9h3JGJ/AxX9/rRPJHWeluPKOdkhmFe/Qb+gote82LUlZx5R6XwfifByVqeNf
|
|
||||||
CQY9vQlRa/pNZ23QFmDFc35M6HLI3YwFkSlsJ9BWWuHe+y+/SVg6c85U0Hg4f1nY
|
|
||||||
+a4l7W1BeXlroritweWGZ2kvaAfDYXvjMRFe9v+sOn/eJ585glGHMhcGVAa00AR0
|
|
||||||
5qPHOaz6FURwnlVOXBswTD6c0foLcxPcB/sUqCCB0T1/kxtDZUDHgnNQofeisTYN
|
|
||||||
vpVN/aXAACzkVthvG1E84IQD5mVh69fedNhdYzvyF1Zd54XZC2fr3ZNbL/1vpA+7
|
|
||||||
nl+mf4ZcaGToTwEuovAzdR8eVymu5+yCBmpojWgn+VNzRodmdd7WzCgZeHd8/bib
|
|
||||||
sX0Aiyw0TvQFGVz9iM3QHb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
||||||
=SF+D
|
|
||||||
-----END PGP PUBLIC KEY BLOCK-----
|
|
0
doc/DESCRIPTION.md
Normal file
0
doc/DESCRIPTION.md
Normal file
0
doc/DESCRIPTION_fr.md
Normal file
0
doc/DESCRIPTION_fr.md
Normal file
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/Diaspora_latest.png
Normal file
BIN
doc/screenshots/Diaspora_latest.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 KiB |
|
@ -6,7 +6,7 @@
|
||||||
"en": "Distributed social networking service",
|
"en": "Distributed social networking service",
|
||||||
"fr": "Service de réseau social distribué"
|
"fr": "Service de réseau social distribué"
|
||||||
},
|
},
|
||||||
"version": "0.7.17.0~ynh1",
|
"version": "0.7.18.1~ynh1",
|
||||||
"url": "https://diasporafoundation.org",
|
"url": "https://diasporafoundation.org",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
|
@ -25,8 +25,7 @@
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx"
|
||||||
"postgresql"
|
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install": [
|
"install": [
|
||||||
|
@ -39,9 +38,9 @@
|
||||||
"type": "user"
|
"type": "user"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin_password",
|
"name": "password",
|
||||||
"type": "password",
|
"type": "password",
|
||||||
"ask": {
|
"help": {
|
||||||
"en": "Admin password. Must contain at least 10 characters, one lowercase letter, one uppercase letter, one number, and one symbol (e.g. '~!@#$%^&*()').",
|
"en": "Admin password. Must contain at least 10 characters, one lowercase letter, one uppercase letter, one number, and one symbol (e.g. '~!@#$%^&*()').",
|
||||||
"fr": "Mot de passe pour l’administrateur. Doit contenir au moins 10 caractères, une majuscule, une minuscule, un chiffre, et une ponctuation (ex. '~!@#$%^&*()')."
|
"fr": "Mot de passe pour l’administrateur. Doit contenir au moins 10 caractères, une majuscule, une minuscule, un chiffre, et une ponctuation (ex. '~!@#$%^&*()')."
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,48 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
pkg_dependencies="build-essential cmake libssl-dev libcurl4-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs postgresql bison "
|
|
||||||
ruby_build_dependencies="bison libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libreadline-dev libssl-dev libjemalloc-dev"
|
|
||||||
|
|
||||||
current_tag="v0.7.17.0"
|
#=================================================
|
||||||
|
# COMMON VARIABLES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# dependencies used by the app
|
||||||
|
pkg_dependencies="cmake imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server postgresql"
|
||||||
|
build_pkg_dependencies="libffi-dev libgdbm-dev libncurses5-dev libyaml-dev pkg-config sqlite3 libgmp-dev libssl-dev"
|
||||||
|
|
||||||
|
ruby_version=2.7
|
||||||
|
nodejs_version=14
|
||||||
|
bundler_version=2.1.4
|
||||||
|
|
||||||
|
# Workaround for ruby 2.7 on Bullseye
|
||||||
|
# See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463
|
||||||
|
# Apparently fixed on ruby 3.0.4
|
||||||
|
if [ "$(lsb_release --codename --short)" = "bullseye" ]; then
|
||||||
|
case $YNH_ARCH in
|
||||||
|
amd64)
|
||||||
|
arch="x86_64"
|
||||||
|
;;
|
||||||
|
arm64)
|
||||||
|
arch="aarch64"
|
||||||
|
;;
|
||||||
|
armel|armhf)
|
||||||
|
arch="arm"
|
||||||
|
;;
|
||||||
|
i386)
|
||||||
|
arch="i386"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
ld_preload="LD_PRELOAD=/usr/lib/$arch-linux-gnu/libjemalloc.so"
|
||||||
|
else
|
||||||
|
ld_preload=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PERSONAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# EXPERIMENTAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FUTURE OFFICIAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
|
@ -7,11 +7,16 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
true
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -23,42 +28,44 @@ ynh_print_info --message="Loading installation settings..."
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# clean folder
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
ynh_secure_remove --file="$final_path/backup"
|
|
||||||
mkdir -p $final_path/backup
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP DIASPORA DATABASE
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Backup Diaspora DB..."
|
|
||||||
|
|
||||||
db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|
||||||
dump_file="$final_path/backup/$app.dump"
|
|
||||||
pg_dump -d "dbname=$app user=$app password=$db_pass host=localhost" -Fc -f $dump_file
|
|
||||||
ynh_backup --src_path="$dump_file"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP DIASPORA UPLOADS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ -x $final_path/diaspora/public/uploads ]; then
|
ynh_backup --src_path="$final_path"
|
||||||
ynh_backup --src_path="$final_path/diaspora/public/uploads"
|
|
||||||
else
|
|
||||||
echo "uploads folder does not exist. Skipping."
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP CONF FILES
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path/diaspora/config/database.yml"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
ynh_backup --src_path="$final_path/diaspora/config/diaspora.yml"
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC BACKUP
|
||||||
|
#=================================================
|
||||||
|
# BACKUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/etc/systemd/system/${app}_web.service"
|
||||||
|
ynh_backup --src_path="/etc/systemd/system/${app}_sidekiq.service"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||||
|
|
||||||
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
pushd $final_path/diaspora
|
|
||||||
echo 2.6.6 > .ruby-version # overwrite 2.6 default from diaspora because rbenv does not understand it
|
|
||||||
sudo -u $app --login << EOF
|
|
||||||
gem install bundler:1.17.3
|
|
||||||
cd diaspora
|
|
||||||
script/configure_bundler
|
|
||||||
bin/bundle install --full-index --with=postgresql
|
|
||||||
EOF
|
|
||||||
# for some reason rake logs a lot in stderr (tried --quiet, didn't change anything)
|
|
||||||
# redirecting it to stdout to have a saner log on yunohost side
|
|
||||||
sudo -u $app --login << EOF
|
|
||||||
cd diaspora
|
|
||||||
RAILS_ENV=production bundle exec rake db:migrate 2>&1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ASSETS PRECOMPILATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
sudo -u $app --login << EOF
|
|
||||||
cd diaspora
|
|
||||||
RAILS_ENV=production bin/rake assets:precompile 2>&1
|
|
||||||
EOF
|
|
||||||
popd
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# sidekiq
|
|
||||||
echo $app $final_path
|
|
||||||
install -T --mode=0644 -v ../conf/diaspora_sidekiq.service /etc/systemd/system/${app}_sidekiq.service
|
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/systemd/system/${app}_sidekiq.service
|
|
||||||
ynh_replace_string --match_string=__FINALPATH__ --replace_string=$final_path --target_file=/etc/systemd/system/${app}_sidekiq.service
|
|
||||||
# web
|
|
||||||
install -T --mode=0644 -v ../conf/diaspora_web.service /etc/systemd/system/${app}_web.service
|
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/systemd/system/${app}_web.service
|
|
||||||
ynh_replace_string --match_string=__FINALPATH__ --replace_string=$final_path --target_file=/etc/systemd/system/${app}_web.service
|
|
||||||
# tmp files
|
|
||||||
install -T --mode=0644 -v ../conf/diaspora.tmpfiles.d /etc/tmpfiles.d/${app}.conf
|
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/tmpfiles.d/${app}.conf
|
|
||||||
# target unit
|
|
||||||
install -T --mode=0644 -v ../conf/diaspora.target /etc/systemd/system/${app}.target
|
|
||||||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/systemd/system/${app}.target
|
|
||||||
# reload, create, enable and start stuff
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemd-tmpfiles --create
|
|
||||||
systemctl enable ${app}.target ${app}_sidekiq.service ${app}_web.service
|
|
||||||
systemctl restart ${app}.target
|
|
||||||
ynh_systemd_action --service_name=${app}_web.service \
|
|
||||||
--action=restart\
|
|
||||||
--log_path="$final_path/diaspora/log/production.log" \
|
|
||||||
--line_match="successfully configured the federation library"
|
|
||||||
ynh_systemd_action --service_name=${app}_sidekiq.service \
|
|
||||||
--action=restart\
|
|
||||||
--log_path="systemd" \
|
|
||||||
--line_match="Running in ruby"
|
|
238
scripts/install
238
scripts/install
|
@ -1,16 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# TODO
|
|
||||||
# - which service to register to ynuhosto? diaspora.target only ? All of them ?
|
|
||||||
# - a setting to enable / disable registration
|
|
||||||
# - say something about the registration to https://the-federation.info/
|
|
||||||
# - ...
|
|
||||||
|
|
||||||
## vars for remove script
|
|
||||||
can_remove_db=0
|
|
||||||
can_remove_home=0
|
|
||||||
can_remove_user=0
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -18,15 +7,17 @@ can_remove_user=0
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
|
source ynh_install_ruby__2
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
true
|
||||||
}
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -34,156 +25,185 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
|
path_url="/"
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
admin_email=$(ynh_user_get_info --username=$admin --key=mail)
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
final_path=/var/www/$app
|
|
||||||
|
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
# check path availability
|
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
final_path=/var/www/$app
|
||||||
can_remove_home=1
|
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=/
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Saving app settings..." --weight=1
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=/
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=5
|
ynh_script_progression --message="Installing dependencies..." --weight=5
|
||||||
ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||||
# CHECK DB AVAILABILITY
|
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
|
||||||
#=================================================
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
ynh_script_progression --message="Check DB availability"
|
|
||||||
# now that we have psql for sure, test db existence
|
ynh_package_autoremove
|
||||||
ynh_script_progression --message="Checking DB availability" --weight=1
|
|
||||||
ynh_psql_database_exists --database $app && ynh_die --message="There is already a database: $app"
|
|
||||||
can_remove_db=1
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating user..." --weight=1
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path --use_shell
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
can_remove_user=1
|
|
||||||
mkdir -p $final_path
|
|
||||||
chmod 0750 $final_path -R
|
|
||||||
chown $app:www-data $final_path
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL RVM AND RUBY FOR CURRENT USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing rvm and ruby... (will take a long time)" --weight=20
|
|
||||||
source ./install_ruby
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
||||||
#=================================================
|
|
||||||
# Download, check integrity, unucompress and patch the source from app.src
|
|
||||||
pushd $final_path
|
|
||||||
ynh_script_progression --message="Download the sources..." --weight=10
|
|
||||||
ynh_exec_warn_less sudo -u $app git clone https://github.com/diaspora/diaspora.git -b $current_tag
|
|
||||||
popd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating database..." --weight=1
|
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
|
db_user=$db_name
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_exec_warn_less ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPORT VARIABLES FOR TEMPLATING
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
export app
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
export domain
|
|
||||||
export db_pass
|
|
||||||
export final_path
|
|
||||||
export admin
|
|
||||||
|
|
||||||
#=================================================
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# CONFIGURE DIASPORA
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
#=================================================
|
ynh_setup_source --dest_dir="$final_path/live"
|
||||||
ynh_script_progression --message="Configure diaspora..." --weight=1
|
# create upload folder and link it
|
||||||
ynh_render_template ../conf/diaspora.yml $final_path/diaspora/config/diaspora.yml
|
mkdir $final_path/uploads
|
||||||
ynh_render_template ../conf/database.yml $final_path/diaspora/config/database.yml
|
ln -s $final_path/uploads $final_path/live/
|
||||||
|
|
||||||
#=================================================
|
chmod -R 750 "$final_path"
|
||||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
chown -R $app:www-data "$final_path"
|
||||||
#=================================================
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
|
||||||
ynh_store_file_checksum --file="$final_path/diaspora/config/diaspora.yml"
|
|
||||||
ynh_store_file_checksum --file="$final_path/diaspora/config/database.yml"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Bundle the ruby app
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Precompile assets (will take a long time)..." --weight=40
|
|
||||||
source ./bundle_app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# Create a dedicated nginx config
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
ynh_script_progression --message="configure nginx..." --weight=1
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# Create a dedicated systemd config
|
# ADD A CONFIGURATION
|
||||||
ynh_script_progression --message="configure systemd unit..." --weight=1
|
#=================================================
|
||||||
source ./create_services
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/diaspora.yml" --destination="$final_path/live/config/diaspora.yml"
|
||||||
|
chmod 400 "$final_path/live/config/diaspora.yml"
|
||||||
|
chown $app:$app "$final_path/live/config/diaspora.yml"
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/database.yml" --destination="$final_path/live/config/database.yml"
|
||||||
|
chmod 400 "$final_path/live/config/database.yml"
|
||||||
|
chown $app:$app "$final_path/live/config/database.yml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# BUILD APP
|
||||||
#=================================================
|
#=================================================
|
||||||
yunohost service add $app.target \
|
ynh_script_progression --message="Building app..." --weight=40
|
||||||
--log $final_path/diaspora/log/production.log \
|
|
||||||
$final_path/diaspora/log/unicorn-stderr.log\
|
|
||||||
$final_path/diaspora/log/unicorn-stdout.log\
|
|
||||||
$final_path/diaspora/log/sidekiq.log\
|
|
||||||
--description "Diaspora service (unicorn web and sidekiq)"
|
|
||||||
|
|
||||||
#=================================================
|
pushd $final_path/live
|
||||||
# SETUP SSOWAT
|
ynh_use_ruby
|
||||||
#=================================================
|
ynh_use_nodejs
|
||||||
ynh_permission_update --permission "main" --add visitors
|
ynh_gem install bundler:$bundler_version
|
||||||
|
ynh_exec_as $app $ynh_ruby_load_path $ld_preload script/configure_bundler
|
||||||
#=================================================
|
ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle install --full-index --with=postgresql
|
||||||
# CREATE AN ADMIN
|
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake db:migrate
|
||||||
#=================================================
|
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/rake assets:precompile
|
||||||
ynh_script_progression --message="Create admin..." --weight=1
|
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rails console << END
|
||||||
pushd $final_path/diaspora
|
user = User.build({username: '$admin', email: '$admin_mail', password: '$password', password_confirmation: '$password' })
|
||||||
sudo -u $app /bin/bash --login << EOF
|
|
||||||
RAILS_ENV=production bundle exec rails console << END
|
|
||||||
user = User.build({username: '$admin', email: '$admin_email', password: '$admin_password', password_confirmation: '$admin_password' })
|
|
||||||
user.save
|
user.save
|
||||||
user.seed_aspects
|
user.seed_aspects
|
||||||
Role.add_admin user.person
|
Role.add_admin user.person
|
||||||
END
|
END
|
||||||
EOF
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
|
ynh_add_systemd_config --service="${app}_sidekiq" --template="diaspora_sidekiq.service"
|
||||||
|
ynh_add_systemd_config --service="${app}_web" --template="diaspora_web.service"
|
||||||
|
|
||||||
|
# tmp files
|
||||||
|
install -T --mode=0644 -v ../conf/diaspora.tmpfiles.d /etc/tmpfiles.d/${app}.conf
|
||||||
|
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/tmpfiles.d/${app}.conf
|
||||||
|
|
||||||
|
# target unit
|
||||||
|
install -T --mode=0644 -v ../conf/diaspora.target /etc/systemd/system/${app}.target
|
||||||
|
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/systemd/system/${app}.target
|
||||||
|
|
||||||
|
# reload, create, enable and start stuff
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemd-tmpfiles --create
|
||||||
|
systemctl enable ${app}.target --quiet
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
|
yunohost service add $app.target \
|
||||||
|
--log $final_path/live/log/production.log \
|
||||||
|
$final_path/live/log/unicorn-stderr.log\
|
||||||
|
$final_path/live/log/unicorn-stdout.log\
|
||||||
|
$final_path/live/log/sidekiq.log\
|
||||||
|
--description "Diaspora service (unicorn web and sidekiq)"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
|
systemctl restart ${app}.target
|
||||||
|
ynh_systemd_action --service_name=${app}_web.service --action=restart --log_path="$final_path/live/log/production.log" --line_match="successfully configured the federation library"
|
||||||
|
ynh_systemd_action --service_name=${app}_sidekiq.service --action=restart --log_path="systemd" --line_match="Running in ruby"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# some stuff we don't care about really.
|
|
||||||
# clone ynh_experimental helpers
|
|
||||||
pushd $final_path
|
|
||||||
if [ -x Experimental_helpers ]; then
|
|
||||||
pushd Experimental_helpers
|
|
||||||
ynh_exec_warn_less git fetch
|
|
||||||
popd
|
|
||||||
else
|
|
||||||
ynh_exec_warn_less git clone https://github.com/YunoHost-Apps/Experimental_helpers.git
|
|
||||||
fi
|
|
||||||
pushd Experimental_helpers
|
|
||||||
ynh_exec_warn_less git checkout d05b4db
|
|
||||||
source ./ynh_install_ruby/ynh_install_ruby
|
|
||||||
popd
|
|
||||||
popd
|
|
||||||
ynh_exec_warn_less ynh_install_ruby --ruby_version=2.6.6
|
|
||||||
|
|
103
scripts/remove
103
scripts/remove
|
@ -7,99 +7,94 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
|
source ynh_install_ruby__2
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
can_remove_db=${can_remove_db:=1}
|
|
||||||
can_remove_home=${can_remov_home:=1}
|
|
||||||
can_remove_user=${can_remove_user:=1}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings"
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
db_user=$db_name
|
||||||
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
|
if ynh_exec_warn_less yunohost service status $app.target >/dev/null
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Removing $app.target service integration..." --weight=1
|
||||||
|
yunohost service remove $app.target
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP AND REMOVE SERVICE
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove services"
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||||
yunohost service remove $app.target
|
|
||||||
systemctl stop ${app}.target ${app}_sidekiq.service ${app}_web.service
|
systemctl stop ${app}.target
|
||||||
systemctl disable ${app}.target ${app}_sidekiq.service ${app}_web.service --quiet
|
systemctl disable ${app}.target --quiet
|
||||||
ynh_secure_remove --file="/etc/systemd/system/${app}_web.service"
|
ynh_remove_systemd_config --service="${app}_web"
|
||||||
ynh_secure_remove --file="/etc/systemd/system/${app}_sidekiq.service"
|
ynh_remove_systemd_config --service="${app}_sidekiq"
|
||||||
ynh_secure_remove --file="/etc/tmpfiles.d/${app}.conf"
|
ynh_secure_remove --file="/etc/tmpfiles.d/${app}.conf"
|
||||||
ynh_secure_remove --file="/etc/systemd/system/${app}.target"
|
ynh_secure_remove --file="/etc/systemd/system/${app}.target"
|
||||||
ynh_secure_remove --file="/run/${app}"
|
ynh_secure_remove --file="/run/${app}"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE SERVICE FROM ADMIN PANEL
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if yunohost service status | grep -q $app
|
|
||||||
then
|
|
||||||
echo "Remove $app service"
|
|
||||||
yunohost service remove $app
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE POSTGRESQL DATABASE
|
# REMOVE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ $can_remove_db -eq 1 ]; then
|
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
|
||||||
ynh_script_progression --message="Remove database"
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_psql_remove_db $db_name $db_name
|
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove app dependencies" --weight=10
|
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_app_dependencies
|
# Remove the app directory securely
|
||||||
|
ynh_secure_remove --file="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove nginx config"
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing dependencies..." --weight=10
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_ruby
|
||||||
|
ynh_remove_nodejs
|
||||||
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ $can_remove_user -eq 1 ]; then
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||||
ynh_script_progression --message="Remove $app user"
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
# because we use gpg, sometimes rogue processes (gpg an d dirmngr) stays a bit,
|
ynh_system_user_delete --username=$app
|
||||||
# preventing the deletion of the user. Hence we kill all processes belonging to $app
|
|
||||||
pkill -9 -u `id -u $app`
|
|
||||||
ynh_system_user_delete $app
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE RUBY
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove ruby (if this is the last app using it)"
|
|
||||||
source $final_path/Experimental_helpers/ynh_install_ruby/ynh_install_ruby
|
|
||||||
ynh_remove_ruby
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
if [ $can_remove_home -eq 1 ]; then
|
|
||||||
ynh_script_progression --message="Remove $final_path"
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove "$final_path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
181
scripts/restore
181
scripts/restore
|
@ -1,33 +1,30 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
## vars for remove script
|
|
||||||
can_remove_db=0
|
|
||||||
can_remove_home=0
|
|
||||||
can_remove_user=0
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
|
source ../settings/scripts/ynh_install_ruby__2
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
pushd $(readlink -f ../settings/scripts)
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
true
|
||||||
}
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading settings..."
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -39,106 +36,128 @@ db_user=$db_name
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..."
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||||
|
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
can_remove_home=1
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Reinstall dependencies
|
# STANDARD RESTORATION STEPS
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||||
|
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
|
||||||
# now that we have psql for sure, test db existence
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
ynh_script_progression --message="Checking DB availability" --weight=1
|
|
||||||
ynh_psql_database_exists --database $app && ynh_die --message="There is already a database: $app"
|
|
||||||
can_remove_db=1
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Restoring dedicated USER
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring user..." --weight=1
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path --use_shell
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
can_remove_user=1
|
|
||||||
mkdir -p $final_path
|
|
||||||
chmod 0750 $final_path -R
|
|
||||||
chown $app:www-data $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL RVM AND RUBY FOR CURRENT USER
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling rbenv and ruby..." --weight=10
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||||
|
|
||||||
source ./install_ruby
|
ynh_psql_test_if_first_run
|
||||||
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
|
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# BUILD APP
|
||||||
#=================================================
|
#=================================================
|
||||||
# Download, check integrity, unucompress and patch the source from app.src
|
ynh_script_progression --message="Building app..." --weight=40
|
||||||
pushd $final_path
|
|
||||||
ynh_script_progression --message="Download the sources..." --weight=5
|
pushd $final_path/live
|
||||||
ynh_exec_warn_less sudo -u $app git clone https://github.com/diaspora/diaspora.git -b $current_tag
|
ynh_use_ruby
|
||||||
|
ynh_use_nodejs
|
||||||
|
ynh_gem install bundler:$bundler_version
|
||||||
|
ynh_exec_as $app $ynh_ruby_load_path $ld_preload script/configure_bundler
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
# Restore files
|
ynh_package_autoremove
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restore the files" --weight=5
|
|
||||||
ynh_restore_file --origin_path=/var/www/diaspora/diaspora/config/database.yml
|
|
||||||
ynh_restore_file --origin_path=/var/www/diaspora/diaspora/config/diaspora.yml
|
|
||||||
ynh_restore_file --not_mandatory --origin_path=/var/www/diaspora/diaspora/public/uploads/
|
|
||||||
# restoring somewhere postgres can read
|
|
||||||
ynh_restore_file --origin_path=/var/www/diaspora/backup/diaspora.dump --dest_path=/tmp/diaspora.dump
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Restore database
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreating and restoring database..." --weight=5
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_restore_file --origin_path="/etc/systemd/system/${app}_web.service"
|
||||||
db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
ynh_restore_file --origin_path="/etc/systemd/system/${app}_sidekiq.service"
|
||||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pass
|
|
||||||
ynh_script_progression --message="Restoring database..."
|
# tmp files
|
||||||
sudo -u postgres pg_restore \
|
install -T --mode=0644 -v ../settings/conf/diaspora.tmpfiles.d /etc/tmpfiles.d/${app}.conf
|
||||||
--single-transaction \
|
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/tmpfiles.d/${app}.conf
|
||||||
--dbname=$app \
|
|
||||||
/tmp/diaspora.dump
|
# target unit
|
||||||
ynh_secure_remove --file=/tmp/diaspora.dump
|
install -T --mode=0644 -v ../settings/conf/diaspora.target /etc/systemd/system/${app}.target
|
||||||
|
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/systemd/system/${app}.target
|
||||||
|
|
||||||
|
# reload, create, enable and start stuff
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemd-tmpfiles --create
|
||||||
|
systemctl enable "${app}_web" "${app}_sidekiq" "$app.target" --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Bundle the ruby app
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Precompile assets..." --weight=5
|
|
||||||
source ./bundle_app
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Restore nginx conf files
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreate nginx config from source"
|
|
||||||
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Restore services
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restore services..."
|
|
||||||
|
|
||||||
source ./create_services
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
yunohost service add $app.target \
|
yunohost service add $app.target \
|
||||||
--log $final_path/diaspora/log/production.log \
|
--log $final_path/live/log/production.log \
|
||||||
$final_path/diaspora/log/unicorn-stderr.log\
|
$final_path/live/log/unicorn-stderr.log\
|
||||||
$final_path/diaspora/log/unicorn-stdout.log\
|
$final_path/live/log/unicorn-stdout.log\
|
||||||
$final_path/diaspora/log/sidekiq.log\
|
$final_path/live/log/sidekiq.log\
|
||||||
--description "Diaspora service (unicorn web and sidekiq)"
|
--description "Diaspora service (unicorn web and sidekiq)"
|
||||||
|
|
||||||
popd
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
|
systemctl restart ${app}.target
|
||||||
|
ynh_systemd_action --service_name=${app}_web.service --action=restart --log_path="$final_path/live/log/production.log" --line_match="successfully configured the federation library"
|
||||||
|
ynh_systemd_action --service_name=${app}_sidekiq.service --action=restart --log_path="systemd" --line_match="Running in ruby"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
246
scripts/upgrade
246
scripts/upgrade
|
@ -6,71 +6,79 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
|
source ynh_install_ruby__2
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
admin=$(ynh_app_setting_get --app $app --key admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
db_user=$db_name
|
||||||
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
|
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK VERSION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Checking version..." --weight=1
|
||||||
|
|
||||||
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
# Restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Migrate legacy permissions to new system
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
if ynh_legacy_permissions_exists
|
# STOP SYSTEMD SERVICE
|
||||||
then
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
|
systemctl stop $app.target
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
|
# Cleaning legacy permissions
|
||||||
|
if ynh_legacy_permissions_exists; then
|
||||||
ynh_legacy_permissions_delete_all
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Check upgrade type
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Check upgrade type..."
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Stop services
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stop services..."
|
|
||||||
|
|
||||||
systemctl stop $app.target
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing dependencies..."
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
|
||||||
#=================================================
|
|
||||||
# migrate from rvm to rbenv
|
# migrate from rvm to rbenv
|
||||||
ynh_script_progression --message="Remove rvm..."
|
ynh_script_progression --message="Remove rvm if needed..." --weight=1
|
||||||
if [ -e "$final_path/.rvm" ]; then
|
if [ -e "$final_path/.rvm" ]; then
|
||||||
sudo -u $app --login << EOF
|
sudo -u $app --login << EOF
|
||||||
rvm implode --force
|
rvm implode --force
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
source ./install_ruby
|
|
||||||
# remove old gpg keys for rvm
|
# remove old gpg keys for rvm
|
||||||
ynh_script_progression --message="Remove old rvm keys..."
|
ynh_script_progression --message="Remove old rvm keys..." --weight=1
|
||||||
if gpg --list-keys mpapis@gmail.com >/dev/null 2>&1; then
|
if gpg --list-keys mpapis@gmail.com >/dev/null 2>&1; then
|
||||||
ynh_print_info --message="Found mpapis key: deleting"
|
ynh_print_info --message="Found mpapis key: deleting"
|
||||||
sudo -u $app gpg --delete-keys mpapis@gmail.com
|
sudo -u $app gpg --delete-keys mpapis@gmail.com
|
||||||
|
@ -82,47 +90,157 @@ if gpg --list-keys piotr.kuczynski@gmail.com >/dev/null 2>&1; then
|
||||||
ynh_secure_remove "$final_path/piotr.kuczynski@gmail.com.pgp"
|
ynh_secure_remove "$final_path/piotr.kuczynski@gmail.com.pgp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ];
|
if ! [ -d "$final_path/live" ]; then
|
||||||
then
|
ynh_delete_file_checksum --file="$final_path/diaspora/config/diaspora.yml"
|
||||||
upgrade_message="Upgrading this app and upstream to $current_tag"
|
ynh_delete_file_checksum --file="$final_path/diaspora/config/database.yml"
|
||||||
else
|
mv "$final_path/diaspora" "$final_path/live"
|
||||||
upgrade_message="Shallow upgrade of yunohost app"
|
ynh_store_file_checksum --file="$final_path/live/config/diaspora.yml"
|
||||||
|
ynh_store_file_checksum --file="$final_path/live/config/database.yml"
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
fi
|
fi
|
||||||
ynh_script_progression --message=$upgrade_message
|
|
||||||
|
ynh_secure_remove "$final_path/Experimental_helpers"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
# revert local change to .ruby-version
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
pushd $final_path/diaspora
|
|
||||||
git checkout -- .ruby-version
|
tmpdir="$(mktemp -d)"
|
||||||
git fetch
|
cp "$final_path/live/config/diaspora.yml" "$tmpdir/diaspora.yml"
|
||||||
git checkout $current_tag
|
cp "$final_path/live/config/database.yml" "$tmpdir/database.yml"
|
||||||
popd
|
ynh_secure_remove --file="$final_path/live"
|
||||||
source ./bundle_app
|
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
ynh_setup_source --dest_dir="$final_path/live" --keep="config/diaspora.yml config/database.yml"
|
||||||
|
|
||||||
|
ln -s $final_path/uploads $final_path/live/
|
||||||
|
|
||||||
|
cp "$tmpdir/diaspora.yml" "$final_path/live/config/diaspora.yml"
|
||||||
|
cp "$tmpdir/database.yml" "$final_path/live/config/database.yml"
|
||||||
|
ynh_secure_remove --file="$tmpdir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
chmod 750 "$final_path"
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
chmod -R o-rwx "$final_path"
|
||||||
#=================================================
|
chown -R $app:www-data "$final_path"
|
||||||
yunohost service add $app.target \
|
|
||||||
--log $final_path/diaspora/log/production.log \
|
|
||||||
$final_path/diaspora/log/unicorn-stderr.log\
|
|
||||||
$final_path/diaspora/log/unicorn-stdout.log\
|
|
||||||
$final_path/diaspora/log/sidekiq.log\
|
|
||||||
--description "Diaspora service (unicorn web and sidekiq)"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# restart services
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreate and start services..."
|
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||||
|
|
||||||
source ./create_services
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||||
|
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
|
||||||
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# Create a dedicated nginx config
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||||
ynh_script_progression --message="configure nginx..." --weight=1
|
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
|
#=================================================
|
||||||
|
# UPDATE A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/diaspora.yml" --destination="$final_path/live/config/diaspora.yml"
|
||||||
|
chmod 400 "$final_path/live/config/diaspora.yml"
|
||||||
|
chown $app:$app "$final_path/live/config/diaspora.yml"
|
||||||
|
|
||||||
|
ynh_add_config --template="../conf/database.yml" --destination="$final_path/live/config/database.yml"
|
||||||
|
chmod 400 "$final_path/live/config/database.yml"
|
||||||
|
chown $app:$app "$final_path/live/config/database.yml"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BUILD APP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Building app..." --weight=40
|
||||||
|
|
||||||
|
pushd $final_path/live
|
||||||
|
ynh_use_ruby
|
||||||
|
ynh_use_nodejs
|
||||||
|
ynh_gem install bundler:$bundler_version
|
||||||
|
ynh_exec_as $app $ynh_ruby_load_path $ld_preload script/configure_bundler
|
||||||
|
ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle install --full-index --with=postgresql
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake db:migrate
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/rake assets:precompile
|
||||||
|
popd
|
||||||
|
|
||||||
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
ynh_package_autoremove
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||||
|
|
||||||
|
ynh_add_systemd_config --service="${app}_sidekiq" --template="diaspora_sidekiq.service"
|
||||||
|
ynh_add_systemd_config --service="${app}_web" --template="diaspora_web.service"
|
||||||
|
|
||||||
|
# tmp files
|
||||||
|
install -T --mode=0644 -v ../conf/diaspora.tmpfiles.d /etc/tmpfiles.d/${app}.conf
|
||||||
|
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/tmpfiles.d/${app}.conf
|
||||||
|
|
||||||
|
# target unit
|
||||||
|
install -T --mode=0644 -v ../conf/diaspora.target /etc/systemd/system/${app}.target
|
||||||
|
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/systemd/system/${app}.target
|
||||||
|
|
||||||
|
# reload, create, enable and start stuff
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemd-tmpfiles --create
|
||||||
|
systemctl enable ${app}.target --quiet
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||||
|
|
||||||
|
yunohost service add $app.target \
|
||||||
|
--log $final_path/live/log/production.log \
|
||||||
|
$final_path/live/log/unicorn-stderr.log\
|
||||||
|
$final_path/live/log/unicorn-stdout.log\
|
||||||
|
$final_path/live/log/sidekiq.log\
|
||||||
|
--description "Diaspora service (unicorn web and sidekiq)"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
|
systemctl restart ${app}.target
|
||||||
|
ynh_systemd_action --service_name=${app}_web.service --action=restart --log_path="$final_path/live/log/production.log" --line_match="successfully configured the federation library"
|
||||||
|
ynh_systemd_action --service_name=${app}_sidekiq.service --action=restart --log_path="systemd" --line_match="Running in ruby"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||||
|
|
310
scripts/ynh_install_ruby__2
Normal file
310
scripts/ynh_install_ruby__2
Normal file
|
@ -0,0 +1,310 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ynh_ruby_try_bash_extension() {
|
||||||
|
if [ -x src/configure ]; then
|
||||||
|
src/configure && make -C src || {
|
||||||
|
ynh_print_info --message="Optional bash extension failed to build, but things will still work normally."
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
rbenv_install_dir="/opt/rbenv"
|
||||||
|
ruby_version_path="$rbenv_install_dir/versions"
|
||||||
|
# RBENV_ROOT is the directory of rbenv, it needs to be loaded as a environment variable.
|
||||||
|
export RBENV_ROOT="$rbenv_install_dir"
|
||||||
|
export rbenv_root="$rbenv_install_dir"
|
||||||
|
|
||||||
|
ruby_dependencies=""
|
||||||
|
build_ruby_dependencies="libjemalloc-dev curl build-essential libreadline-dev zlib1g-dev libsqlite3-dev libssl-dev libxml2-dev libxslt-dev autoconf automake bison libtool"
|
||||||
|
pkg_dependencies="$pkg_dependencies $ruby_dependencies"
|
||||||
|
build_pkg_dependencies="$build_pkg_dependencies $build_ruby_dependencies"
|
||||||
|
|
||||||
|
# Load the version of Ruby for an app, and set variables.
|
||||||
|
#
|
||||||
|
# ynh_use_ruby has to be used in any app scripts before using Ruby for the first time.
|
||||||
|
# This helper will provide alias and variables to use in your scripts.
|
||||||
|
#
|
||||||
|
# To use gem or Ruby, use the alias `ynh_gem` and `ynh_ruby`
|
||||||
|
# Those alias will use the correct version installed for the app
|
||||||
|
# For example: use `ynh_gem install` instead of `gem install`
|
||||||
|
#
|
||||||
|
# With `sudo` or `ynh_exec_as`, use instead the fallback variables `$ynh_gem` and `$ynh_ruby`
|
||||||
|
# And propagate $PATH to sudo with $ynh_ruby_load_path
|
||||||
|
# Exemple: `ynh_exec_as $app $ynh_ruby_load_path $ynh_gem install`
|
||||||
|
#
|
||||||
|
# $PATH contains the path of the requested version of Ruby.
|
||||||
|
# However, $PATH is duplicated into $ruby_path to outlast any manipulation of $PATH
|
||||||
|
# You can use the variable `$ynh_ruby_load_path` to quickly load your Ruby version
|
||||||
|
# in $PATH for an usage into a separate script.
|
||||||
|
# Exemple: $ynh_ruby_load_path $final_path/script_that_use_gem.sh`
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Finally, to start a Ruby service with the correct version, 2 solutions
|
||||||
|
# Either the app is dependent of Ruby or gem, but does not called it directly.
|
||||||
|
# In such situation, you need to load PATH
|
||||||
|
# `Environment="__YNH_RUBY_LOAD_PATH__"`
|
||||||
|
# `ExecStart=__FINALPATH__/my_app`
|
||||||
|
# You will replace __YNH_RUBY_LOAD_PATH__ with $ynh_ruby_load_path
|
||||||
|
#
|
||||||
|
# Or Ruby start the app directly, then you don't need to load the PATH variable
|
||||||
|
# `ExecStart=__YNH_RUBY__ my_app run`
|
||||||
|
# You will replace __YNH_RUBY__ with $ynh_ruby
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# one other variable is also available
|
||||||
|
# - $ruby_path: The absolute path to Ruby binaries for the chosen version.
|
||||||
|
#
|
||||||
|
# usage: ynh_use_ruby
|
||||||
|
#
|
||||||
|
# Requires YunoHost version 3.2.2 or higher.
|
||||||
|
ynh_use_ruby () {
|
||||||
|
ruby_version=$(ynh_app_setting_get --app=$app --key=ruby_version)
|
||||||
|
|
||||||
|
# Get the absolute path of this version of Ruby
|
||||||
|
ruby_path="$ruby_version_path/$YNH_APP_INSTANCE_NAME/bin"
|
||||||
|
|
||||||
|
# Allow alias to be used into bash script
|
||||||
|
shopt -s expand_aliases
|
||||||
|
|
||||||
|
# Create an alias for the specific version of Ruby and a variable as fallback
|
||||||
|
ynh_ruby="$ruby_path/ruby"
|
||||||
|
alias ynh_ruby="$ynh_ruby"
|
||||||
|
# And gem
|
||||||
|
ynh_gem="$ruby_path/gem"
|
||||||
|
alias ynh_gem="$ynh_gem"
|
||||||
|
|
||||||
|
# Load the path of this version of Ruby in $PATH
|
||||||
|
if [[ :$PATH: != *":$ruby_path"* ]]; then
|
||||||
|
PATH="$ruby_path:$PATH"
|
||||||
|
fi
|
||||||
|
# Create an alias to easily load the PATH
|
||||||
|
ynh_ruby_load_path="PATH=$PATH"
|
||||||
|
|
||||||
|
# Sets the local application-specific Ruby version
|
||||||
|
pushd $final_path
|
||||||
|
$rbenv_install_dir/bin/rbenv local $ruby_version
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install a specific version of Ruby
|
||||||
|
#
|
||||||
|
# ynh_install_ruby will install the version of Ruby provided as argument by using rbenv.
|
||||||
|
#
|
||||||
|
# This helper creates a /etc/profile.d/rbenv.sh that configures PATH environment for rbenv
|
||||||
|
# for every LOGIN user, hence your user must have a defined shell (as opposed to /usr/sbin/nologin)
|
||||||
|
#
|
||||||
|
# Don't forget to execute ruby-dependent command in a login environment
|
||||||
|
# (e.g. sudo --login option)
|
||||||
|
# When not possible (e.g. in systemd service definition), please use direct path
|
||||||
|
# to rbenv shims (e.g. $RBENV_ROOT/shims/bundle)
|
||||||
|
#
|
||||||
|
# usage: ynh_install_ruby --ruby_version=ruby_version
|
||||||
|
# | arg: -v, --ruby_version= - Version of ruby to install.
|
||||||
|
#
|
||||||
|
# Requires YunoHost version 3.2.2 or higher.
|
||||||
|
ynh_install_ruby () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=v
|
||||||
|
local -A args_array=( [v]=ruby_version= )
|
||||||
|
local ruby_version
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
# Load rbenv path in PATH
|
||||||
|
local CLEAR_PATH="$rbenv_install_dir/bin:$PATH"
|
||||||
|
|
||||||
|
# Remove /usr/local/bin in PATH in case of Ruby prior installation
|
||||||
|
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
|
||||||
|
|
||||||
|
# Move an existing Ruby binary, to avoid to block rbenv
|
||||||
|
test -x /usr/bin/ruby && mv /usr/bin/ruby /usr/bin/ruby_rbenv
|
||||||
|
|
||||||
|
# Install or update rbenv
|
||||||
|
rbenv="$(command -v rbenv $rbenv_install_dir/bin/rbenv | grep "$rbenv_install_dir/bin/rbenv" | head -1)"
|
||||||
|
if [ -n "$rbenv" ]; then
|
||||||
|
ynh_print_info --message="rbenv already seems installed in \`$rbenv'."
|
||||||
|
pushd "${rbenv%/*/*}"
|
||||||
|
if git remote -v 2>/dev/null | grep "https://github.com/rbenv/rbenv.git"; then
|
||||||
|
ynh_print_info --message="Trying to update with git..."
|
||||||
|
git pull -q --tags origin master
|
||||||
|
ynh_ruby_try_bash_extension
|
||||||
|
else
|
||||||
|
ynh_print_info --message="Reinstalling rbenv with git..."
|
||||||
|
cd ..
|
||||||
|
ynh_secure_remove --file=$rbenv_install_dir
|
||||||
|
mkdir -p $rbenv_install_dir
|
||||||
|
cd $rbenv_install_dir
|
||||||
|
git init -q
|
||||||
|
git remote add -f -t master origin https://github.com/rbenv/rbenv.git > /dev/null 2>&1
|
||||||
|
git checkout -q -b master origin/master
|
||||||
|
ynh_ruby_try_bash_extension
|
||||||
|
rbenv=$rbenv_install_dir/bin/rbenv
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
else
|
||||||
|
ynh_print_info --message="Installing rbenv with git..."
|
||||||
|
mkdir -p $rbenv_install_dir
|
||||||
|
pushd $rbenv_install_dir
|
||||||
|
git init -q
|
||||||
|
git remote add -f -t master origin https://github.com/rbenv/rbenv.git > /dev/null 2>&1
|
||||||
|
git checkout -q -b master origin/master
|
||||||
|
ynh_ruby_try_bash_extension
|
||||||
|
rbenv=$rbenv_install_dir/bin/rbenv
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
ruby_build="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-install rbenv-install | head -1)"
|
||||||
|
if [ -n "$ruby_build" ]; then
|
||||||
|
ynh_print_info --message="\`rbenv install' command already available in \`$ruby_build'."
|
||||||
|
pushd "${ruby_build%/*/*}"
|
||||||
|
if git remote -v 2>/dev/null | grep "https://github.com/rbenv/ruby-build.git"; then
|
||||||
|
ynh_print_info --message="Trying to update rbenv with git..."
|
||||||
|
git pull -q origin master
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
else
|
||||||
|
ynh_print_info --message="Installing ruby-build with git..."
|
||||||
|
mkdir -p "${rbenv_install_dir}/plugins"
|
||||||
|
git clone -q https://github.com/rbenv/ruby-build.git "${rbenv_install_dir}/plugins/ruby-build"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rbenv_alias="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-alias rbenv-alias | head -1)"
|
||||||
|
if [ -n "$rbenv_alias" ]; then
|
||||||
|
ynh_print_info --message="\`rbenv alias' command already available in \`$rbenv_alias'."
|
||||||
|
pushd "${rbenv_alias%/*/*}"
|
||||||
|
if git remote -v 2>/dev/null | grep "https://github.com/tpope/rbenv-aliases.git"; then
|
||||||
|
ynh_print_info --message="Trying to update rbenv-aliases with git..."
|
||||||
|
git pull -q origin master
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
else
|
||||||
|
ynh_print_info --message="Installing rbenv-aliases with git..."
|
||||||
|
mkdir -p "${rbenv_install_dir}/plugins"
|
||||||
|
git clone -q https://github.com/tpope/rbenv-aliases.git "${rbenv_install_dir}/plugins/rbenv-aliase"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rbenv_latest="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-latest rbenv-latest | head -1)"
|
||||||
|
if [ -n "$rbenv_latest" ]; then
|
||||||
|
ynh_print_info --message="\`rbenv latest' command already available in \`$rbenv_latest'."
|
||||||
|
pushd "${rbenv_latest%/*/*}"
|
||||||
|
if git remote -v 2>/dev/null | grep "https://github.com/momo-lab/xxenv-latest.git"; then
|
||||||
|
ynh_print_info --message="Trying to update xxenv-latest with git..."
|
||||||
|
git pull -q origin master
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
else
|
||||||
|
ynh_print_info --message="Installing xxenv-latest with git..."
|
||||||
|
mkdir -p "${rbenv_install_dir}/plugins"
|
||||||
|
git clone -q https://github.com/momo-lab/xxenv-latest.git "${rbenv_install_dir}/plugins/xxenv-latest"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable caching
|
||||||
|
mkdir -p "${rbenv_install_dir}/cache"
|
||||||
|
|
||||||
|
# Create shims directory if needed
|
||||||
|
mkdir -p "${rbenv_install_dir}/shims"
|
||||||
|
|
||||||
|
# Restore /usr/local/bin in PATH
|
||||||
|
PATH=$CLEAR_PATH
|
||||||
|
|
||||||
|
# And replace the old Ruby binary
|
||||||
|
test -x /usr/bin/ruby_rbenv && mv /usr/bin/ruby_rbenv /usr/bin/ruby
|
||||||
|
|
||||||
|
# Install the requested version of Ruby
|
||||||
|
local final_ruby_version=$(rbenv latest --print $ruby_version)
|
||||||
|
if ! [ -n "$final_ruby_version" ]; then
|
||||||
|
final_ruby_version=$ruby_version
|
||||||
|
fi
|
||||||
|
ynh_print_info --message="Installing Ruby-$final_ruby_version"
|
||||||
|
CONFIGURE_OPTS="--disable-install-doc --with-jemalloc" MAKE_OPTS="-j2" rbenv install --skip-existing $final_ruby_version > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Store ruby_version into the config of this app
|
||||||
|
ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=ruby_version --value=$final_ruby_version
|
||||||
|
|
||||||
|
# Remove app virtualenv
|
||||||
|
if `rbenv alias --list | grep --quiet "$YNH_APP_INSTANCE_NAME " 1>/dev/null 2>&1`
|
||||||
|
then
|
||||||
|
rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create app virtualenv
|
||||||
|
rbenv alias $YNH_APP_INSTANCE_NAME $final_ruby_version
|
||||||
|
|
||||||
|
# Cleanup Ruby versions
|
||||||
|
ynh_cleanup_ruby
|
||||||
|
|
||||||
|
# Set environment for Ruby users
|
||||||
|
echo "#rbenv
|
||||||
|
export RBENV_ROOT=$rbenv_install_dir
|
||||||
|
export PATH=\"$rbenv_install_dir/bin:$PATH\"
|
||||||
|
eval \"\$(rbenv init -)\"
|
||||||
|
#rbenv" > /etc/profile.d/rbenv.sh
|
||||||
|
|
||||||
|
# Load the environment
|
||||||
|
eval "$(rbenv init -)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove the version of Ruby used by the app.
|
||||||
|
#
|
||||||
|
# This helper will also cleanup Ruby versions
|
||||||
|
#
|
||||||
|
# usage: ynh_remove_ruby
|
||||||
|
ynh_remove_ruby () {
|
||||||
|
local ruby_version=$(ynh_app_setting_get --app=$YNH_APP_INSTANCE_NAME --key=ruby_version)
|
||||||
|
|
||||||
|
# Load rbenv path in PATH
|
||||||
|
local CLEAR_PATH="$rbenv_install_dir/bin:$PATH"
|
||||||
|
|
||||||
|
# Remove /usr/local/bin in PATH in case of Ruby prior installation
|
||||||
|
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
|
||||||
|
|
||||||
|
rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
||||||
|
|
||||||
|
# Remove the line for this app
|
||||||
|
ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=ruby_version
|
||||||
|
|
||||||
|
# Cleanup Ruby versions
|
||||||
|
ynh_cleanup_ruby
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove no more needed versions of Ruby used by the app.
|
||||||
|
#
|
||||||
|
# This helper will check what Ruby version are no more required,
|
||||||
|
# and uninstall them
|
||||||
|
# If no app uses Ruby, rbenv will be also removed.
|
||||||
|
#
|
||||||
|
# usage: ynh_cleanup_ruby
|
||||||
|
ynh_cleanup_ruby () {
|
||||||
|
|
||||||
|
# List required Ruby versions
|
||||||
|
local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$')
|
||||||
|
local required_ruby_versions=""
|
||||||
|
for installed_app in $installed_apps
|
||||||
|
do
|
||||||
|
local installed_app_ruby_version=$(ynh_app_setting_get --app=$installed_app --key="ruby_version")
|
||||||
|
if [[ $installed_app_ruby_version ]]
|
||||||
|
then
|
||||||
|
required_ruby_versions="${installed_app_ruby_version}\n${required_ruby_versions}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove no more needed Ruby versions
|
||||||
|
local installed_ruby_versions=$(rbenv versions --bare --skip-aliases | grep -Ev '/')
|
||||||
|
for installed_ruby_version in $installed_ruby_versions
|
||||||
|
do
|
||||||
|
if ! `echo ${required_ruby_versions} | grep "${installed_ruby_version}" 1>/dev/null 2>&1`
|
||||||
|
then
|
||||||
|
ynh_print_info --message="Removing of Ruby-$installed_ruby_version"
|
||||||
|
$rbenv_install_dir/bin/rbenv uninstall --force $installed_ruby_version
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# If none Ruby version is required
|
||||||
|
if [[ ! $required_ruby_versions ]]
|
||||||
|
then
|
||||||
|
# Remove rbenv environment configuration
|
||||||
|
ynh_print_info --message="Removing of rbenv-$rbenv_version"
|
||||||
|
ynh_secure_remove --file="$rbenv_install_dir"
|
||||||
|
ynh_secure_remove --file="/etc/profile.d/rbenv.sh"
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in a new issue