Browse Source

Gaia packaging added

pull/1943/head
Greg Szabo 8 years ago
parent
commit
88b4ca3bc3
19 changed files with 374 additions and 10 deletions
  1. +13
    -6
      devops/rpmbuild/Makefile
  2. +6
    -0
      devops/rpmbuild/extrafiles/DEBIAN-gaia/changelog
  3. +1
    -0
      devops/rpmbuild/extrafiles/DEBIAN-gaia/compat
  4. +15
    -0
      devops/rpmbuild/extrafiles/DEBIAN-gaia/control
  5. +21
    -0
      devops/rpmbuild/extrafiles/DEBIAN-gaia/copyright
  6. +45
    -0
      devops/rpmbuild/extrafiles/DEBIAN-gaia/postinst
  7. +41
    -0
      devops/rpmbuild/extrafiles/DEBIAN-gaia/postrm
  8. +37
    -0
      devops/rpmbuild/extrafiles/DEBIAN-gaia/preinst
  9. +39
    -0
      devops/rpmbuild/extrafiles/DEBIAN-gaia/prerm
  10. +3
    -0
      devops/rpmbuild/extrafiles/gaia/etc/systemd/system-preset/50-gaia.preset
  11. +23
    -0
      devops/rpmbuild/extrafiles/gaia/etc/systemd/system/gaia-server.service
  12. +28
    -0
      devops/rpmbuild/extrafiles/gaia/etc/systemd/system/gaia.service
  13. +12
    -0
      devops/rpmbuild/extrafiles/gaia/usr/share/gaia/key.json
  14. +12
    -0
      devops/rpmbuild/extrafiles/gaia/usr/share/gaia/key2.json
  15. +1
    -1
      devops/rpmbuild/spectemplates/basecoin.spec
  16. +1
    -1
      devops/rpmbuild/spectemplates/ethermint.spec
  17. +74
    -0
      devops/rpmbuild/spectemplates/gaia.spec
  18. +1
    -1
      devops/rpmbuild/spectemplates/tendermint.spec
  19. +1
    -1
      devops/rpmbuild/spectemplates/trackomatron.spec

+ 13
- 6
devops/rpmbuild/Makefile View File

@ -32,12 +32,12 @@ endif
# Here comes the real deal
###
binaries = tendermint basecoin ethermint trackomatron
build-binaries = build-tendermint build-basecoin build-ethermint build-trackomatron
package-rpm = package-rpm-tendermint package-rpm-basecoin package-rpm-ethermint package-rpm-trackomatron
install-rpm = install-rpm-tendermint install-rpm-basecoin install-rpm-ethermint install-rpm-trackomatron
package-deb = package-deb-tendermint package-deb-basecoin package-deb-ethermint package-deb-trackomatron
install-deb = install-deb-tendermint install-deb-basecoin install-deb-ethermint install-deb-trackomatron
binaries = tendermint basecoin ethermint trackomatron gaia
build-binaries = build-tendermint build-basecoin build-ethermint build-trackomatron build-gaia
package-rpm = package-rpm-tendermint package-rpm-basecoin package-rpm-ethermint package-rpm-trackomatron package-rpm-gaia
install-rpm = install-rpm-tendermint install-rpm-basecoin install-rpm-ethermint install-rpm-trackomatron install-rpm-gaia
package-deb = package-deb-tendermint package-deb-basecoin package-deb-ethermint package-deb-trackomatron package-deb-gaia
install-deb = install-deb-tendermint install-deb-basecoin install-deb-ethermint install-deb-trackomatron install-deb-gaia
all: $(binaries)
build: $(build-binaries)
@ -84,6 +84,13 @@ build-trackomatron: git-branch
@echo "Workaround: trackomatron package has tracko as the binary - trackomatron needed to get the version number" && rm -rf $(GOPATH)/bin/trackomatron && ln -s $(GOPATH)/bin/tracko $(GOPATH)/bin/trackomatron
@echo "*** Built trackomatron"
build-gaia: git-branch
@echo "*** Building gaia"
go get -d -u go github.com/cosmos/gaia || echo "Workaround so there is no error message."
cd $(GOPATH)/src/github.com/cosmos/gaia && git checkout "$(GIT_BRANCH)" && git pull
$(MAKE) -C $(GOPATH)/src/github.com/cosmos/gaia get_vendor_deps install
@echo "*** Built gaia"
version-%: $(GOPATH)/bin/%
if [ -z "$(BUILD_NUMBER)" ]; then echo "BUILD_NUMBER not set" ; false ; fi
$(eval $*_version=$(shell $< version | cut -d- -f1 ))


+ 6
- 0
devops/rpmbuild/extrafiles/DEBIAN-gaia/changelog View File

@ -0,0 +1,6 @@
gaia (@VERSION@) @STABILITY@; urgency=medium
* Automatic build. See https://github.com/tendermint/basecoin for more information.
-- Greg Szabo <greg@philosobear.com> @DATETIMESTAMP@

+ 1
- 0
devops/rpmbuild/extrafiles/DEBIAN-gaia/compat View File

