Parcourir la source

Initial commit (installation until git clone)

tags/v1.0.0
Benjamin Neff il y a 7 ans
révision
deaa8e181b
Aucun compte lié à l'adresse e-mail de l'auteur
7 fichiers modifiés avec 225 ajouts et 0 suppressions
  1. +13
    -0
      LICENSE
  2. +25
    -0
      README.md
  3. +18
    -0
      diaspora/defaults.yaml
  4. +4
    -0
      diaspora/init.sls
  5. +81
    -0
      diaspora/install.sls
  6. +64
    -0
      diaspora/map.jinja
  7. +20
    -0
      pillar.example

+ 13
- 0
LICENSE Voir le fichier

@@ -0,0 +1,13 @@
Copyright (c) 2017 Benjamin Neff

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

+ 25
- 0
README.md Voir le fichier

@@ -0,0 +1,25 @@
# diaspora-formula

A saltstack formula to install and configure the distributed social network, [diaspora*](https://diasporafoundation.org/).

> Note: See the full [Salt Formulas installation and usage instructions](http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html).
>
> This formula only manages diaspora. You are responsible for installing/configuring PostgreSQL or MariaDB as appropriate.

## Available states

### `diaspora`

Install, configure and run diaspora as a service.

### `diaspora.install`

Installs diaspora from github.

### `diaspora.config`

Configures diaspora.

### `diaspora.service`

Creates a service for diaspora and runs it.

+ 18
- 0
diaspora/defaults.yaml Voir le fichier

@@ -0,0 +1,18 @@
diaspora:
repository: git://github.com/diaspora/diaspora.git
version: master
install_path: /srv/diaspora

ruby_version: 2.3.4

install_redis: True

user:
username: diaspora

database:
type: postgresql
host: localhost
username: diaspora
password:
database: diaspora

+ 4
- 0
diaspora/init.sls Voir le fichier

@@ -0,0 +1,4 @@
include:
- diaspora.install
# - diaspora.config
# - diaspora.service

+ 81
- 0
diaspora/install.sls Voir le fichier

@@ -0,0 +1,81 @@
{%- from "diaspora/map.jinja" import diaspora with context %}

diaspora_dependencies:
pkg.installed:
- pkgs: {{ diaspora.dependencies|json }}
- require:
- pkg: diaspora_database_dependency

diaspora_database_dependency:
pkg.installed:
{%- if diaspora.database.type == "mysql" %}
- name: {{ diaspora.mysql_package }}
{%- else %}
- name: {{ diaspora.postgresql_package }}
{%- endif %}

{%- if diaspora.install_redis %}
redis_package:
pkg.installed:
- name: {{ diaspora.redis_package }}
{%- endif %}

diaspora_user:
user.present:
- name: {{ diaspora.user.username }}
{%- if 'shell' in diaspora.user %}
- shell: {{ diaspora.user.shell }}
{%- endif %}
{%- if 'home' in diaspora.user %}
- home: {{ diaspora.user.home }}
{%- endif %}

diaspora_rvm_gpg_key:
cmd.run:
- name: gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
- unless: gpg --list-keys 409B6B1796C275462A1703113804BB82D39DC0E3
- runas: {{ diaspora.user.username }}
- require:
- user: diaspora_user

diaspora_rvm_ruby:
rvm.installed:
- name: ruby-{{ diaspora.ruby_version }}
- user: {{ diaspora.user.username }}
- default: True
- require:
- pkg: diaspora_dependencies
- cmd: diaspora_rvm_gpg_key

diaspora_rvm_gemset:
rvm.gemset_present:
- name: diaspora
- ruby: ruby-{{ diaspora.ruby_version }}
- user: {{ diaspora.user.username }}
- require:
- rvm: diaspora_rvm_ruby

diaspora_install_bundler:
gem.installed:
- name: bundler
- user: {{ diaspora.user.username }}
- ruby: ruby-{{ diaspora.ruby_version }}@diaspora
- require:
- rvm: diaspora_rvm_gemset

diaspora_install_directory:
file.directory:
- name: {{ diaspora.install_path }}
- user: {{ diaspora.user.username }}
- mode: 755
- require:
- user: diaspora_user

diaspora_git:
git.latest:
- name: {{ diaspora.repository }}
- rev: {{ diaspora.version }}
- target: {{ diaspora.install_path }}
- user: {{ diaspora.user.username }}
- require:
- file: diaspora_install_directory

+ 64
- 0
diaspora/map.jinja Voir le fichier

@@ -0,0 +1,64 @@
{% set os_map = salt['grains.filter_by']({
'Debian': {
'dependencies' : [
'build-essential',
'git',
'curl',
'libcurl4-openssl-dev',
'libssl-dev',
'libxml2-dev',
'libxslt1-dev',
'imagemagick',
'libmagickwand-dev',
'ghostscript',
'nodejs',
],
'postgresql_package': 'libpq-dev',
'mysql_package' : 'libmariadbclient-dev',
'redis_package' : 'redis-server',
'redis_service' : 'redis-server',
},
'RedHat': {
'dependencies' : [
'tar',
'make',
'automake',
'gcc',
'gcc-c++',
'git',
'net-tools',
'libcurl-devel',
'libxml2-devel',
'libffi-devel',
'libxslt-devel',
'wget',
'ImageMagick',
'nodejs',
],
'postgresql_package': 'postgresql-devel',
'mysql_package' : 'mariadb-devel',
'redis_package' : 'redis',
'redis_service' : 'redis',
},
}, merge=salt['grains.filter_by']({
'Ubuntu': {
'dependencies' : [
'build-essential',
'git',
'curl',
'libcurl4-openssl-dev',
'libxml2-dev',
'libxslt1-dev',
'libgmp-dev',
'imagemagick',
'libmagickwand-dev',
'nodejs',
],
},
}, grain='os', merge=salt['pillar.get']('diaspora:lookup'))) %}

{% import_yaml "diaspora/defaults.yaml" as defaults %}

{% do defaults.diaspora.update(os_map) %}

{% set diaspora = salt['pillar.get']('diaspora', default=defaults.diaspora, merge=True) %}

+ 20
- 0
pillar.example Voir le fichier

@@ -0,0 +1,20 @@
diaspora:
repository: git://github.com/diaspora/diaspora.git

# version can be a branch or a tag
version: develop

install_path: /srv/diaspora

ruby_version: 2.3.4

user:
username: diaspora
shell: /bin/zsh

database:
type: postgresql
host: localhost
username: diaspora
password: secret
database: diaspora

Chargement…
Annuler
Enregistrer