Commit 3f0918d11c02639f4ed3e44561df9c6bf2fb4d03
1 parent
8cbc4768
Exists in
kalibro-configurations
Fixing erros in systemd file
Showing
2 changed files
with
25 additions
and
12 deletions
Show diff stats
kalibro-configurations/kalibro-configurations.spec
| 1 | 1 | Name: kalibro-configurations |
| 2 | 2 | Version: 1.0.0.backport |
| 3 | -Release: 1%{?dist} | |
| 3 | +Release: 2%{?dist} | |
| 4 | 4 | Summary: Mezuro metrics management backend |
| 5 | 5 | Group: Development/Tools |
| 6 | 6 | License: AGPLv3 |
| ... | ... | @@ -30,22 +30,22 @@ rm -rf %{buildroot}/usr/lib/kalibro-configurations/log |
| 30 | 30 | ln -sfT /var/log/kalibro-configurations %{buildroot}/usr/lib/kalibro-configurations/log |
| 31 | 31 | ln -sfT /etc/kalibro-configurations/database.yml %{buildroot}/usr/lib/kalibro-configurations/config/database.yml |
| 32 | 32 | mkdir -p %{buildroot}/lib/systemd/system |
| 33 | -cat >> %{buildroot}/lib/systemd/system/kalibro-configurations.service <<EOF | |
| 33 | +cat > %{buildroot}/lib/systemd/system/kalibro_configurations.service <<EOF | |
| 34 | 34 | [Unit] |
| 35 | -Description=kalibro-configurations | |
| 35 | +Description=kalibro_configurations | |
| 36 | 36 | After=network.target |
| 37 | 37 | |
| 38 | 38 | [Service] |
| 39 | 39 | Type=simple |
| 40 | -EnvironmentFile=-/etc/sysconfig/kalibro-configurations | |
| 41 | -User=kalibro-configurations | |
| 40 | +EnvironmentFile=-/etc/sysconfig/kalibro_configurations | |
| 41 | +User=kalibro_configurations | |
| 42 | 42 | WorkingDirectory=/usr/lib/kalibro-configurations |
| 43 | -ExecStart=bundle exec rails s -p 8083 | |
| 43 | +ExecStart=/usr/bin/env bundle exec rails s -p 8083 -e production | |
| 44 | 44 | [Install] |
| 45 | 45 | WantedBy=multi-user.target |
| 46 | 46 | EOF |
| 47 | 47 | mkdir -p %{buildroot}/etc/kalibro-configurations |
| 48 | -cat >> %{buildroot}/etc/kalibro-configurations/database.yml << EOF | |
| 48 | +cat > %{buildroot}/etc/kalibro-configurations/database.yml << EOF | |
| 49 | 49 | production: |
| 50 | 50 | adapter: postgresql |
| 51 | 51 | encoding: unicode |
| ... | ... | @@ -58,7 +58,6 @@ EOF |
| 58 | 58 | #FIXME HACK, REMOVE LATER |
| 59 | 59 | sed -i -e "s/require.*database_cleaner/# &/" %{buildroot}/usr/lib/kalibro-configurations/app/controllers/tests_controller.rb |
| 60 | 60 | |
| 61 | - | |
| 62 | 61 | %post |
| 63 | 62 | groupadd kalibro_configurations || true |
| 64 | 63 | if ! id kalibro_configurations; then |
| ... | ... | @@ -66,7 +65,7 @@ if ! id kalibro_configurations; then |
| 66 | 65 | fi |
| 67 | 66 | mkdir -p /var/log/kalibro-configurations |
| 68 | 67 | chown -R kalibro_configurations:kalibro_configurations /var/log/kalibro-configurations |
| 69 | - | |
| 68 | +chown -R kalibro_configurations:kalibro_configurations /usr/lib/kalibro-configurations | |
| 70 | 69 | |
| 71 | 70 | if [ -x /usr/bin/postgres ]; then |
| 72 | 71 | if [ `systemctl is-active postgresql`!="active" ]; then |
| ... | ... | @@ -87,14 +86,20 @@ if [ -x /usr/bin/postgres ]; then |
| 87 | 86 | cd /usr/lib/kalibro-configurations/ |
| 88 | 87 | su kalibro_configurations -c "RAILS_ENV=production bundle exec rake db:migrate" |
| 89 | 88 | if [ $1 -eq 1 ]; then |
| 89 | + echo "========================ENTREIEEEIIII" | |
| 90 | 90 | su kalibro_configurations -c "RAILS_ENV=production bundle exec rake db:seed" |
| 91 | + cat >> %{buildroot}/etc/profile.d/kalibro_configurations.sh <<EOF | |
| 92 | + export RAILS_ENV=production | |
| 93 | +EOF | |
| 94 | + source %{buildroot}/etc/profile.d/kalibro_configurations.sh | |
| 95 | + #SECRET="$(RAILS_ENV=production bundle exec rake secret)" | |
| 91 | 96 | fi |
| 92 | 97 | fi |
| 93 | 98 | |
| 94 | 99 | if [ $1 -gt 1 ]; then |
| 95 | - echo 'Restarting kalibro-configurations' | |
| 100 | + echo 'Restarting kalibro_configurations' | |
| 96 | 101 | systemctl daemon-reload |
| 97 | - systemctl try-restart kalibro-configurations | |
| 102 | + systemctl try-restart kalibro_configurations | |
| 98 | 103 | fi |
| 99 | 104 | |
| 100 | 105 | %clean |
| ... | ... | @@ -104,7 +109,7 @@ rm -rf %{buildroot} |
| 104 | 109 | %defattr(-,root,root,-) |
| 105 | 110 | %doc |
| 106 | 111 | /usr/lib/kalibro-configurations |
| 107 | -/lib/systemd/system/kalibro-configurations.service | |
| 112 | +/lib/systemd/system/kalibro_configurations.service | |
| 108 | 113 | %config(noreplace) /etc/kalibro-configurations/database.yml |
| 109 | 114 | |
| 110 | 115 | %changelog | ... | ... |
| ... | ... | @@ -0,0 +1,8 @@ |
| 1 | +#!/bin/bash | |
| 2 | + | |
| 3 | +sudo yum remove kalibro-configurations | |
| 4 | +sudo rm -rf /etc/kalibro-configurations | |
| 5 | +sudo rm -rf /var/log/kalibro-configurations | |
| 6 | + | |
| 7 | +sudo -u postgres -i dropdb kalibro_configurations_production | |
| 8 | +sudo -u postgres -i dropuser kalibro_configurations_production | ... | ... |