Browse Source

Read rails_environment from diaspora config

master
Benjamin Neff 7 years ago
parent
commit
f60dc395b4
No account linked to committer's email address
3 changed files with 8 additions and 5 deletions
  1. +0
    -1
      diaspora/defaults.yaml
  2. +5
    -4
      diaspora/install.sls
  3. +3
    -0
      diaspora/map.jinja

+ 0
- 1
diaspora/defaults.yaml View File

diaspora: diaspora:
repository: git://github.com/diaspora/diaspora.git repository: git://github.com/diaspora/diaspora.git
version: master version: master
environment: production
install_path: /srv/diaspora install_path: /srv/diaspora


ruby_version: 2.3.4 ruby_version: 2.3.4

+ 5
- 4
diaspora/install.sls View File

{%- from "diaspora/map.jinja" import diaspora with context %} {%- from "diaspora/map.jinja" import diaspora with context %}
{%- set environment = diaspora.configuration.server.rails_environment %}


include: include:
- diaspora.config - diaspora.config
- cwd: {{ diaspora.install_path }} - cwd: {{ diaspora.install_path }}
- unless: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/bundle check - unless: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/bundle check
- env: - env:
- RAILS_ENV: {{ diaspora.environment }}
- RAILS_ENV: {{ environment }}
- require: - require:
- git: diaspora_git - git: diaspora_git


- cwd: {{ diaspora.install_path }} - cwd: {{ diaspora.install_path }}
- onlyif: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/rails runner "ActiveRecord::Base.connection" |& grep "database \"{{ diaspora.database.database }}\" does not exist (ActiveRecord::NoDatabaseError)" - onlyif: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/rails runner "ActiveRecord::Base.connection" |& grep "database \"{{ diaspora.database.database }}\" does not exist (ActiveRecord::NoDatabaseError)"
- env: - env:
- RAILS_ENV: {{ diaspora.environment }}
- RAILS_ENV: {{ environment }}
- require: - require:
- cmd: diaspora_bundle_install - cmd: diaspora_bundle_install
- file: {{ diaspora.install_path }}/config/database.yml - file: {{ diaspora.install_path }}/config/database.yml
- cwd: {{ diaspora.install_path }} - cwd: {{ diaspora.install_path }}
- onlyif: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/rake db:migrate:status | grep -oE "^\s+down" - onlyif: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/rake db:migrate:status | grep -oE "^\s+down"
- env: - env:
- RAILS_ENV: {{ diaspora.environment }}
- RAILS_ENV: {{ environment }}
- require: - require:
- cmd: diaspora_create_database - cmd: diaspora_create_database
- onchanges: - onchanges:
- runas: diaspora - runas: diaspora
- cwd: {{ diaspora.install_path }} - cwd: {{ diaspora.install_path }}
- env: - env:
- RAILS_ENV: {{ diaspora.environment }}
- RAILS_ENV: {{ environment }}
- require: - require:
- cmd: diaspora_migrate_database - cmd: diaspora_migrate_database
- onchanges: - onchanges:

+ 3
- 0
diaspora/map.jinja View File



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


# use production as default rails environment
{% do defaults.diaspora.configuration.update({'server': {'rails_environment': 'production'}}) %}

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

Loading…
Cancel
Save