Browse Source

Read rails_environment from diaspora config

tags/v1.0.0
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

@@ -1,7 +1,6 @@
diaspora:
repository: git://github.com/diaspora/diaspora.git
version: master
environment: production
install_path: /srv/diaspora

ruby_version: 2.3.4

+ 5
- 4
diaspora/install.sls View File

@@ -1,4 +1,5 @@
{%- from "diaspora/map.jinja" import diaspora with context %}
{%- set environment = diaspora.configuration.server.rails_environment %}

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

@@ -115,7 +116,7 @@ diaspora_create_database:
- 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)"
- env:
- RAILS_ENV: {{ diaspora.environment }}
- RAILS_ENV: {{ environment }}
- require:
- cmd: diaspora_bundle_install
- file: {{ diaspora.install_path }}/config/database.yml
@@ -130,7 +131,7 @@ diaspora_migrate_database:
- cwd: {{ diaspora.install_path }}
- onlyif: rvm ruby-{{ diaspora.ruby_version }}@diaspora do bin/rake db:migrate:status | grep -oE "^\s+down"
- env:
- RAILS_ENV: {{ diaspora.environment }}
- RAILS_ENV: {{ environment }}
- require:
- cmd: diaspora_create_database
- onchanges:
@@ -142,7 +143,7 @@ diaspora_precompile_assets:
- runas: diaspora
- cwd: {{ diaspora.install_path }}
- env:
- RAILS_ENV: {{ diaspora.environment }}
- RAILS_ENV: {{ environment }}
- require:
- cmd: diaspora_migrate_database
- onchanges:

+ 3
- 0
diaspora/map.jinja View File

@@ -72,4 +72,7 @@

{% 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) %}

Loading…
Cancel
Save