From 86b12761082f8554bcceab97260cadc7550a554a Mon Sep 17 00:00:00 2001 From: Laurynas Date: Sun, 27 Jan 2013 15:04:11 +0200 Subject: [PATCH 01/21] update --- README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README b/README index dab9eac..eb1d39d 100644 --- a/README +++ b/README @@ -4,6 +4,9 @@ A DNS users frontend. ## Initialize for development +Install required gems +> bundle install + # create config/database.yml and config/settings.yml from the samples > bundle exec rake db:drop db:create db:migrate db:seed:development From 2d5e65e5091ed9b7b825ca016d50e1146cc218d7 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Tue, 5 Feb 2013 16:37:39 +0000 Subject: [PATCH 02/21] spec file for rpm package --- entrydns.spec | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 entrydns.spec diff --git a/entrydns.spec b/entrydns.spec new file mode 100644 index 0000000..6090f88 --- /dev/null +++ b/entrydns.spec @@ -0,0 +1,52 @@ +Name: entrydns +Version: 0.0.2 +Release: 1%{?dist} +Summary: Free DNS management service for everyone + +Group: Applications/Internet +License: AGPL +URL: https://entrydns.net +Source0: %{name}-%{version}.tar.gz +BuildArch: x86_64 + +BuildRequires: ruby(abi) = 1.9.1 +BuildRequires: rubygems >= 1.8 +BuildRequires: ruby-devel >= 1.9.3 +BuildRequires: mysql-devel >= 5.5 +BuildRequires: rubygems-devel >= 1.8 +BuildRequires: libxml2-devel +BuildRequires: libxslt-devel +Requires: ruby(abi) = 1.9.1 + +%global entrydns_root /srv/%{name} + +%description +EntryDNS delivers a totally free DNS management service for your enjoyment. +Our aim is to provide a friendly and caring, yet powerful service for your +DNS needs. + + +%prep +%setup -q + + +%build +bundle install --path vendor/ --without development test +# clean not required files and directories +rm -rf test doc spec Capfile Gemfile Gemfile.lock Guardfile Rakefile .git + + +%install +rm -rf %{buildroot} + +install -p -d -m 0755 %{buildroot}%{entrydns_root} +cp -R . %{buildroot}%{entrydns_root} + + +%files +%doc + + + +%changelog + From bb0b08aa58745ff0ec16ead82baf2333356377f8 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Tue, 5 Feb 2013 19:20:08 +0000 Subject: [PATCH 03/21] spec file: work in progress --- entrydns.spec | 53 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/entrydns.spec b/entrydns.spec index 6090f88..e581e83 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -1,3 +1,8 @@ +%global _enable_debug_package 0 +%global debug_package %{nil} +%global __os_install_post /usr/lib/rpm/brp-compress %{nil} +%global app_root /srv/entrydns + Name: entrydns Version: 0.0.2 Release: 1%{?dist} @@ -16,9 +21,18 @@ BuildRequires: mysql-devel >= 5.5 BuildRequires: rubygems-devel >= 1.8 BuildRequires: libxml2-devel BuildRequires: libxslt-devel +BuildRequires: rubygem-rake >= 0.9.6 +#BuildRequires: rubygem-therubyracer >= 0.10.2 +#BuildRequires: rubygem-compass >= 0.12.2 +#BuildRequires: rubygem-sass-rails >= 3.2.5 Requires: ruby(abi) = 1.9.1 +Requires: rubygem-nokogiri >= 0.3.3 +Requires: rubygem-tzinfo >= 0.3.29 +Requires: rubygem-erubis >= 2.1.7 +Requires: rubygem-rdoc >= 3.12 +Requires: rubygem-rake >= 0.9.6 +Requires: rubygem-rack >= 1.4.0 -%global entrydns_root /srv/%{name} %description EntryDNS delivers a totally free DNS management service for your enjoyment. @@ -31,22 +45,43 @@ DNS needs. %build +bundle install --path assests_tmp/ --without development test production +bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile bundle install --path vendor/ --without development test -# clean not required files and directories -rm -rf test doc spec Capfile Gemfile Gemfile.lock Guardfile Rakefile .git %install -rm -rf %{buildroot} +# clean not required files and directories +rm -rf test doc spec Capfile Gemfile Gemfile.lock Guardfile Rakefile .git \ + .bundle .gitignore .rspec .rvmrc vendor/ruby/1.9.1/cache/* -install -p -d -m 0755 %{buildroot}%{entrydns_root} -cp -R . %{buildroot}%{entrydns_root} +find vendor/ -type f -wholename "*/cache/*.gem" -delete +find . -type f -name ".git*" -delete +install -p -d -m 0755 %{buildroot}%{app_root} +install -p -d -m 0755 %{buildroot}%{app_root}/log +cp -R app %{buildroot}%{app_root} +cp -R config %{buildroot}%{app_root} +cp -R db %{buildroot}%{app_root} +cp -R lib %{buildroot}%{app_root} +cp -R public %{buildroot}%{app_root} +cp -R script %{buildroot}%{app_root} +cp -R vendor %{buildroot}%{app_root} +cp config.ru %{buildroot}%{app_root} -%files -%doc +%files +%{app_root}/app +%{app_root}/config +%{app_root}/db +%{app_root}/lib +%{app_root}/log/ +%{app_root}/public +%{app_root}/script +%{app_root}/vendor +%{app_root}/config.ru %changelog - +* Tue Feb 5 2013 Vaidas Jablonskis - 1:0.0.2-1 +- initial build From 1445e56f8b751db17e3f35375f9ba1351c3fd473 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Tue, 5 Feb 2013 23:19:29 +0000 Subject: [PATCH 04/21] updated spec file and database sample config file --- config/database.mysql.sample.yml | 12 ++++++------ entrydns.spec | 20 +++++++------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/config/database.mysql.sample.yml b/config/database.mysql.sample.yml index 51f75b1..e04c499 100644 --- a/config/database.mysql.sample.yml +++ b/config/database.mysql.sample.yml @@ -4,8 +4,8 @@ development: reconnect: false database: entrydns_development pool: 5 - username: root - password: root + username: entrydns + password: entrydns host: localhost # Warning: The database defined as "test" will be erased and @@ -17,8 +17,8 @@ test: reconnect: false database: entrydns_test pool: 5 - username: root - password: root + username: entrydns + password: entrydns host: localhost production: @@ -27,6 +27,6 @@ production: reconnect: false database: entrydns_production pool: 5 - username: root - password: root + username: entrydns + password: entrydns host: localhost diff --git a/entrydns.spec b/entrydns.spec index e581e83..f482866 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -21,17 +21,8 @@ BuildRequires: mysql-devel >= 5.5 BuildRequires: rubygems-devel >= 1.8 BuildRequires: libxml2-devel BuildRequires: libxslt-devel -BuildRequires: rubygem-rake >= 0.9.6 -#BuildRequires: rubygem-therubyracer >= 0.10.2 -#BuildRequires: rubygem-compass >= 0.12.2 -#BuildRequires: rubygem-sass-rails >= 3.2.5 -Requires: ruby(abi) = 1.9.1 -Requires: rubygem-nokogiri >= 0.3.3 -Requires: rubygem-tzinfo >= 0.3.29 -Requires: rubygem-erubis >= 2.1.7 -Requires: rubygem-rdoc >= 3.12 -Requires: rubygem-rake >= 0.9.6 -Requires: rubygem-rack >= 1.4.0 +BuildRequires: mysql-server +Requires: ruby(abi) = 1.9.1 %description @@ -45,15 +36,18 @@ DNS needs. %build -bundle install --path assests_tmp/ --without development test production +cp config/database.mysql.sample.yml config/database.yml +bundle install --without development test bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile +rm -rf .bundle bundle install --path vendor/ --without development test %install # clean not required files and directories rm -rf test doc spec Capfile Gemfile Gemfile.lock Guardfile Rakefile .git \ - .bundle .gitignore .rspec .rvmrc vendor/ruby/1.9.1/cache/* + .bundle .gitignore .rspec .rvmrc vendor/ruby/1.9.1/cache/* \ + config/database.yml find vendor/ -type f -wholename "*/cache/*.gem" -delete find . -type f -name ".git*" -delete From eeef3166f3e9a8ebb3fa9f124f70f8bc065d083f Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Wed, 6 Feb 2013 00:43:41 +0000 Subject: [PATCH 05/21] updated spec file for RPM build --- entrydns.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/entrydns.spec b/entrydns.spec index f482866..a06e2cc 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -42,6 +42,13 @@ bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile rm -rf .bundle bundle install --path vendor/ --without development test +# fix wrong sheebang for unicorn +%if 0%{?fedora} >= 17 +find vendor/ruby/*/gems -type f -wholename '*/bin/unicorn*' | xargs \ + grep -rl '/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby' | \ + xargs sed -i -e 's|/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby|/usr/bin/env ruby|' +%endif + %install # clean not required files and directories From 1a9bab99c3a6467447451e87239ccfe46bc1d666 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Wed, 6 Feb 2013 17:24:36 -0500 Subject: [PATCH 06/21] rpm spec: improved certain bits --- entrydns.spec | 61 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/entrydns.spec b/entrydns.spec index a06e2cc..9a22b8f 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -1,7 +1,9 @@ %global _enable_debug_package 0 %global debug_package %{nil} %global __os_install_post /usr/lib/rpm/brp-compress %{nil} -%global app_root /srv/entrydns +%global entrydns_root /srv/entrydns +%global entrydns_user entrydns +%global entrydns_group entrydns Name: entrydns Version: 0.0.2 @@ -23,6 +25,9 @@ BuildRequires: libxml2-devel BuildRequires: libxslt-devel BuildRequires: mysql-server Requires: ruby(abi) = 1.9.1 +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd %description @@ -40,7 +45,7 @@ cp config/database.mysql.sample.yml config/database.yml bundle install --without development test bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile rm -rf .bundle -bundle install --path vendor/ --without development test +bundle install --path vendor/ --without development test assets # fix wrong sheebang for unicorn %if 0%{?fedora} >= 17 @@ -53,34 +58,44 @@ find vendor/ruby/*/gems -type f -wholename '*/bin/unicorn*' | xargs \ %install # clean not required files and directories rm -rf test doc spec Capfile Gemfile Gemfile.lock Guardfile Rakefile .git \ - .bundle .gitignore .rspec .rvmrc vendor/ruby/1.9.1/cache/* \ - config/database.yml + .gitignore .rspec .rvmrc vendor/ruby/1.9.1/cache/* config/database.yml find vendor/ -type f -wholename "*/cache/*.gem" -delete find . -type f -name ".git*" -delete -install -p -d -m 0755 %{buildroot}%{app_root} -install -p -d -m 0755 %{buildroot}%{app_root}/log -cp -R app %{buildroot}%{app_root} -cp -R config %{buildroot}%{app_root} -cp -R db %{buildroot}%{app_root} -cp -R lib %{buildroot}%{app_root} -cp -R public %{buildroot}%{app_root} -cp -R script %{buildroot}%{app_root} -cp -R vendor %{buildroot}%{app_root} -cp config.ru %{buildroot}%{app_root} +install -p -d -m 0755 %{buildroot}%{entrydns_root} +install -p -d -m 0755 %{buildroot}%{entrydns_root}/log +install -p -d -m 0755 %{buildroot}%{entrydns_root}/tmp +cp -R app %{buildroot}%{entrydns_root} +cp -R config %{buildroot}%{entrydns_root} +cp -R db %{buildroot}%{entrydns_root} +cp -R lib %{buildroot}%{entrydns_root} +cp -R public %{buildroot}%{entrydns_root} +cp -R script %{buildroot}%{entrydns_root} +cp -R vendor %{buildroot}%{entrydns_root} +cp config.ru %{buildroot}%{entrydns_root} %files -%{app_root}/app -%{app_root}/config -%{app_root}/db -%{app_root}/lib -%{app_root}/log/ -%{app_root}/public -%{app_root}/script -%{app_root}/vendor -%{app_root}/config.ru +%{entrydns_root}/app +%{entrydns_root}/config +%{entrydns_root}/db +%{entrydns_root}/lib +%{entrydns_root}/log/ +%{entrydns_root}/tmp/ +%{entrydns_root}/public +%{entrydns_root}/script +%{entrydns_root}/vendor +%{entrydns_root}/config.ru + + +%pre +getent group %{entrydns_group} >/dev/null || groupadd -r %{entrydns_group} +getent passwd %{entrydns_user} >/dev/null || \ + useradd -r -g %{entrydns_group} -d %{entrydns_root} -s /sbin/nologin \ + -c "EntryDNS user" %{entrydns_user} +exit 0 + %changelog From bd3d9f93213bcbd58aa0dd2ba887c0489bcccba8 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Wed, 6 Feb 2013 17:26:31 -0500 Subject: [PATCH 07/21] rpm spec: improved certain bits --- entrydns.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrydns.spec b/entrydns.spec index 9a22b8f..8b326e4 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -73,6 +73,7 @@ cp -R lib %{buildroot}%{entrydns_root} cp -R public %{buildroot}%{entrydns_root} cp -R script %{buildroot}%{entrydns_root} cp -R vendor %{buildroot}%{entrydns_root} +cp -R .bundle %{buildroot}%{entrydns_root} cp config.ru %{buildroot}%{entrydns_root} @@ -86,6 +87,7 @@ cp config.ru %{buildroot}%{entrydns_root} %{entrydns_root}/public %{entrydns_root}/script %{entrydns_root}/vendor +%{entrydns_root}/.bundle %{entrydns_root}/config.ru From 4b4550e05990f5594df7c442c72739dfd27fa322 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Thu, 7 Feb 2013 00:58:15 +0000 Subject: [PATCH 08/21] rpm spec: fixed permissions and added package depencies --- entrydns.spec | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/entrydns.spec b/entrydns.spec index 8b326e4..5ec4b09 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -25,6 +25,8 @@ BuildRequires: libxml2-devel BuildRequires: libxslt-devel BuildRequires: mysql-server Requires: ruby(abi) = 1.9.1 +Requires: memcached >= 1.4.10 +Requires: nodejs >= 0.9.5 Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -45,11 +47,11 @@ cp config/database.mysql.sample.yml config/database.yml bundle install --without development test bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile rm -rf .bundle -bundle install --path vendor/ --without development test assets +bundle install --deployment --without development test assets # fix wrong sheebang for unicorn %if 0%{?fedora} >= 17 -find vendor/ruby/*/gems -type f -wholename '*/bin/unicorn*' | xargs \ +find vendor/bundle/ruby/*/gems -type f -wholename '*/bin/unicorn*' | xargs \ grep -rl '/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby' | \ xargs sed -i -e 's|/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby|/usr/bin/env ruby|' %endif @@ -57,8 +59,7 @@ find vendor/ruby/*/gems -type f -wholename '*/bin/unicorn*' | xargs \ %install # clean not required files and directories -rm -rf test doc spec Capfile Gemfile Gemfile.lock Guardfile Rakefile .git \ - .gitignore .rspec .rvmrc vendor/ruby/1.9.1/cache/* config/database.yml +rm -rf test doc spec Capfile Guardfile .git .gitignore .rspec .rvmrc config/database.yml find vendor/ -type f -wholename "*/cache/*.gem" -delete find . -type f -name ".git*" -delete @@ -75,20 +76,28 @@ cp -R script %{buildroot}%{entrydns_root} cp -R vendor %{buildroot}%{entrydns_root} cp -R .bundle %{buildroot}%{entrydns_root} cp config.ru %{buildroot}%{entrydns_root} +cp Gemfile %{buildroot}%{entrydns_root} +cp Gemfile.lock %{buildroot}%{entrydns_root} +cp Rakefile %{buildroot}%{entrydns_root} %files +%defattr(0640, root, %{entrydns_user}, 0750) %{entrydns_root}/app %{entrydns_root}/config %{entrydns_root}/db %{entrydns_root}/lib -%{entrydns_root}/log/ -%{entrydns_root}/tmp/ -%{entrydns_root}/public +%attr(0770, root, %{entrydns_user}) %{entrydns_root}/log/ +%attr(0770, root, %{entrydns_user}) %{entrydns_root}/tmp/ +%attr(0755, root, %{entrydns_user}) %{entrydns_root}/public +%attr(0644, root, %{entrydns_user}) %{entrydns_root}/public/* %{entrydns_root}/script %{entrydns_root}/vendor %{entrydns_root}/.bundle %{entrydns_root}/config.ru +%{entrydns_root}/Gemfile +%{entrydns_root}/Gemfile.lock +%{entrydns_root}/Rakefile %pre @@ -99,7 +108,6 @@ getent passwd %{entrydns_user} >/dev/null || \ exit 0 - %changelog * Tue Feb 5 2013 Vaidas Jablonskis - 1:0.0.2-1 - initial build From a961ead783e4f0b7f53636d36aef7eaf25a615ea Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Thu, 7 Feb 2013 01:15:33 +0000 Subject: [PATCH 09/21] rpm spec: fixing perms --- entrydns.spec | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/entrydns.spec b/entrydns.spec index 5ec4b09..004b2ec 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -82,15 +82,14 @@ cp Rakefile %{buildroot}%{entrydns_root} %files -%defattr(0640, root, %{entrydns_user}, 0750) +%defattr(0644, root, %{entrydns_user}, 0755) %{entrydns_root}/app -%{entrydns_root}/config -%{entrydns_root}/db +%attr(0750, root, %{entrydns_user}) %{entrydns_root}/config +%attr(0750, root, %{entrydns_user}) %{entrydns_root}/db %{entrydns_root}/lib %attr(0770, root, %{entrydns_user}) %{entrydns_root}/log/ %attr(0770, root, %{entrydns_user}) %{entrydns_root}/tmp/ -%attr(0755, root, %{entrydns_user}) %{entrydns_root}/public -%attr(0644, root, %{entrydns_user}) %{entrydns_root}/public/* +%{entrydns_root}/public %{entrydns_root}/script %{entrydns_root}/vendor %{entrydns_root}/.bundle From 74e4779c15e683517e16eedb0e95504569b9c1fa Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Thu, 7 Feb 2013 01:31:43 +0000 Subject: [PATCH 10/21] rpm spec: fixing perms --- entrydns.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrydns.spec b/entrydns.spec index 004b2ec..a976eb9 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -82,7 +82,7 @@ cp Rakefile %{buildroot}%{entrydns_root} %files -%defattr(0644, root, %{entrydns_user}, 0755) +%defattr(-, root, %{entrydns_user}, 0755) %{entrydns_root}/app %attr(0750, root, %{entrydns_user}) %{entrydns_root}/config %attr(0750, root, %{entrydns_user}) %{entrydns_root}/db From 8c54ab944e5bc948ce68bc67ec88bfbe341bee52 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Thu, 7 Feb 2013 14:56:10 +0000 Subject: [PATCH 11/21] rpm spec: perms fix --- entrydns.spec | 63 ++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/entrydns.spec b/entrydns.spec index a976eb9..ef9fc40 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -5,31 +5,34 @@ %global entrydns_user entrydns %global entrydns_group entrydns -Name: entrydns -Version: 0.0.2 -Release: 1%{?dist} -Summary: Free DNS management service for everyone - -Group: Applications/Internet -License: AGPL -URL: https://entrydns.net -Source0: %{name}-%{version}.tar.gz -BuildArch: x86_64 - -BuildRequires: ruby(abi) = 1.9.1 -BuildRequires: rubygems >= 1.8 -BuildRequires: ruby-devel >= 1.9.3 -BuildRequires: mysql-devel >= 5.5 -BuildRequires: rubygems-devel >= 1.8 -BuildRequires: libxml2-devel -BuildRequires: libxslt-devel -BuildRequires: mysql-server -Requires: ruby(abi) = 1.9.1 -Requires: memcached >= 1.4.10 -Requires: nodejs >= 0.9.5 -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd +Name: entrydns +Version: 0.0.2 +Release: 1%{?dist} +Summary: Free DNS management service for everyone + +Group: Applications/Internet +License: AGPL +URL: https://entrydns.net +Source0: %{name}-%{version}.tar.gz +BuildArch: x86_64 + +BuildRequires: ruby(abi) = 1.9.1 +BuildRequires: rubygems >= 1.8 +BuildRequires: ruby-devel >= 1.9.3 +BuildRequires: mysql-devel >= 5.5 +BuildRequires: rubygems-devel >= 1.8 +BuildRequires: libxml2-devel +BuildRequires: libxslt-devel +BuildRequires: mysql-server + +Requires: ruby(abi) = 1.9.1 +Requires: memcached >= 1.4.10 +Requires: nodejs >= 0.9.5 +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +Provides: entrydns = %{version} %description @@ -43,10 +46,14 @@ DNS needs. %build +# required config file for assets pre-compilation cp config/database.mysql.sample.yml config/database.yml bundle install --without development test + +# pre-compile assets bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile rm -rf .bundle + bundle install --deployment --without development test assets # fix wrong sheebang for unicorn @@ -58,7 +65,7 @@ find vendor/bundle/ruby/*/gems -type f -wholename '*/bin/unicorn*' | xargs \ %install -# clean not required files and directories +# clean up not required files and directories rm -rf test doc spec Capfile Guardfile .git .gitignore .rspec .rvmrc config/database.yml find vendor/ -type f -wholename "*/cache/*.gem" -delete @@ -85,7 +92,7 @@ cp Rakefile %{buildroot}%{entrydns_root} %defattr(-, root, %{entrydns_user}, 0755) %{entrydns_root}/app %attr(0750, root, %{entrydns_user}) %{entrydns_root}/config -%attr(0750, root, %{entrydns_user}) %{entrydns_root}/db +%attr(0770, root, %{entrydns_user}) %{entrydns_root}/db %{entrydns_root}/lib %attr(0770, root, %{entrydns_user}) %{entrydns_root}/log/ %attr(0770, root, %{entrydns_user}) %{entrydns_root}/tmp/ @@ -109,4 +116,4 @@ exit 0 %changelog * Tue Feb 5 2013 Vaidas Jablonskis - 1:0.0.2-1 -- initial build +- initial test build From 39088e83d579fe8bf4fc4213c848d098722263bc Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Thu, 7 Feb 2013 19:08:23 +0000 Subject: [PATCH 12/21] rpm spec: perms fix --- entrydns.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/entrydns.spec b/entrydns.spec index ef9fc40..8c2c756 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -28,6 +28,7 @@ BuildRequires: mysql-server Requires: ruby(abi) = 1.9.1 Requires: memcached >= 1.4.10 Requires: nodejs >= 0.9.5 +Requires: rubygem-bundler >= 1.1.4 Requires(post): systemd Requires(preun): systemd Requires(postun): systemd From 245516a24f75aefbee2dc815f69475bb73e8f7d2 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Fri, 8 Feb 2013 22:36:55 +0000 Subject: [PATCH 13/21] increased release by 1, testing jenkins rpm build --- entrydns.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrydns.spec b/entrydns.spec index 8c2c756..6972098 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -7,7 +7,7 @@ Name: entrydns Version: 0.0.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Free DNS management service for everyone Group: Applications/Internet From 8c9f56cadaece8ccb0c6dc064e629f79a9b1a13d Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Sat, 9 Feb 2013 18:40:57 +0000 Subject: [PATCH 14/21] rpm: added conf files for unicorn --- dist/fedora/etc/entrydns/unicorn.conf | 11 +++++++++++ dist/fedora/etc/sysconfig/unicorn-entrydns | 4 ++++ entrydns.spec | 10 ++++++++++ 3 files changed, 25 insertions(+) create mode 100644 dist/fedora/etc/entrydns/unicorn.conf create mode 100644 dist/fedora/etc/sysconfig/unicorn-entrydns diff --git a/dist/fedora/etc/entrydns/unicorn.conf b/dist/fedora/etc/entrydns/unicorn.conf new file mode 100644 index 0000000..f50a8c6 --- /dev/null +++ b/dist/fedora/etc/entrydns/unicorn.conf @@ -0,0 +1,11 @@ +# +# Configuration file for Unicorn app server for EntryDNS serving +# +worker_processes 2 +working_directory "/srv/entrydns" +listen 8081 +pid "/run/entrydns/unicorn.pid" +user entrydns, entrydns + +stdout_path "/var/log/entrydns/unicorn_stdout.log" +stderr_path "/var/log/entrydns/unicorn_stderr.log" diff --git a/dist/fedora/etc/sysconfig/unicorn-entrydns b/dist/fedora/etc/sysconfig/unicorn-entrydns new file mode 100644 index 0000000..c81fd17 --- /dev/null +++ b/dist/fedora/etc/sysconfig/unicorn-entrydns @@ -0,0 +1,4 @@ +# +# Environment variables for bundler +# +BUNDLE_GEMFILE="/srv/entrydns/Gemfile" diff --git a/entrydns.spec b/entrydns.spec index 6972098..46b4e81 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -72,6 +72,9 @@ rm -rf test doc spec Capfile Guardfile .git .gitignore .rspec .rvmrc config/data find vendor/ -type f -wholename "*/cache/*.gem" -delete find . -type f -name ".git*" -delete +install -p -d -m 0755 %{_sysconfdir}/%{name} +install -p -d -m 0750 %{_var}/log/%{name} +install -p -d -m 0755 /run/%{name} install -p -d -m 0755 %{buildroot}%{entrydns_root} install -p -d -m 0755 %{buildroot}%{entrydns_root}/log install -p -d -m 0755 %{buildroot}%{entrydns_root}/tmp @@ -87,10 +90,15 @@ cp config.ru %{buildroot}%{entrydns_root} cp Gemfile %{buildroot}%{entrydns_root} cp Gemfile.lock %{buildroot}%{entrydns_root} cp Rakefile %{buildroot}%{entrydns_root} +cp dist/fedora/etc/sysconfig/unicorn-entrydns %{buildroot}%{_sysconfdir} +cp dist/fedora/etc/%{name}/unicorn.conf %{buildroot}%{_sysconfdir}/%{name} %files %defattr(-, root, %{entrydns_user}, 0755) +%attr(-, %{entrydns_user}, %{entrydns_group}) %{_var}/log/%{name} +%{_sysconfdir}/%{name} +/run/%{name} %{entrydns_root}/app %attr(0750, root, %{entrydns_user}) %{entrydns_root}/config %attr(0770, root, %{entrydns_user}) %{entrydns_root}/db @@ -105,6 +113,8 @@ cp Rakefile %{buildroot}%{entrydns_root} %{entrydns_root}/Gemfile %{entrydns_root}/Gemfile.lock %{entrydns_root}/Rakefile +%attr(0644, root, root) %config(noreplace) %{entrydns_root}%{_sysconfdir}/sysconfig/unicorn-entrydns +%attr(0644, root, root) %config(noreplace) %{entrydns_root}%{_sysconfdir}%{name}/unicorn.conf %pre From c0024d5d956f7eb1dd39ef9ede4bca24154b9336 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Sat, 9 Feb 2013 19:31:59 +0000 Subject: [PATCH 15/21] rpm: fixed config file and added systemd service unit file --- dist/fedora/etc/entrydns/unicorn.conf | 4 ++-- .../lib/systemd/system/unicorn-entrydns.service | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 dist/fedora/lib/systemd/system/unicorn-entrydns.service diff --git a/dist/fedora/etc/entrydns/unicorn.conf b/dist/fedora/etc/entrydns/unicorn.conf index f50a8c6..3e7cc94 100644 --- a/dist/fedora/etc/entrydns/unicorn.conf +++ b/dist/fedora/etc/entrydns/unicorn.conf @@ -1,11 +1,11 @@ # # Configuration file for Unicorn app server for EntryDNS serving # -worker_processes 2 +worker_processes 1 working_directory "/srv/entrydns" listen 8081 pid "/run/entrydns/unicorn.pid" -user entrydns, entrydns +user "entrydns", "entrydns" stdout_path "/var/log/entrydns/unicorn_stdout.log" stderr_path "/var/log/entrydns/unicorn_stderr.log" diff --git a/dist/fedora/lib/systemd/system/unicorn-entrydns.service b/dist/fedora/lib/systemd/system/unicorn-entrydns.service new file mode 100644 index 0000000..785492a --- /dev/null +++ b/dist/fedora/lib/systemd/system/unicorn-entrydns.service @@ -0,0 +1,15 @@ +[Unit] +Description=Unicorn application server for EntryDNS +After=network.target remote-fs.target nss-lookup.target + +[Service] +Type=simple +EnvironmentFile=/etc/sysconfig/unicorn-entrydns +PIDFile=/run/entrydns/unicorn.pid +ExecStart=/usr/bin/bundle exec 'unicorn -c /etc/entrydns/unicorn.conf' +ExecReload=/usr/bin/kill -HUP ${MAINPID} +ExecStop=/usr/bin/kill -QUIT ${MAINPID} + +[Install] +WantedBy=multi-user.target + From 432066d43c97d673902d2fa4df639a78e49eb24a Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Sat, 9 Feb 2013 19:59:04 +0000 Subject: [PATCH 16/21] rpm: fixing some bugs --- .../systemd/system/unicorn-entrydns.service | 0 entrydns.spec | 19 +++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) rename dist/fedora/{ => usr}/lib/systemd/system/unicorn-entrydns.service (100%) diff --git a/dist/fedora/lib/systemd/system/unicorn-entrydns.service b/dist/fedora/usr/lib/systemd/system/unicorn-entrydns.service similarity index 100% rename from dist/fedora/lib/systemd/system/unicorn-entrydns.service rename to dist/fedora/usr/lib/systemd/system/unicorn-entrydns.service diff --git a/entrydns.spec b/entrydns.spec index 46b4e81..32dd0fe 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -72,9 +72,9 @@ rm -rf test doc spec Capfile Guardfile .git .gitignore .rspec .rvmrc config/data find vendor/ -type f -wholename "*/cache/*.gem" -delete find . -type f -name ".git*" -delete -install -p -d -m 0755 %{_sysconfdir}/%{name} -install -p -d -m 0750 %{_var}/log/%{name} -install -p -d -m 0755 /run/%{name} +install -p -d -m 0755 %{buildroot}%{_sysconfdir}/%{name} +install -p -d -m 0750 %{buildroot}%{_var}/log/%{name} +install -p -d -m 0755 %{buildroot}/run/%{name} install -p -d -m 0755 %{buildroot}%{entrydns_root} install -p -d -m 0755 %{buildroot}%{entrydns_root}/log install -p -d -m 0755 %{buildroot}%{entrydns_root}/tmp @@ -92,13 +92,12 @@ cp Gemfile.lock %{buildroot}%{entrydns_root} cp Rakefile %{buildroot}%{entrydns_root} cp dist/fedora/etc/sysconfig/unicorn-entrydns %{buildroot}%{_sysconfdir} cp dist/fedora/etc/%{name}/unicorn.conf %{buildroot}%{_sysconfdir}/%{name} +cp dist/fedora%{_unitdir}/unicorn-entrydns.service %{buildroot}%{_unitdir} + %files %defattr(-, root, %{entrydns_user}, 0755) -%attr(-, %{entrydns_user}, %{entrydns_group}) %{_var}/log/%{name} -%{_sysconfdir}/%{name} -/run/%{name} %{entrydns_root}/app %attr(0750, root, %{entrydns_user}) %{entrydns_root}/config %attr(0770, root, %{entrydns_user}) %{entrydns_root}/db @@ -113,8 +112,12 @@ cp dist/fedora/etc/%{name}/unicorn.conf %{buildroot}%{_sysconfdir}/%{name} %{entrydns_root}/Gemfile %{entrydns_root}/Gemfile.lock %{entrydns_root}/Rakefile -%attr(0644, root, root) %config(noreplace) %{entrydns_root}%{_sysconfdir}/sysconfig/unicorn-entrydns -%attr(0644, root, root) %config(noreplace) %{entrydns_root}%{_sysconfdir}%{name}/unicorn.conf +%attr(0644, root, root) %config(noreplace) %{_sysconfdir}/sysconfig/unicorn-entrydns +%attr(0644, root, root) %config(noreplace) %{_sysconfdir}%{name}/unicorn.conf +%{_unitdir}/unicorn-entrydns.service +%attr(-, %{entrydns_user}, %{entrydns_group}) %{_var}/log/%{name} +%{_sysconfdir}/%{name} +/run/%{name} %pre From 6e5fce1c3c068b96912cb0b948b1cc8d57be630f Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Sat, 9 Feb 2013 21:30:36 +0000 Subject: [PATCH 17/21] rpm: finishing spec file --- entrydns.spec | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/entrydns.spec b/entrydns.spec index 32dd0fe..616f73f 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -4,6 +4,7 @@ %global entrydns_root /srv/entrydns %global entrydns_user entrydns %global entrydns_group entrydns +%global entrydns_systemd_unit unicorn-entrydns.service Name: entrydns Version: 0.0.2 @@ -73,11 +74,13 @@ find vendor/ -type f -wholename "*/cache/*.gem" -delete find . -type f -name ".git*" -delete install -p -d -m 0755 %{buildroot}%{_sysconfdir}/%{name} +install -p -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig install -p -d -m 0750 %{buildroot}%{_var}/log/%{name} install -p -d -m 0755 %{buildroot}/run/%{name} install -p -d -m 0755 %{buildroot}%{entrydns_root} install -p -d -m 0755 %{buildroot}%{entrydns_root}/log install -p -d -m 0755 %{buildroot}%{entrydns_root}/tmp +install -p -d -m 0755 %{buildroot}%{_unitdir} cp -R app %{buildroot}%{entrydns_root} cp -R config %{buildroot}%{entrydns_root} cp -R db %{buildroot}%{entrydns_root} @@ -90,10 +93,9 @@ cp config.ru %{buildroot}%{entrydns_root} cp Gemfile %{buildroot}%{entrydns_root} cp Gemfile.lock %{buildroot}%{entrydns_root} cp Rakefile %{buildroot}%{entrydns_root} -cp dist/fedora/etc/sysconfig/unicorn-entrydns %{buildroot}%{_sysconfdir} +cp dist/fedora/etc/sysconfig/unicorn-entrydns %{buildroot}%{_sysconfdir}/sysconfig cp dist/fedora/etc/%{name}/unicorn.conf %{buildroot}%{_sysconfdir}/%{name} -cp dist/fedora%{_unitdir}/unicorn-entrydns.service %{buildroot}%{_unitdir} - +cp dist/fedora%{_unitdir}/%{entrydns_systemd_unit} %{buildroot}%{_unitdir} %files @@ -113,10 +115,10 @@ cp dist/fedora%{_unitdir}/unicorn-entrydns.service %{buildroot}%{_unitdir} %{entrydns_root}/Gemfile.lock %{entrydns_root}/Rakefile %attr(0644, root, root) %config(noreplace) %{_sysconfdir}/sysconfig/unicorn-entrydns -%attr(0644, root, root) %config(noreplace) %{_sysconfdir}%{name}/unicorn.conf -%{_unitdir}/unicorn-entrydns.service +%attr(0644, root, root) %config(noreplace) %{_sysconfdir}/%{name}/unicorn.conf +%{_unitdir}/%{entrydns_systemd_unit} %attr(-, %{entrydns_user}, %{entrydns_group}) %{_var}/log/%{name} -%{_sysconfdir}/%{name} +#%{_sysconfdir}/%{name} /run/%{name} @@ -128,6 +130,18 @@ getent passwd %{entrydns_user} >/dev/null || \ exit 0 +%post +%systemd_post %{entrydns_systemd_unit} + + +%preun +%systemd_preun %{entrydns_systemd_unit} + + +%postun +%systemd_postun_with_restart %{entrydns_systemd_unit} + + %changelog * Tue Feb 5 2013 Vaidas Jablonskis - 1:0.0.2-1 - initial test build From d5edf161b78b96df8b16266dfbbf8805b3efb594 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Mon, 11 Feb 2013 14:43:05 +0000 Subject: [PATCH 18/21] rpm spec: minor changes --- entrydns.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrydns.spec b/entrydns.spec index 616f73f..c8cd145 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -104,8 +104,8 @@ cp dist/fedora%{_unitdir}/%{entrydns_systemd_unit} %{buildroot}%{_unitdir} %attr(0750, root, %{entrydns_user}) %{entrydns_root}/config %attr(0770, root, %{entrydns_user}) %{entrydns_root}/db %{entrydns_root}/lib -%attr(0770, root, %{entrydns_user}) %{entrydns_root}/log/ -%attr(0770, root, %{entrydns_user}) %{entrydns_root}/tmp/ +%dir %attr(0770, root, %{entrydns_user}) %{entrydns_root}/log/ +%dir %attr(0770, root, %{entrydns_user}) %{entrydns_root}/tmp/ %{entrydns_root}/public %{entrydns_root}/script %{entrydns_root}/vendor From 2a597d02beee64f600c5841cff07c348d0ec9e67 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Thu, 21 Feb 2013 00:01:08 +0000 Subject: [PATCH 19/21] rpm spec: fixing directory creation bug --- entrydns.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/entrydns.spec b/entrydns.spec index 616f73f..712898a 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -7,8 +7,8 @@ %global entrydns_systemd_unit unicorn-entrydns.service Name: entrydns -Version: 0.0.2 -Release: 2%{?dist} +Version: 0.0.3 +Release: 3%{?dist} Summary: Free DNS management service for everyone Group: Applications/Internet @@ -75,6 +75,7 @@ find . -type f -name ".git*" -delete install -p -d -m 0755 %{buildroot}%{_sysconfdir}/%{name} install -p -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig +install -p -d %{buildroot}%{_var}/log install -p -d -m 0750 %{buildroot}%{_var}/log/%{name} install -p -d -m 0755 %{buildroot}/run/%{name} install -p -d -m 0755 %{buildroot}%{entrydns_root} From 7004b8f34732eb227b05f93d4a3b7840097e33f6 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Sat, 23 Feb 2013 22:55:16 +0000 Subject: [PATCH 20/21] dist: edns will start in prod env --- dist/fedora/etc/sysconfig/unicorn-entrydns | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/fedora/etc/sysconfig/unicorn-entrydns b/dist/fedora/etc/sysconfig/unicorn-entrydns index c81fd17..72558be 100644 --- a/dist/fedora/etc/sysconfig/unicorn-entrydns +++ b/dist/fedora/etc/sysconfig/unicorn-entrydns @@ -2,3 +2,4 @@ # Environment variables for bundler # BUNDLE_GEMFILE="/srv/entrydns/Gemfile" +RAILS_ENV="production" From bc5b85f50c5aefeca2cb384310d75bfb20f2fe20 Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Sat, 23 Feb 2013 22:57:42 +0000 Subject: [PATCH 21/21] rpm spec: bumped version up to 0.0.4 --- entrydns.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrydns.spec b/entrydns.spec index 7e85f98..f92803a 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -7,8 +7,8 @@ %global entrydns_systemd_unit unicorn-entrydns.service Name: entrydns -Version: 0.0.3 -Release: 3%{?dist} +Version: 0.0.4 +Release: 1%{?dist} Summary: Free DNS management service for everyone Group: Applications/Internet