@ -0,0 +1 @@
9

+ 15
- 0
devops/rpmbuild/extrafiles/DEBIAN-gaia/control View File

@ -0,0 +1,15 @@
Source: gaia
Section: net
Priority: optional
Maintainer: Greg Szabo <greg@philosobear.com>
Build-Depends: debhelper (>=9)
Depends: tendermint (>=0.10.0)
Standards-Version: 3.9.6
Homepage: https://cosmos.network
Package: gaia
Architecture: amd64
Version: @VERSION@
Installed-Size: @INSTALLEDSIZE@
Description: gaia - Tendermint Cosmos delegation game chain
Gaia description comes later.

+ 21
- 0
devops/rpmbuild/extrafiles/DEBIAN-gaia/copyright View File

@ -0,0 +1,21 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: gaia
Source: https://github.com/cosmos/gaia
Files: *
Copyright: 2017 All In Bits, Inc.
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the full text of the Apache License 2.0 can be found
in the file `/usr/share/common-licenses/Apache-2.0'.

+ 45
- 0
devops/rpmbuild/extrafiles/DEBIAN-gaia/postinst View File

@ -0,0 +1,45 @@
#!/bin/sh
# postinst script for gaia
#
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
chown gaia.gaia /etc/gaia
chown gaia.gaia /etc/gaia/tendermint
sudo -Hu gaia gaia init --home /etc/gaia 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu gaia tendermint init --home /etc/gaia/tendermint
#The above command might need some kind of additional option in the future. https://github.com/tendermint/tendermint/issues/542
systemctl daemon-reload
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

+ 41
- 0
devops/rpmbuild/extrafiles/DEBIAN-gaia/postrm View File

@ -0,0 +1,41 @@
#!/bin/sh
# postrm script for gaia
#
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
upgrade|failed-upgrade|abort-upgrade)
systemctl daemon-reload
;;
purge|remove|abort-install|disappear)
systemctl daemon-reload
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

+ 37
- 0
devops/rpmbuild/extrafiles/DEBIAN-gaia/preinst View File

@ -0,0 +1,37 @@
#!/bin/sh
# preinst script for gaia
#
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
if ! grep -q '^gaia:' /etc/passwd ; then
useradd -k /dev/null -r -m -b /etc gaia
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

+ 39
- 0
devops/rpmbuild/extrafiles/DEBIAN-gaia/prerm View File

@ -0,0 +1,39 @@
#!/bin/sh
# prerm script for gaia
#
set -e
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
systemctl stop gaia 2> /dev/null || :
systemctl stop gaia-service 2> /dev/null || :
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

+ 3
- 0
devops/rpmbuild/extrafiles/gaia/etc/systemd/system-preset/50-gaia.preset View File

@ -0,0 +1,3 @@
disable gaia.service
disable gaia-server.service

+ 23
- 0
devops/rpmbuild/extrafiles/gaia/etc/systemd/system/gaia-server.service View File

@ -0,0 +1,23 @@
[Unit]
Description=Gaia server
Requires=network-online.target
BindTo=gaia.service
PartOf=gaia.service
After=network-online.target gaia.service
PropagatesReloadTo=gaia.service
ReloadPropagatedFrom=gaia.service
[Service]
Environment="TMHOME=/etc/gaia/tendermint"
Restart=on-failure
User=gaia
Group=gaia
PermissionsStartOnly=true
ExecStart=/usr/bin/tendermint node
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target gaia.service
Also=gaia.service

+ 28
- 0
devops/rpmbuild/extrafiles/gaia/etc/systemd/system/gaia.service View File

@ -0,0 +1,28 @@
[Unit]
Description=Gaia
#propagates activation, deactivation and activation fails.
Requires=network-online.target
#propagates activation, deactivation, activation fails and stops
BindTo=gaia-server.service
#propagates stop and restart (one-way)
PartOf=gaia-server.service
#order
Before=gaia-server.service
After=network-online.target
#propagates reload
PropagatesReloadTo=gaia-server.service
ReloadPropagatedFrom=gaia-server.service
[Service]
Restart=on-failure
User=gaia
Group=gaia
PermissionsStartOnly=true
ExecStart=/usr/bin/gaia start --without-tendermint --home=/etc/gaia
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
Also=gaia-server.service

+ 12
- 0
devops/rpmbuild/extrafiles/gaia/usr/share/gaia/key.json View File

@ -0,0 +1,12 @@
{
"address": "1B1BE55F969F54064628A63B9559E7C21C925165",
"priv_key": {
"type": "ed25519",
"data": "C70D6934B4F55F1B7BC33B56B9CA8A2061384AFC19E91E44B40C4BBA182953D1619D3678599971ED29C7529DDD4DA537B97129893598A17C82E3AC9A8BA95279"
},
"pub_key": {
"type": "ed25519",
"data": "619D3678599971ED29C7529DDD4DA537B97129893598A17C82E3AC9A8BA95279"
}
}

+ 12
- 0
devops/rpmbuild/extrafiles/gaia/usr/share/gaia/key2.json View File

@ -0,0 +1,12 @@
{
"address": "1DA7C74F9C219229FD54CC9F7386D5A3839F0090",
"priv_key": {
"type": "ed25519",
"data": "34BAE9E65CE8245FAD035A0E3EED9401BDE8785FFB3199ACCF8F5B5DDF7486A8352195DA90CB0B90C24295B90AEBA25A5A71BC61BAB2FE2387241D439698B7B8"
},
"pub_key": {
"type": "ed25519",
"data": "352195DA90CB0B90C24295B90AEBA25A5A71BC61BAB2FE2387241D439698B7B8"
}
}

+ 1
- 1
devops/rpmbuild/spectemplates/basecoin.spec View File

@ -32,7 +32,7 @@ cd %{name}-%{version}
%{__cp} $GOPATH/bin/%{name} $GOPATH/bin/basecli .%{_bindir}
%{__cp} $GOPATH/src/github.com/tendermint/%{name}/LICENSE .%{_defaultlicensedir}/%{name}
cp -r %{_topdir}/extrafiles/basecoin/* ./
cp -r %{_topdir}/extrafiles/%{name}/* ./
%{__chmod} -Rf a+rX,u+w,g-w,o-w .


+ 1
- 1
devops/rpmbuild/spectemplates/ethermint.spec View File

@ -32,7 +32,7 @@ cd %{name}-%{version}
%{__cp} $GOPATH/src/github.com/tendermint/%{name}/setup/genesis.json .%{_sysconfdir}/%{name}/genesis.json
%{__cp} -r $GOPATH/src/github.com/tendermint/%{name}/setup/keystore .%{_sysconfdir}/%{name}
cp -r %{_topdir}/extrafiles/ethermint/* ./
cp -r %{_topdir}/extrafiles/%{name}/* ./
%{__chmod} -Rf a+rX,u+w,g-w,o-w .


+ 74
- 0
devops/rpmbuild/spectemplates/gaia.spec View File

@ -0,0 +1,74 @@
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: gaia
Summary: gaia - Tendermint Cosmos delegation game chain
License: Apache 2.0
URL: https://cosmos.network/
Packager: Greg Szabo
Requires: tendermint >= 0.10.0
Requires(pre): /sbin/useradd
%description
Gaia description comes later.
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
fi
%prep
test -d "$GOPATH" || echo "GOPATH not set"
test -d "$GOPATH"
%{__mkdir_p} %{name}-%{version}
cd %{name}-%{version}
%{__mkdir_p} .%{_bindir} .%{_defaultlicensedir}/%{name} .%{_sysconfdir}/%{name}/tendermint
%{__cp} $GOPATH/bin/%{name} .%{_bindir}
%{__cp} $GOPATH/src/github.com/tendermint/%{name}/LICENSE .%{_defaultlicensedir}/%{name}
cp -r %{_topdir}/extrafiles/%{name}/* ./
%{__chmod} -Rf a+rX,u+w,g-w,o-w .
%build
# Nothing to do here.
%install
cd %{name}-%{version}
%{__cp} -a * %{buildroot}
%post
sudo -Hu %{name} gaia init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
#The above command might need some kind of additional option in the future. https://github.com/tendermint/tendermint/issues/542
#Temporary until https://github.com/tendermint/basecoin/issues/123
rm -f %{_sysconfdir}/%{name}/key.json
rm -f %{_sysconfdir}/%{name}/key2.json
systemctl daemon-reload
%preun
systemctl stop %{name} 2> /dev/null || :
systemctl stop %{name}-service 2> /dev/null || :
%postun
systemctl daemon-reload
%files
%attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
%attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%dir %{_defaultlicensedir}/%{name}
%doc %{_defaultlicensedir}/%{name}/LICENSE

+ 1
- 1
devops/rpmbuild/spectemplates/tendermint.spec View File

@ -18,7 +18,7 @@ test -d "$GOPATH"
%{__mkdir_p} %{name}-%{version}
cd %{name}-%{version}
%{__mkdir_p} .%{_bindir} .%{_defaultlicensedir}/%{name}
%{__cp} $GOPATH/bin/tendermint .%{_bindir}
%{__cp} $GOPATH/bin/%{name} .%{_bindir}
%{__cp} $GOPATH/src/github.com/tendermint/tendermint/LICENSE .%{_defaultlicensedir}/%{name}
%{__chmod} -Rf a+rX,u+w,g-w,o-w .


+ 1
- 1
devops/rpmbuild/spectemplates/trackomatron.spec View File

@ -31,7 +31,7 @@ cd %{name}-%{version}
%{__cp} $GOPATH/bin/tracko $GOPATH/bin/trackocli .%{_bindir}
%{__cp} $GOPATH/src/github.com/tendermint/%{name}/LICENSE .%{_defaultlicensedir}/%{name}
cp -r %{_topdir}/extrafiles/trackomatron/* ./
cp -r %{_topdir}/extrafiles/%{name}/* ./
%{__chmod} -Rf a+rX,u+w,g-w,o-w .


Loading…
Cancel
Save