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