mirror of
https://github.com/YunoHost-Apps/diaspora_ynh.git
synced 2024-09-03 18:26:13 +02:00
init
no code test yet
This commit is contained in:
parent
d474559dd6
commit
7878c4d99e
10 changed files with 949 additions and 17 deletions
17
.gitattributes
vendored
17
.gitattributes
vendored
|
@ -1,17 +0,0 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
diaspora_ynh
|
||||
==========
|
||||
|
||||
Diaspora integration for YunoHost
|
||||
|
||||
There are not yet active SSO/LDAP integration.
|
||||
Install can take a very long time !!
|
54
conf/database.yml
Normal file
54
conf/database.yml
Normal file
|
@ -0,0 +1,54 @@
|
|||
mysql: &mysql
|
||||
adapter: mysql2
|
||||
host: "localhost"
|
||||
port: 3306
|
||||
username: "DBUSERTOCHANGE"
|
||||
password: "DBPASSTOCHANGE"
|
||||
# socket: /tmp/mysql.sock
|
||||
charset: utf8
|
||||
collation: utf8_bin
|
||||
|
||||
postgres: &postgres
|
||||
adapter: postgresql
|
||||
host: localhost
|
||||
port: 5432
|
||||
username: postgres
|
||||
password:
|
||||
encoding: unicode
|
||||
|
||||
# Comment the the mysql line and uncomment the postgres line
|
||||
# if you want to use postgres
|
||||
common: &common
|
||||
# Choose one of the following
|
||||
<<: *mysql
|
||||
#<<: *postgres
|
||||
|
||||
# Should match environment.sidekiq.concurrency
|
||||
#pool: 25
|
||||
|
||||
##################################################
|
||||
#### CONFIGURE ABOVE #############################
|
||||
##################################################
|
||||
|
||||
# Normally you don't need to touch anything here
|
||||
|
||||
postgres_travis: &postgres_travis
|
||||
adapter: postgresql
|
||||
username: postgres
|
||||
combined: &combined
|
||||
<<: *common
|
||||
development:
|
||||
<<: *combined
|
||||
database: diaspora_development
|
||||
production:
|
||||
<<: *combined
|
||||
database: diaspora_production
|
||||
test:
|
||||
<<: *combined
|
||||
database: "diaspora_test"
|
||||
integration1:
|
||||
<<: *combined
|
||||
database: diaspora_integration1
|
||||
integration2:
|
||||
<<: *combined
|
||||
database: diaspora_integration2
|
217
conf/diaspora
Normal file
217
conf/diaspora
Normal file
|
@ -0,0 +1,217 @@
|
|||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: diaspora
|
||||
# Required-Start: $remote_fs $syslog mysql redis-server
|
||||
# Required-Stop: $remote_fs $syslog mysql redis-server
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Diaspora application server
|
||||
# Description: Start / stop the Diaspora app server
|
||||
### END INIT INFO
|
||||
|
||||
# Author: FABIAN Tamas Laszlo <giganetom@gmail.com>
|
||||
# Updated: Pirate Praveen <praveen@debian.org>
|
||||
|
||||
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||
# Note: /usr/local/bin for foreman gem
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||
DESC="Diaspora application server"
|
||||
NAME=diaspora
|
||||
DIASPORA_HOME="/var/www/diaspora"
|
||||
|
||||
STARTSCRIPT="./script/server"
|
||||
|
||||
LOGFILE=$DIASPORA_HOME/log/startscript.log
|
||||
SCRIPTNAME=$0
|
||||
USER=diaspora
|
||||
STARTUP_TIMEOUT=100
|
||||
|
||||
. /lib/init/vars.sh
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
check_unicorn() {
|
||||
pgrep -f "unicorn_rails master"
|
||||
}
|
||||
|
||||
check_sidekiq() {
|
||||
pgrep -f "sidekiq 2"
|
||||
}
|
||||
|
||||
check_foreman() {
|
||||
pgrep -f "foreman-runner"
|
||||
}
|
||||
|
||||
check_foreman_start() {
|
||||
pgrep -f "foreman start"
|
||||
}
|
||||
|
||||
check_script_server() {
|
||||
pgrep -f "script/server"
|
||||
}
|
||||
|
||||
do_start()
|
||||
{
|
||||
if ! touch $LOGFILE; then
|
||||
log_failure_msg "Could not touch logfile"
|
||||
return 2
|
||||
fi
|
||||
|
||||
if ! chown $USER $LOGFILE; then
|
||||
log_failure_msg "Could not chown logfile"
|
||||
return 2
|
||||
fi
|
||||
|
||||
if check_unicorn && check_sidekiq; then
|
||||
log_warning_msg "Diaspora is already running"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if check_foreman || check_foreman_start || check_script_server; then
|
||||
log_warning_msg "Diaspora is starting"
|
||||
return 1
|
||||
fi
|
||||
|
||||
. /etc/diaspora.conf
|
||||
cd $DIASPORA_HOME
|
||||
sudo su - $USER -c " . ~/.bashrc && cd $DIASPORA_HOME && $STARTSCRIPT >> $LOGFILE 2>&1 " &
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
log_failure_msg "Could not run start script"
|
||||
return 2
|
||||
else
|
||||
log_success_msg "Starting diaspora server..."
|
||||
return 0
|
||||
fi
|
||||
|
||||
[ "$VERBOSE" != no ] && log_action_msg "Waiting for Diaspora processes... "
|
||||
c=0
|
||||
while ! check_unicorn > /dev/null || ! check_sidekiq > /dev/null; do
|
||||
if [ $c -gt $STARTUP_TIMEOUT ]; then
|
||||
log_failure_msg "Timeout waiting for Diaspora processes"
|
||||
return 2
|
||||
fi
|
||||
c=`expr $c + 1`
|
||||
sleep 1
|
||||
[ "$VERBOSE" != no ] && echo -n "."
|
||||
done
|
||||
[ "$VERBOSE" != no ] && log_action_end_msg 0
|
||||
}
|
||||
|
||||
do_stop()
|
||||
{
|
||||
for i in `check_unicorn`; do
|
||||
[ "$VERBOSE" != no ] && log_action_msg "Killing unicorn master with PID $i"
|
||||
kill -TERM $i
|
||||
[ "$VERBOSE" != no ] && log_action_end_msg $?
|
||||
done
|
||||
|
||||
for i in `check_sidekiq`; do
|
||||
[ "$VERBOSE" != no ] && log_action_msg "Killing sidekiq with PID $i"
|
||||
kill -TERM $i
|
||||
[ "$VERBOSE" != no ] && log_action_end_msg $?
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
*) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
status)
|
||||
log_daemon_msg 'Checking for running Diaspora processes'
|
||||
|
||||
if ! check_unicorn
|
||||
then
|
||||
log_action_msg "unicorn not found"
|
||||
unicorn_running=false
|
||||
else
|
||||
for i in `check_unicorn`; do
|
||||
log_action_msg "Found unicorn master with PID $i"
|
||||
unicorn_running=true
|
||||
done
|
||||
fi
|
||||
|
||||
if ! check_foreman
|
||||
then
|
||||
log_action_msg "foreman not found"
|
||||
foreman_running=false
|
||||
else
|
||||
for i in `check_foreman`; do
|
||||
log_action_msg "Found foreman with pid $i"
|
||||
foreman_running=true
|
||||
done
|
||||
fi
|
||||
|
||||
if ! check_sidekiq
|
||||
then
|
||||
log_action_msg "sidekiq is not found"
|
||||
sidekiq_running=false
|
||||
else
|
||||
for i in `check_sidekiq`; do
|
||||
log_action_msg "Found sidekiq with PID $i"
|
||||
sidekiq_running=true
|
||||
done
|
||||
fi
|
||||
|
||||
if $foreman_running && ! $unicorn_running; then
|
||||
log_action_msg "Diaspora is starting, check after some time..."
|
||||
log_end_msg 0
|
||||
return 0
|
||||
fi
|
||||
if $unicorn_running && $sidekiq_running; then
|
||||
log_action_msg "Diaspora health is OK"
|
||||
log_end_msg 0
|
||||
else
|
||||
if $unicorn_running; then
|
||||
log_failure_msg "Unicorn is RUNNING, but sidekiq is DOWN!"
|
||||
log_end_msg 1
|
||||
return 1
|
||||
fi
|
||||
if $sidekiq_running; then
|
||||
log_failure_msg "Sidekiq is RUNNING, but unicorn is DOWN!"
|
||||
log_end_msg 1
|
||||
return 1
|
||||
fi
|
||||
log_daemon_msg "All Diaspora processes are DOWN"
|
||||
log_end_msg 0
|
||||
fi
|
||||
;;
|
||||
restart|force-reload)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1)
|
||||
do_start
|
||||
case "$?" in
|
||||
0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
1) [ "$VERBOSE" != no ] && log_failure_msg "old process is still running" && log_end_msg 1 ;;
|
||||
*) [ "$VERBOSE" != no ] && log_failure_msg "failed to start" && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
[ "$VERBOSE" != no ] && log_failure_msg "failed to stop"
|
||||
[ "$VERBOSE" != no ] && log_end_msg 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
4
conf/diaspora.conf
Normal file
4
conf/diaspora.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
export SERVERNAME=localhost
|
||||
export ENVIRONMENT_URL=http://localhost
|
||||
export RAILS_ENV=production
|
||||
export DB=mysql
|
442
conf/diaspora.yml
Normal file
442
conf/diaspora.yml
Normal file
|
@ -0,0 +1,442 @@
|
|||
## Some notes about this file:
|
||||
## - All comments start with a double #
|
||||
## - All settings are commented out with a single #
|
||||
## To change the default settings, you need both to uncomment the lines
|
||||
## AND, in most cases, to change the value that is given.
|
||||
## - Take care to keep proper indentation, that is by simply deleting
|
||||
## the original #, with no additional space before the setting's name.
|
||||
## - Take care to keep proper quoting. All ' must have a matching ' at
|
||||
## the end of the same line. The same goes for "
|
||||
## - Lines containing "## Section" are section headings. Do not edit them!
|
||||
## - Lists need the space after the -
|
||||
## - The values true, false and numbers should have no quote marks.
|
||||
## Single words don't need quote marks, but it doesn't do any harm to have them.
|
||||
##
|
||||
## You can set and/or override all these settings through environment variables
|
||||
## with the following conversion rules:
|
||||
## - Strip the top level namespace (configuration, production, etc.)
|
||||
## - Build the path to the setting, for example environment.s3.enable
|
||||
## - Replace the dots with underscores: environment_s3_enable
|
||||
## - Convert to upper case: ENVIRONMENT_S3_ENABLE
|
||||
## - Specify lists/arrays as comma-separated values
|
||||
##
|
||||
## - For example, on Heroku:
|
||||
## heroku config:set SERVICES_FACEBOOK_APP_ID=yourappid SERVICES_FACEBOOK_SECRET=yourappsecret
|
||||
|
||||
configuration: ## Section
|
||||
|
||||
## You need to change or at least review the settings in this section
|
||||
## in order for your pod to work
|
||||
environment: ## Section
|
||||
|
||||
## Set the hostname of the machine you're running Diaspora on, as seen
|
||||
## from the internet. This should be the URL you want to use to
|
||||
## access the pod. So if you plan to use a reverse proxy, it should be
|
||||
## the URL the proxy listens on. DO NOT CHANGE THIS AFTER INITIAL SETUP!
|
||||
## 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
|
||||
## will be hardcoded into the database.
|
||||
url: "FULLURLTOCHANGE"
|
||||
|
||||
## Set the bundle of certificate authorities (CA) certificates.
|
||||
## This is specific to your operating system.
|
||||
## Examples (uncomment the relevant one or add your own):
|
||||
## For Debian, Ubuntu, Archlinux, Gentoo (package ca-certificates):
|
||||
certificate_authorities: '/etc/ssl/certs/ca-certificates.crt'
|
||||
## For CentOS, Fedora:
|
||||
#certificate_authorities: '/etc/pki/tls/certs/ca-bundle.crt'
|
||||
|
||||
## URL for a remote Redis (default=localhost)
|
||||
## Don't forget to restrict IP access if you uncomment these!
|
||||
#redis: 'redis://example_host'
|
||||
#redis: 'redis://username:password@host:6379/0'
|
||||
#redis: 'unix:///tmp/redis.sock'
|
||||
|
||||
## Require SSL (default=true)
|
||||
## When set, your pod will force the use of HTTPS in production mode. Since
|
||||
## OAuth2 requires SSL Diaspora's future API might not work if you're not using
|
||||
## SSL. Also there is no guarantee that posting to services will be possible
|
||||
## if SSL is disabled. Do not change this default unless you are sure!
|
||||
require_ssl: false
|
||||
|
||||
## Single-process mode (default=false)
|
||||
## If set to true Diaspora will work with just the appserver (Unicorn by default)
|
||||
## running. However, this makes it quite slow as intensive jobs must be run
|
||||
## all the time inside the request cycle. We strongly recommended you leave
|
||||
## this disabled for production setups. Set to true to enable.
|
||||
#single_process_mode: false
|
||||
|
||||
## Sidekiq - background processing
|
||||
sidekiq: ## Section
|
||||
|
||||
## Number of parallel threads Sidekiq uses (default=5)
|
||||
## If you touch this please set the pool setting in your database.yml to
|
||||
## a value that's at minimum close to this! You can safely increase it
|
||||
## to 25 and more on a medium-sized pod. This applies per started Sidekiq
|
||||
## worker, so if you set it to 25 and start two workers you'll process
|
||||
## up to 50 jobs in parallel.
|
||||
#concurrency: 5
|
||||
|
||||
## Number of times a job is retried (default=10)
|
||||
## There's an exponential effect to this: if you set this too high you
|
||||
## might get too many jobs building up in the queue.
|
||||
## Set it to false to disable it completely.
|
||||
#retry: 10
|
||||
|
||||
## Namespace to use in Redis. Useful if you need to run
|
||||
## multiple instances of Diaspora using the same Redis instance.
|
||||
#namespace: "diaspora"
|
||||
|
||||
## Lines of backtrace that are stored on failure (default=15)
|
||||
## Set n to the required value. Set this to false to reduce memory
|
||||
## usage (and log size) if you're not interested in this data.
|
||||
#backtrace: 15
|
||||
|
||||
## Log file for Sidekiq (default="log/sidekiq.log")
|
||||
#log: "log/sidekiq.log"
|
||||
|
||||
## Use Amazon S3 instead of your local filesystem
|
||||
## to handle uploaded pictures (disabled by default)
|
||||
s3: ## Section
|
||||
|
||||
#enable: true
|
||||
#key: 'change_me'
|
||||
#secret: 'change_me'
|
||||
#bucket: 'my_photos'
|
||||
#region: 'us-east-1'
|
||||
|
||||
## Use max-age header on Amazon S3 resources (default=true)
|
||||
## When true, this allows locally cached images to be served for up to
|
||||
## 1 year. This can improve load speed and save requests to the image host.
|
||||
## Set to false to revert to browser defaults (usually less than 1 year).
|
||||
#cache : true
|
||||
|
||||
## Set redirect URL for an external image host (Amazon S3 or other)
|
||||
## If hosting images for your pod on an external server (even your own),
|
||||
## add its URL here. All requests made to images under /uploads/images
|
||||
## will be redirected to https://yourhost.tld/uploads/images/
|
||||
#image_redirect_url: 'https://images.example.org'
|
||||
|
||||
assets: ## Section
|
||||
|
||||
## Serve static assets via the appserver (default=false)
|
||||
## This is highly discouraged for production use. Let your reverse
|
||||
## proxy/webserver do it by serving the files under public/ directly.
|
||||
#serve: false
|
||||
|
||||
## Upload your assets to S3 (default=false)
|
||||
#upload: false
|
||||
|
||||
## Specify an asset host. Ensure it does not have a trailing slash (/).
|
||||
#host: http://cdn.example.org/diaspora
|
||||
|
||||
## Pubsub server (default='https://pubsubhubbub.appspot.com/')
|
||||
## Diaspora is only tested against the default pubsub server.
|
||||
## You probably don't want to uncomment or change this.
|
||||
#pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||
|
||||
## Settings affecting how ./script/server behaves.
|
||||
server: ## Section
|
||||
|
||||
## The port on which the appserver should listen (default=3000):
|
||||
#port: 3000
|
||||
|
||||
## Rails environment (default='development')
|
||||
## The environment in which the server should be started by default.
|
||||
## Change this if you wish to run a production environment.
|
||||
rails_environment: 'production'
|
||||
|
||||
## Write unicorn stderr and stdout log
|
||||
#stderr_log: '/usr/local/app/diaspora/log/unicorn-stderr.log'
|
||||
#stdout_log: '/usr/local/app/diaspora/log/unicorn-stdout.log'
|
||||
|
||||
## Number of Unicorn worker processes (default=2)
|
||||
## Increase this if you have many users.
|
||||
#unicorn_worker: 2
|
||||
|
||||
## Number of seconds before a request is aborted (default=90)
|
||||
## Increase if you get empty responses, or if large image uploads fail.
|
||||
## Decrease if you're under heavy load and don't care if some
|
||||
## requests fail.
|
||||
#unicorn_timeout: 90
|
||||
|
||||
## Embed a Sidekiq worker inside the unicorn process (default=false)
|
||||
## Useful for minimal Heroku setups.
|
||||
#embed_sidekiq_worker: false
|
||||
|
||||
## Number of Sidekiq worker processes (default=1)
|
||||
## In most cases it is better to
|
||||
## increase environment.sidekiq.concurrency instead!
|
||||
#sidekiq_workers: 1
|
||||
|
||||
## Settings potentially affecting the privacy of your users
|
||||
privacy: ## Section
|
||||
|
||||
## Include jQuery from jquery.com's CDN (default=true)
|
||||
## This can save you some traffic and speeds up load time since most
|
||||
## clients already have this one cached. Set this to false if you want
|
||||
## the jQuery library to be loaded from your pod's own resources.
|
||||
#jquery_cdn: true
|
||||
|
||||
## Google Analytics (disabled by default)
|
||||
## Provide a key to enable tracking by Google Analytics
|
||||
#google_analytics_key:
|
||||
|
||||
## Piwik Tracking (disabled by default)
|
||||
## Provide a site ID and the host piwik is running on to enable
|
||||
## tracking through Piwik.
|
||||
piwik: ## Section
|
||||
|
||||
#enable: true
|
||||
#host: 'stats.example.org'
|
||||
#site_id: 1
|
||||
|
||||
## Mixpanel event tracking (disabled by default)
|
||||
#mixpanel_uid:
|
||||
|
||||
## Chartbeat tracking (disabled by default)
|
||||
#chartbeat_uid:
|
||||
|
||||
## Statistics
|
||||
## Your pod will report its name, software version and whether
|
||||
## or not registrations are open via /statistics.json.
|
||||
## Uncomment the options below to enable more statistics.
|
||||
statistics: ## Section
|
||||
|
||||
## Local user total and 6 month active counts
|
||||
#user_counts: true
|
||||
|
||||
## Local post total count
|
||||
#post_counts: true
|
||||
#comment_counts: true
|
||||
|
||||
## General settings
|
||||
settings: ## Section
|
||||
|
||||
## Pod name (default="diaspora*")
|
||||
## The pod name displayed in various locations, including the header.
|
||||
#pod_name: "diaspora*"
|
||||
|
||||
## Allow registrations (default=true)
|
||||
## Set this to false to prevent people from signing up for your pod
|
||||
## without an invitation. Note that this needs to be set to true
|
||||
## (or commented out) to enable the first registration (you).
|
||||
#enable_registrations: true
|
||||
|
||||
## Auto-follow on sign-up (default=true)
|
||||
## Users will automatically follow a specified account on creation.
|
||||
## Set this to false if you don't want your users to automatically
|
||||
## follow an account upon creation.
|
||||
#autofollow_on_join: true
|
||||
|
||||
## Auto-follow account (default='diasporahq@joindiaspora.com')
|
||||
## The diaspora* HQ account keeps users up to date with news about Diaspora.
|
||||
## If you set another auto-follow account (for example your podmin account),
|
||||
## please consider resharing diaspora* HQ's posts for your pod's users!
|
||||
#autofollow_on_join_user: 'diasporahq@joindiaspora.com'
|
||||
|
||||
## Invitation settings
|
||||
invitations: ## Section
|
||||
|
||||
## Enable invitations (default=true)
|
||||
## Set this to false if you don't want users to be able to send invites.
|
||||
#open: true
|
||||
|
||||
## Number of invitations per invite link (default=25)
|
||||
## Every user will see such a link if you have enabled invitations on your pod.
|
||||
#count: 25
|
||||
|
||||
## Paypal donations
|
||||
## You can provide the ID of a hosted Paypal button here to allow your users
|
||||
## to send donations to help run their pod. If you leave this out your users
|
||||
## will see a button to donate to the Diaspora Foundation instead :)
|
||||
#paypal_hosted_button_id: "change_me"
|
||||
|
||||
## Bitcoin donations
|
||||
## You can provide a bitcoin address here to allow your users to provide
|
||||
## donations towards the running of their pod.
|
||||
#bitcoin_address: "change_me"
|
||||
|
||||
## Community spotlight (disabled by default)
|
||||
## The community spotlight shows new users public posts from people you
|
||||
## think are interesting in Diaspora's community. To add an account
|
||||
## to the community spotlight add the 'spotlight' role to it.
|
||||
community_spotlight: ## Section
|
||||
|
||||
#enable: true
|
||||
|
||||
## E-mail address to which users can make suggestions about who
|
||||
## should be in the community spotlight (optional).
|
||||
#suggest_email: 'admin@example.org'
|
||||
|
||||
## CURL debug (default=false)
|
||||
## Turn on extra verbose output when sending stuff. Note: you
|
||||
## don't need to touch this unless explicitly told to.
|
||||
#typhoeus_verbose: false
|
||||
|
||||
## Maximum number of parallel HTTP requests made to other pods (default=20)
|
||||
## Be careful, raising this setting will heavily increase the memory usage
|
||||
## of your Sidekiq workers.
|
||||
#typhoeus_concurrency: 20
|
||||
|
||||
## Captcha settings
|
||||
captcha: ## Section
|
||||
|
||||
## Enable captcha (default=true)
|
||||
## Set this to false if you don't want to use captcha for signup process.
|
||||
#enable: true
|
||||
|
||||
## Captcha image size (default='120x20')
|
||||
#image_size: '120x20'
|
||||
|
||||
## Length of captcha text (default=5)
|
||||
#captcha_length: 5
|
||||
|
||||
## Captcha image style (default='simply_green')
|
||||
## Available options for captcha image styles are: 'simply_blue',
|
||||
## 'simply_red' 'simply_green', 'charcoal_grey', 'embossed_silver',
|
||||
## 'all_black', 'distorted_black', 'almost_invisible', 'random'
|
||||
#image_style: 'simply_green'
|
||||
|
||||
## Captcha image distortion (default='low')
|
||||
## Sets the level of image distortion used in the captcha.
|
||||
## Available options are: 'low', 'medium', 'high', 'random'
|
||||
#distortion: 'low'
|
||||
|
||||
## Terms of Service
|
||||
## Show a default or customized terms of service for users.
|
||||
## You can create a custom Terms of Service by placing a template
|
||||
## as app/views/terms/terms.haml or app/views/terms/terms.erb
|
||||
## The default terms of service that can be extended is
|
||||
## at app/views/terms/default.haml
|
||||
## NOTE! The default terms have not been checked over by a lawyer and
|
||||
## thus are unlikely to provide full legal protection for all situations
|
||||
## for a podmin using them. They are also not specific to all countries
|
||||
## and jurisdictions. If you are unsure, please check with a lawyer.
|
||||
## We provide these for podmins as some basic rules that podmins
|
||||
## can communicate to users easily via the diaspora* server software.
|
||||
## Uncomment to enable this feature.
|
||||
terms: ## Section
|
||||
# First enable it by uncommenting
|
||||
#enable: true
|
||||
## Important! If you enable the terms, you should always
|
||||
## set a location under which laws any disputes are governed
|
||||
## under. For example, country or state/country, depending
|
||||
## on the country in question.
|
||||
## If this is not set, the whole paragraph about governing
|
||||
## laws *is not shown* in the terms page.
|
||||
#jurisdiction: ""
|
||||
## Age limit for signups
|
||||
## Set a number to activate this setting. This age limit is shown
|
||||
## in the default ToS document.
|
||||
#minimum_age: false
|
||||
|
||||
## Posting from Diaspora to external services (all are disabled by default)
|
||||
services: ## Section
|
||||
|
||||
## OAuth credentials for Facebook:
|
||||
facebook: ## Section
|
||||
|
||||
#enable: true
|
||||
#app_id: 'abcdef'
|
||||
#secret: 'change_me'
|
||||
|
||||
## OAuth credentials for Twitter:
|
||||
twitter: ## Section
|
||||
|
||||
#enable: true
|
||||
#key: 'abcdef'
|
||||
#secret: 'change_me'
|
||||
|
||||
## OAuth credentials for Tumblr
|
||||
tumblr: ## Section
|
||||
|
||||
#enable: true
|
||||
#key: 'abcdef'
|
||||
#secret: 'change_me'
|
||||
|
||||
## OAuth credentials for Wordpress
|
||||
wordpress: ## Section
|
||||
|
||||
#enable: true
|
||||
#client_id: 'abcdef'
|
||||
#secret: 'change_me'
|
||||
|
||||
## Enable pod users to send e-mails from Diaspora (disabled by default)
|
||||
mail: ## Section
|
||||
|
||||
## First you need to enable it.
|
||||
#enable: true
|
||||
|
||||
## Sender address used in mail sent by Diaspora
|
||||
#sender_address: 'no-reply@example.org'
|
||||
|
||||
## This selects which mailer should be used. Use 'smtp' for a smtp
|
||||
## connection, 'sendmail' to use the sendmail binary or
|
||||
## 'messagebus' to use the messagebus service.
|
||||
#method: 'smtp'
|
||||
|
||||
## Ignore if method isn't 'smtp'
|
||||
smtp: ## Section
|
||||
|
||||
## Host and port of the smtp server handling outgoing mail.
|
||||
## This should match the common name of the certificate sent by
|
||||
## the SMTP server, if it sends one. (default port=587)
|
||||
#host: 'smtp.example.org'
|
||||
#port: 587
|
||||
|
||||
## Authentication required to send mail (default='plain')
|
||||
## Use one of 'plain', 'login' or 'cram_md5'. Use 'none'
|
||||
## if server does not support authentication.
|
||||
#authentication: 'plain'
|
||||
|
||||
## Credentials to log in to the SMTP server
|
||||
## May be necessary if authentication is not 'none'.
|
||||
#username: 'change_me'
|
||||
#password: 'change_me'
|
||||
|
||||
## Automatically enable TLS (default=true)
|
||||
## Leave this commented out if authentication is set to 'none'.
|
||||
#starttls_auto: true
|
||||
|
||||
## The domain for the HELO command, if needed
|
||||
#domain: 'smtp.example.org'
|
||||
|
||||
## OpenSSL verify mode used when connecting to a SMTP server with TLS
|
||||
## Set this to 'none' if you have a self-signed certificate. Possible
|
||||
## values: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert'.
|
||||
#openssl_verify_mode: 'none'
|
||||
|
||||
## Ignore if method isn't 'sendmail'
|
||||
sendmail: ## Section
|
||||
|
||||
## The path to the sendmail binary (default='/usr/sbin/sendmail')
|
||||
#location: '/usr/sbin/sendmail'
|
||||
|
||||
## Use exim and sendmail (default=false)
|
||||
#exim_fix: false
|
||||
|
||||
## Ignore if method isn't 'messagebus'
|
||||
#message_bus_api_key: 'abcdef'
|
||||
|
||||
## Administrator settings
|
||||
admins: ## Section
|
||||
|
||||
## Set the admin account
|
||||
## 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
|
||||
## systems. Set only the username, NOT the full ID.
|
||||
#account: "podmaster"
|
||||
|
||||
## E-mail address to contact the administrator
|
||||
#podmin_email: 'podmin@example.org'
|
||||
|
||||
## Here you can override settings defined above if you need
|
||||
## to have them different in different environments.
|
||||
production: ## Section
|
||||
environment: ## Section
|
||||
#redis_url: 'redis://production.example.org:6379'
|
||||
|
||||
development: ## Section
|
||||
environment: ## Section
|
||||
#redis_url: 'redis://production.example.org:6379'
|
30
conf/nginx.conf
Normal file
30
conf/nginx.conf
Normal file
|
@ -0,0 +1,30 @@
|
|||
location PATHTOCHANGE {
|
||||
alias ALIASTOCHANGE/public;
|
||||
|
||||
# Configure maximum picture size
|
||||
# Note that Diaspora has a client side check set at 4M
|
||||
client_max_body_size 5M;
|
||||
client_body_buffer_size 256K;
|
||||
|
||||
# Proxy if requested file not found
|
||||
try_files $uri @diaspora;
|
||||
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_pass http://diaspora_server;
|
||||
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
||||
# Proxy destination
|
||||
# Add as many server directives as you want
|
||||
# Also takes a socket, like unix:/path/to/some/socket.sock
|
||||
upstream diaspora_server {
|
||||
server 127.0.0.1:3000;
|
||||
}
|
49
manifest.json
Normal file
49
manifest.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "Diaspora",
|
||||
"id": "diaspora",
|
||||
"description": {
|
||||
"en": "Distributed social networking service",
|
||||
"fr": "Service de réseau social distribué"
|
||||
},
|
||||
"developer": {
|
||||
"name": "aymhce",
|
||||
"email": "aymhce@gmail.com",
|
||||
"url": "http://diasporafoundation.org"
|
||||
},
|
||||
"multi_instance": "true",
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for Diaspora"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for Diaspora"
|
||||
},
|
||||
"example": "/diaspora",
|
||||
"default": "/diaspora"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"ask": {
|
||||
"en": "Choose the Diaspora administrator (must be an existing YunoHost user)"
|
||||
},
|
||||
"example": "homer"
|
||||
},
|
||||
{
|
||||
"name": "public_site",
|
||||
"ask": {
|
||||
"en": "Is it a public Diaspora site ?",
|
||||
"fr": "Est-ce un site public ?"
|
||||
},
|
||||
"choices": ["Yes", "No"],
|
||||
"default": "Yes"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
124
scripts/install
Normal file
124
scripts/install
Normal file
|
@ -0,0 +1,124 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$1
|
||||
path=$2
|
||||
user=$3
|
||||
is_public=$4
|
||||
|
||||
# Check user parameter
|
||||
sudo yunohost user list --json | grep -q "\"username\": \"$user\""
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
echo "Wrong user"
|
||||
exit 1
|
||||
fi
|
||||
sudo yunohost app setting diaspora admin_user -v $user
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a diaspora
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ori_path=$(pwd)
|
||||
final_path=/var/www/diaspora
|
||||
full_url=https://$domain$path
|
||||
|
||||
# configure sys apt-get
|
||||
|
||||
cat /etc/apt/sources.list | grep -q backports
|
||||
[ $? != 0 ] && sudo su -c "echo 'deb http://http.debian.net/debian wheezy-backports main' >> /etc/apt/sources.list"
|
||||
|
||||
# get sys deps
|
||||
sudo apt-get update
|
||||
sudo apt-get install gawk libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake bison libffi-dev\
|
||||
build-essential libssl-dev libcurl4-openssl-dev libxml2-dev libxslt-dev imagemagick ghostscript git curl libmysqlclient-dev\
|
||||
libmagickwand-dev nodejs-legacy npm -y
|
||||
sudo apt-get install -t wheezy-backports redis-server -y
|
||||
|
||||
# get source code
|
||||
git clone -b master git://github.com/diaspora/diaspora.git
|
||||
mv diaspora $final_path
|
||||
sudo chown -R diaspora:diaspora $final_path
|
||||
|
||||
# Generate random password
|
||||
|
||||
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||
|
||||
# Use 'diaspora' as database name and user
|
||||
db_user=diaspora
|
||||
|
||||
# Initialize database and store mysql password for upgrade
|
||||
sudo yunohost app initdb $db_user -p $db_pwd -d diaspora_production
|
||||
sudo yunohost app setting diaspora mysqlpwd -v $db_pwd
|
||||
|
||||
# prepare and copy diaspora config file
|
||||
sed -i "s@FULLURLTOCHANGE@$full_url@g" ../conf/diaspora.yml
|
||||
sed -i "s@DBUSERTOCHANGE@$db_user@g" ../conf/database.yml
|
||||
sed -i "s@DBPASSTOCHANGE@$db_user@g" ../conf/database.yml
|
||||
sudo cp ../conf/diaspora.yml $final_path/config/
|
||||
sudo cp ../conf/database.yml $final_path/config/
|
||||
sudo cp ../conf/diaspora.conf /etc/
|
||||
sudo chown -R diaspora:diaspora $final_path
|
||||
|
||||
# install startup script
|
||||
sudo cp ../conf/diaspora /etc/init.d/diaspora
|
||||
sudo chmod 754 /etc/init.d/diaspora
|
||||
sudo update-rc.d diaspora defaults
|
||||
|
||||
# create and config user
|
||||
sudo adduser --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --quiet --disabled-login --home /home/yunohost.app/diaspora diaspora
|
||||
sudo mkdir -p /home/yunohost.app/diaspora
|
||||
sudo chown -R diaspora:diaspora /home/yunohost.app/diaspora
|
||||
|
||||
sudo su diaspora
|
||||
cd ~
|
||||
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
|
||||
|
||||
# Config RVM
|
||||
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
|
||||
curl -L dspr.tk/1t | bash
|
||||
. ~/.bashrc
|
||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
||||
rvm install 2.0
|
||||
|
||||
cd $final_path
|
||||
|
||||
# force get app deps (for debug)
|
||||
gem install nokogiri -v '1.6.1'
|
||||
gem install raindrops -v '0.13.0'
|
||||
|
||||
# construct diaspora app
|
||||
RAILS_ENV=production bundle install --without test development
|
||||
RAILS_ENV=production bundle exec rake db:create db:schema:load
|
||||
RAILS_ENV=production bundle exec rake assets:precompile
|
||||
|
||||
# TODO a startup init.d script !!
|
||||
#./script/server >/dev/null &
|
||||
|
||||
exit
|
||||
|
||||
cd $ori_path
|
||||
|
||||
# start service
|
||||
sudo service diaspora start
|
||||
|
||||
# config nginx
|
||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/diaspora.conf
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
|
||||
sudo service nginx reload
|
||||
sudo yunohost app setting diaspora skipped_uris -v "/"
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
#protect URIs
|
||||
|
||||
if [ $is_public = "No" ];
|
||||
then
|
||||
sudo yunohost app setting diaspora protected_uris -v "/"
|
||||
sudo yunohost app ssowatconf
|
||||
fi
|
||||
|
22
scripts/remove
Normal file
22
scripts/remove
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
db_user=diaspora
|
||||
db_name=diaspora
|
||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||
domain=$(sudo yunohost app setting diaspora domain)
|
||||
|
||||
sudo service diaspora stop
|
||||
|
||||
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
||||
|
||||
sudo rm -rf /var/www/diaspora
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/diaspora.conf
|
||||
|
||||
sudo service nginx reload
|
||||
|
||||
sudo deluser --remove-home diaspora
|
||||
|
||||
sudo update-rc.d -f diaspora remove
|
||||
sudo rm -f /etc/init.d/diaspora
|
||||
sudo rm -f /etc/diaspora.conf
|
||||
|
Loading…
Reference in a new issue