浏览代码

Generate config files

master
Benjamin Neff 7 年前
父节点
当前提交
777cc78fad
没有帐户链接到提交者的电子邮件
共有 8 个文件被更改,包括 118 次插入1 次删除
  1. +4
    -0
      README.md
  2. +19
    -0
      diaspora/config.sls
  3. +54
    -0
      diaspora/files/database.yml
  4. +17
    -0
      diaspora/files/diaspora.yml
  5. +1
    -1
      diaspora/init.sls
  6. +5
    -0
      diaspora/install.sls
  7. +10
    -0
      diaspora/map.jinja
  8. +8
    -0
      pillar.example

+ 4
- 0
README.md 查看文件

@@ -16,6 +16,8 @@ Install, configure and run diaspora as a service.

Installs diaspora from github.

(Includes `diaspora.config`)

### `diaspora.config`

Configures diaspora.
@@ -23,3 +25,5 @@ Configures diaspora.
### `diaspora.service`

Creates a service for diaspora and runs it.

(Includes `diaspora.install` and `diaspora.config`)

+ 19
- 0
diaspora/config.sls 查看文件

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

{{ diaspora.install_path }}/config/database.yml:
file.managed:
- user: {{ diaspora.user.username }}
- mode: 600
- source: salt://diaspora/files/database.yml
- template: jinja
- context:
database: {{ diaspora.database|json }}

{{ diaspora.install_path }}/config/diaspora.yml:
file.managed:
- user: {{ diaspora.user.username }}
- mode: 600
- source: salt://diaspora/files/diaspora.yml
- template: jinja
- context:
configuration: {{ diaspora.configuration|json }}

+ 54
- 0
diaspora/files/database.yml 查看文件

@@ -0,0 +1,54 @@
#
# This file is managed by Salt! Do not edit by hand!
#

postgresql: &postgresql
adapter: postgresql
host: {{ database.host }}
port: {{ pillar.get("diaspora:database:port", 5432) }}
username: {{ database.username }}
password: "{{ database.password }}"
encoding: unicode

mysql: &mysql
adapter: mysql2
host: {{ database.host }}
port: {{ pillar.get("diaspora:database:port", 3306) }}
username: {{ database.username }}
password: "{{ database.password }}"
# socket: /tmp/mysql.sock
encoding: utf8mb4
collation: utf8mb4_bin


# Comment the postgresql line and uncomment the mysql line
# if you want to use mysql
common: &common
<<: *{{ database.type }}

# Should match environment.sidekiq.concurrency
#pool: 25

##################################################
#### CONFIGURE ABOVE #############################
##################################################

# Normally you don't need to touch anything here

combined: &combined
<<: *common
development:
<<: *combined
database: {{ database.database }}
production:
<<: *combined
database: {{ database.database }}
test:
<<: *combined
database: "diaspora_test"
integration1:
<<: *combined
database: diaspora_integration1
integration2:
<<: *combined
database: diaspora_integration2

+ 17
- 0
diaspora/files/diaspora.yml 查看文件

@@ -0,0 +1,17 @@
#
# This file is managed by Salt! Do not edit by hand!
#

# have a look at https://github.com/diaspora/diaspora/blob/develop/config/diaspora.yml.example

configuration:
{{ configuration|yaml(false)|indent(2) }}

## Here you can override settings defined above if you need
## to have them different in different environments.
production: ## Section
environment: ## Section

development: ## Section
environment: ## Section


+ 1
- 1
diaspora/init.sls 查看文件

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

+ 5
- 0
diaspora/install.sls 查看文件

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

include:
- diaspora.config

diaspora_dependencies:
pkg.installed:
- pkgs: {{ diaspora.dependencies|json }}
@@ -79,6 +82,8 @@ diaspora_git:
- user: {{ diaspora.user.username }}
- require:
- file: diaspora_install_directory
- require_in:
- file: {{ diaspora.install_path }}/config/database.yml

diaspora_rvm_ruby_version_alias:
cmd.run:

+ 10
- 0
diaspora/map.jinja 查看文件

@@ -17,6 +17,11 @@
'mysql_package' : 'libmariadbclient-dev',
'redis_package' : 'redis-server',
'redis_service' : 'redis-server',
'configuration' : {
'environment': {
'certificate_authorities': '/etc/ssl/certs/ca-certificates.crt'
}
},
},
'RedHat': {
'dependencies' : [
@@ -39,6 +44,11 @@
'mysql_package' : 'mariadb-devel',
'redis_package' : 'redis',
'redis_service' : 'redis',
'configuration' : {
'environment': {
'certificate_authorities': '/etc/pki/tls/certs/ca-bundle.crt'
}
},
},
}, merge=salt['grains.filter_by']({
'Ubuntu': {

+ 8
- 0
pillar.example 查看文件

@@ -13,8 +13,16 @@ diaspora:
shell: /bin/zsh

database:
# type needs to be 'postgresql' or 'mysql'
type: postgresql
host: localhost
username: diaspora
password: secret
database: diaspora

# have a look at https://github.com/diaspora/diaspora/blob/develop/config/diaspora.yml.example
configuration:
environment:
url: "https://example.org/"
settings:
pod_name: "example diaspora* pod"

正在加载...
取消
保存