Commit 3c70e0826e437eaa0de0022cc8ce3e2eb79d512f
1 parent
e4e36391
Exists in
prezento
Adding prezento spec
Showing
1 changed file
with
95 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,95 @@ |
| 1 | +Name: prezento | |
| 2 | +Version:v0.8.3 | |
| 3 | +Release: 2%{?dist} | |
| 4 | +Summary: Mezuro metrics management frontend | |
| 5 | +Group: Development/Tools | |
| 6 | +License: AGPLv3 | |
| 7 | +URL: https://github.com/mezuro/%{name} | |
| 8 | +Source0: %{name}-%{version}.tar.gz | |
| 9 | +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | |
| 10 | +BuildArch: noarch | |
| 11 | +BuildRequires: prezento-spb-deps | |
| 12 | +Requires: prezento-spb-deps, rubygem-bundler | |
| 13 | + | |
| 14 | +%description | |
| 15 | + | |
| 16 | +%prep | |
| 17 | +%setup -q | |
| 18 | + | |
| 19 | +%build | |
| 20 | +ln -sf /usr/lib/prezento/Gemfile . | |
| 21 | +ln -sf /usr/lib/prezento/Gemfile.lock . | |
| 22 | +ln -sf /usr/lib/prezento/.bundle . | |
| 23 | +ln -sfT /usr/lib/prezento/vendor/bundle vendor/bundle | |
| 24 | +rm -f Gemfile Gemfile.lock .bundle vendor/bundle | |
| 25 | +rm -rf tmp log | |
| 26 | + | |
| 27 | +%install | |
| 28 | +mkdir -p %{buildroot}/usr/lib/prezento-spb | |
| 29 | +cp -r * %{buildroot}/usr/lib/prezento-spb/ | |
| 30 | +rm -rf %{buildroot}/usr/lib/prezento-spb/log | |
| 31 | +ln -sfT /var/log/prezento %{buildroot}/usr/lib/prezento-spb/log | |
| 32 | +ln -sfT /etc/prezento/database.yml %{buildroot}/usr/lib/prezento-spb/config/database.yml | |
| 33 | +ln -sfT /etc/prezento/secrets.yml %{buildroot}/usr/lib/prezento-spb/config/secrets.yml | |
| 34 | + | |
| 35 | +mkdir -p %{buildroot}/lib/systemd/system | |
| 36 | +cat > %{buildroot}/lib/systemd/system/prezento.service <<EOF | |
| 37 | +[Unit] | |
| 38 | +Description=prezento | |
| 39 | +After=network.target | |
| 40 | + | |
| 41 | +[Service] | |
| 42 | +Type=simple | |
| 43 | +EnvironmentFile=-/etc/sysconfig/prezento | |
| 44 | +User=prezento | |
| 45 | +WorkingDirectory=/usr/lib/prezento-spb | |
| 46 | +#Check port later | |
| 47 | +ExecStart=/usr/bin/env bundle exec rails s -p 3000 -e production | |
| 48 | + | |
| 49 | +[Install] | |
| 50 | +WantedBy=multi-user.target | |
| 51 | +EOF | |
| 52 | + | |
| 53 | +mkdir -p %{buildroot}/etc/prezento | |
| 54 | +cat > %{buildroot}/etc/prezento/database.yml <<EOF | |
| 55 | +production: | |
| 56 | + adapter: postgresql | |
| 57 | + encoding: unicode | |
| 58 | + database: prezento_production | |
| 59 | + pool: 10 | |
| 60 | + username: prezento | |
| 61 | + password: | |
| 62 | +EOF | |
| 63 | + | |
| 64 | +cat > %{buildroot}/etc/prezento/secrets.yml <<EOF | |
| 65 | +production: | |
| 66 | + secret_key_base: $(bundle exec rake secret) | |
| 67 | +EOF | |
| 68 | + | |
| 69 | +%post | |
| 70 | +groupadd prezento || true | |
| 71 | +if ! id prezento; then | |
| 72 | + adduser prezento --system -g prezento --shell /bin/sh --home-dir /usr/lib/prezento | |
| 73 | +fi | |
| 74 | +mkdir -p /var/log/prezento | |
| 75 | +chown -R prezento:prezento /var/log/prezento | |
| 76 | +chown -R prezento:prezento /usr/lib/prezento-spb | |
| 77 | + | |
| 78 | +if [ $1 -gt 1 ]; then | |
| 79 | + echo 'Restarting prezento' | |
| 80 | + systemctl daemon-reload | |
| 81 | + systemctl try-restart prezento | |
| 82 | +fi | |
| 83 | + | |
| 84 | +%clean | |
| 85 | +#rm -rf %{buildroot} | |
| 86 | + | |
| 87 | +%files | |
| 88 | +%defattr(-,root,root,-) | |
| 89 | +%doc | |
| 90 | +/usr/lib/prezento-spb | |
| 91 | +/lib/systemd/system/prezento.service | |
| 92 | +%config(noreplace) /etc/prezento/database.yml | |
| 93 | +%config(noreplace) /etc/prezento/secrets.yml | |
| 94 | + | |
| 95 | +%changelog | ... | ... |