commit
1e126d2f51
@ -1 +1,2 @@ |
||||
%_topdir %(echo $HOME)/rpmbuild |
||||
%_gpg_name Leo Chen <leo@harmony.one> |
||||
|
@ -1,30 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
if [ $# != 1 ]; then |
||||
echo "$0 version" |
||||
exit |
||||
fi |
||||
|
||||
VERSION=$1 |
||||
|
||||
fpm -s dir -t deb -n harmony -p harmony_VERSION_ARCH.deb -C harmony-${VERSION} \ |
||||
-v "$VERSION" \ |
||||
--license "MIT" \ |
||||
--vendor "Harmony Blockchain" \ |
||||
--category "net" \ |
||||
--no-depends \ |
||||
--no-auto-depends \ |
||||
--directories /etc/harmony \ |
||||
--directories /data/harmony \ |
||||
--architecture x86_64 \ |
||||
--maintainer "Leo Chen <leo@harmony.one>" \ |
||||
--description "Harmony is a sharded, fast finality, low fee, PoS public blockchain.\nThis package contains the validator node program for harmony blockchain." \ |
||||
--url "https://harmony.one" \ |
||||
--before-install scripts/preinst \ |
||||
--after-install scripts/postinst \ |
||||
--before-remove scripts/prerm \ |
||||
--after-remove scripts/postrm \ |
||||
--before-upgrade scripts/preup \ |
||||
--after-upgrade scripts/postup \ |
||||
--deb-changelog scripts/changelog \ |
||||
--deb-systemd-restart-after-upgrade |
@ -1 +1,2 @@ |
||||
1.1 improved debian scripts |
||||
1.0 init harmony debian package |
||||
|
@ -0,0 +1,42 @@ |
||||
{ |
||||
"rootDir": "/tmp/.aptly", |
||||
"downloadConcurrency": 4, |
||||
"downloadSpeedLimit": 0, |
||||
"architectures": [], |
||||
"dependencyFollowSuggests": false, |
||||
"dependencyFollowRecommends": false, |
||||
"dependencyFollowAllVariants": false, |
||||
"dependencyFollowSource": false, |
||||
"dependencyVerboseResolve": false, |
||||
"gpgDisableSign": false, |
||||
"gpgDisableVerify": false, |
||||
"gpgProvider": "gpg", |
||||
"downloadSourcePackages": false, |
||||
"skipLegacyPool": true, |
||||
"ppaDistributorID": "ubuntu", |
||||
"ppaCodename": "", |
||||
"FileSystemPublishEndpoints": { |
||||
"harmony-dev": { |
||||
"rootDir": "/tmp/repo", |
||||
"linkMethod": "copy", |
||||
"verifyMethod": "md5" |
||||
} |
||||
}, |
||||
"S3PublishEndpoints": { |
||||
"harmony-dev": { |
||||
"region": "us-east-1", |
||||
"bucket": "haochen-harmony-pub", |
||||
"endpoint": "", |
||||
"awsAccessKeyID": "", |
||||
"awsSecretAccessKey": "", |
||||
"prefix": "pub/repo", |
||||
"acl": "public-read", |
||||
"storageClass": "", |
||||
"encryptionMethod": "", |
||||
"plusWorkaround": false, |
||||
"disableMultiDel": false, |
||||
"forceSigV2": false, |
||||
"debug": false |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,42 @@ |
||||
{ |
||||
"rootDir": "/tmp/.aptly", |
||||
"downloadConcurrency": 4, |
||||
"downloadSpeedLimit": 0, |
||||
"architectures": [], |
||||
"dependencyFollowSuggests": false, |
||||
"dependencyFollowRecommends": false, |
||||
"dependencyFollowAllVariants": false, |
||||
"dependencyFollowSource": false, |
||||
"dependencyVerboseResolve": false, |
||||
"gpgDisableSign": false, |
||||
"gpgDisableVerify": false, |
||||
"gpgProvider": "gpg", |
||||
"downloadSourcePackages": false, |
||||
"skipLegacyPool": true, |
||||
"ppaDistributorID": "ubuntu", |
||||
"ppaCodename": "", |
||||
"FileSystemPublishEndpoints": { |
||||
"harmony-prod": { |
||||
"rootDir": "/tmp/repo", |
||||
"linkMethod": "copy", |
||||
"verifyMethod": "md5" |
||||
} |
||||
}, |
||||
"S3PublishEndpoints": { |
||||
"harmony-prod": { |
||||
"region": "us-west-1", |
||||
"bucket": "pub.harmony.one", |
||||
"endpoint": "", |
||||
"awsAccessKeyID": "", |
||||
"awsSecretAccessKey": "", |
||||
"prefix": "release/package/apt", |
||||
"acl": "public-read", |
||||
"storageClass": "", |
||||
"encryptionMethod": "", |
||||
"plusWorkaround": false, |
||||
"disableMultiDel": false, |
||||
"forceSigV2": false, |
||||
"debug": false |
||||
} |
||||
} |
||||
} |
@ -1,13 +1,64 @@ |
||||
#!/bin/bash |
||||
|
||||
if [ $# != 1 ]; then |
||||
echo "usage: $0 datadir" |
||||
exit 1 |
||||
fi |
||||
ME=$(basename "$0") |
||||
|
||||
function usage() { |
||||
local MSG=$1 |
||||
|
||||
cat<<-EOT |
||||
$MSG |
||||
This script will rclone the harmony db to datadir/archive directory. |
||||
|
||||
Usage: $ME [options] datadir shard |
||||
|
||||
datadir: the root directory of the harmony db (default: /home/harmony) |
||||
shard: the shard number to sync (valid value: 0,1,2,3) |
||||
|
||||
HARMONY_HOME="$1" |
||||
Options: |
||||
-h print this help message |
||||
-c clean up backup db after rclone |
||||
-a sync archival db, instead of regular db |
||||
|
||||
sudo -u harmony mkdir -p ${HARMONY_HOME}/archive |
||||
for i in 0 1 2 3; do |
||||
sudo -u harmony rclone sync -vvv hmy:pub.harmony.one/mainnet.min/harmony_db_$i ${HARMONY_HOME}/archive/harmony_db_$i > ${HARMONY_HOME}/archive/archive-$i.log 2>&1 |
||||
EOT |
||||
exit 1 |
||||
} |
||||
|
||||
CLEAN=false |
||||
FOLDER=mainnet.min |
||||
|
||||
while getopts ":hca" opt; do |
||||
case $opt in |
||||
c) CLEAN=true ;; |
||||
a) FOLDER=mainnet.archival ;; |
||||
*) usage ;; |
||||
esac |
||||
done |
||||
|
||||
shift $((OPTIND - 1)) |
||||
|
||||
if [ $# != 2 ]; then |
||||
usage |
||||
fi |
||||
|
||||
DATADIR="$1" |
||||
SHARD="$2" |
||||
|
||||
if [ ! -d "$DATADIR" ]; then |
||||
usage "ERROR: no datadir directory: $DATADIR" |
||||
fi |
||||
|
||||
case "$SHARD" in |
||||
0|1|2|3) ;; |
||||
*) usage "ERROR: invalid shard number: $SHARD" ;; |
||||
esac |
||||
|
||||
mkdir -p "${DATADIR}/archive" |
||||
|
||||
rclone sync -vvv "hmy:pub.harmony.one/${FOLDER}/harmony_db_${SHARD}" "${DATADIR}/archive/harmony_db_${SHARD}" > "${DATADIR}/archive/archive-${SHARD}.log" 2>&1 |
||||
|
||||
[ -d "${DATADIR}/harmony_db_${SHARD}" ] && mv -f "${DATADIR}/harmony_db_${SHARD}" "${DATADIR}/archive/harmony_db_${SHARD}.bak" |
||||
mv -f "${DATADIR}/archive/harmony_db_${SHARD}" "${DATADIR}/harmony_db_${SHARD}" |
||||
|
||||
if $CLEAN; then |
||||
rm -rf "${DATADIR}/archive/harmony_db_${SHARD}.bak" |
||||
fi |
||||
|
@ -0,0 +1,104 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
ME=$(basename "$0") |
||||
DEPS=(aws createrepo aptly gpg) |
||||
PKG=rpm |
||||
PROFILE=dev |
||||
SRC= |
||||
|
||||
# destination of the bucket to host the repo |
||||
declare -A TARGET |
||||
TARGET[rpm.dev]="haochen-harmony-pub/pub/yum" |
||||
TARGET[deb.dev]="haochen-harmony-pub/pub/repo" |
||||
TARGET[rpm.prod]="pub.harmony.one/release/package/yum" |
||||
TARGET[deb.prod]="pub.harmony.one/release/package/apt" |
||||
|
||||
function usage() { |
||||
cat<<-EOT |
||||
Usage: $ME [options] |
||||
|
||||
Option: |
||||
-h print this help message |
||||
-p dev/prod profile of the repo (dev/prod, default: $PROFILE) |
||||
-n rpm/deb type of package for publish (rpm/deb, default: $PKG) |
||||
-s directory source of the package repo |
||||
|
||||
Examples: |
||||
$ME -p dev -n rpm -s ~/rpmbuild |
||||
|
||||
$ME -p prod -n deb -s ~/debbuild |
||||
|
||||
EOT |
||||
exit 0 |
||||
} |
||||
|
||||
function validation() { |
||||
for dep in "${DEPS[@]}"; do |
||||
if ! command -v "$dep" > /dev/null; then |
||||
echo "missing dependency: $dep" |
||||
exit 1 |
||||
fi |
||||
done |
||||
|
||||
case $PROFILE in |
||||
dev|prod) ;; |
||||
*) usage ;; |
||||
esac |
||||
|
||||
if [[ -z "$SRC" || ! -d "$SRC" ]]; then |
||||
echo "missing source path or wrong path: $SRC" |
||||
exit 1 |
||||
fi |
||||
} |
||||
|
||||
function publish_rpm() { |
||||
local target |
||||
local tempdir |
||||
target=${TARGET[$PKG.$PROFILE]} |
||||
tempdir="/tmp/$(basename $target)" |
||||
mkdir -p "$tempdir/x86_64" |
||||
aws s3 sync "s3://$target" "$tempdir" |
||||
cp -rv $SRC/RPMS/x86_64/* "$tempdir/x86_64" |
||||
UPDATE="" |
||||
if [ -e "$tempdir/x86_64/repodata/repomd.xml" ]; then |
||||
UPDATE="--update" |
||||
fi |
||||
createrepo -v $UPDATE --deltas "$tempdir/x86_64/" |
||||
|
||||
aws s3 sync "$tempdir" "s3://$target" --acl public-read |
||||
} |
||||
|
||||
function publish_deb() { |
||||
if aptly repo show harmony-$PROFILE > /dev/null; then |
||||
aptly repo add harmony-$PROFILE $SRC |
||||
aptly publish update bionic s3:harmony-$PROFILE: |
||||
else |
||||
aptly repo create -distribution=bionic -component=main harmony-$PROFILE |
||||
aptly repo add harmony-$PROFILE $SRC |
||||
aptly publish repo harmony-$PROFILE s3:harmony-$PROFILE: |
||||
fi |
||||
} |
||||
|
||||
################## MAIN ################## |
||||
if [ $# = 0 ]; then |
||||
usage |
||||
fi |
||||
|
||||
while getopts ":hp:n:s:" opt; do |
||||
case $opt in |
||||
p) PROFILE=${OPTARG} ;; |
||||
n) PKG=${OPTARG} ;; |
||||
s) SRC=${OPTARG} ;; |
||||
*) usage ;; |
||||
esac |
||||
done |
||||
|
||||
shift $((OPTIND - 1)) |
||||
|
||||
validation |
||||
|
||||
case $PKG in |
||||
rpm) publish_rpm ;; |
||||
deb) publish_deb ;; |
||||
*) usage ;; |
||||
esac |
@ -0,0 +1,6 @@ |
||||
[harmony-dev] |
||||
name=Development Packages - $basearch |
||||
baseurl=http://haochen-harmony-pub.s3.amazonaws.com/pub/yum/$basearch/ |
||||
enabled=1 |
||||
gpgkey=https://raw.githubusercontent.com/harmony-one/harmony-open/master/harmony-release/harmony-pub.key |
||||
gpgcheck=1 |
@ -0,0 +1,6 @@ |
||||
[harmony-prod] |
||||
name=Production Packages - $basearch |
||||
baseurl=http://pub.harmony.one.s3.amazonaws.com/release/package/yum/$basearch/ |
||||
enabled=1 |
||||
gpgkey=https://raw.githubusercontent.com/harmony-one/harmony-open/master/harmony-release/harmony-pub.key |
||||
gpgcheck=1 |
Loading…
Reference in new issue