Skip to content

Commit

Permalink
Merge pull request #206 from stellar/add-stellar-rpc-package
Browse files Browse the repository at this point in the history
Create debian package of the Stellar RPC executable !!
  • Loading branch information
aditya1702 authored Oct 30, 2024
2 parents e4d0365 + 3c6af3c commit 3ebbe77
Show file tree
Hide file tree
Showing 14 changed files with 199 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stellar-rpc/debian/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The Debian Package stellar-rpc
----------------------------

RPC is the client facing API server for the Stellar Soroban ecosystem.

-- Package Maintainer <[email protected]>
5 changes: 5 additions & 0 deletions stellar-rpc/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
stellar-rpc (_VERSION_-_BUILD_VERSION_) stable; urgency=medium

* Initial Release.

-- Package Maintainer <[email protected]> Mon, 02 Nov 2022 08:44:05 +0000
1 change: 1 addition & 0 deletions stellar-rpc/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
12 changes: 12 additions & 0 deletions stellar-rpc/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Source: stellar-rpc
Section: web
Priority: optional
Maintainer: Package Maintainer <[email protected]>
Build-Depends: debhelper (>=9), dh-systemd (>=1.5)
Standards-Version: 3.9.6
Homepage: https://www.stellar.org/

Package: stellar-rpc
Architecture: any
Description: Stellar RPC is the client facing API server for the Stellar Soraban Smart Contracts ecosystem. It acts as the interface between stellar-core and applications that want to access smart contracts on the Stellar network.

21 changes: 21 additions & 0 deletions stellar-rpc/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: stellar-rpc
Source: https://www.stellar.org/

Files: *
Copyright: 2017 Stellar Development Foundation
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 complete text of the Apache License 2.0 can
be found in "/usr/share/common-licenses/Apache-2.0"
32 changes: 32 additions & 0 deletions stellar-rpc/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1


# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


%:
dh $@ --with systemd

override_dh_systemd_start:
dh_systemd_start --restart-after-upgrade

# Disable dh_strip to ship unmodified binary in the package.
# This allows anyone to "go build" exactly the same binary
# we ship with the package (reproducible builds)
override_dh_strip:

# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

1 change: 1 addition & 0 deletions stellar-rpc/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
17 changes: 17 additions & 0 deletions stellar-rpc/debian/stellar-rpc.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## /etc/default/stellar-rpc

# define the port on local machine that stellar rpc server will bind to.
ENDPOINT=localhost:8003
# for now rpc requires access to horizon, this will change.
HORIZON_URL=http://localhost:8000
NETWORK_PASSPHRASE="Test SDF Future Network ; October 2022"
# for now rpc requires access to core, this will change.
STELLAR_CORE_URL="http://localhost:11626"

# minimum log severity (debug, info, warn, error), default=info
# LOG_LEVEL=info
# Maximum number of concurrent transaction submissions, default=10
# TX_CONCURRENCY=10
# Maximum length of pending transactions queue, default=10
# TX_QUEUE=10

2 changes: 2 additions & 0 deletions stellar-rpc/debian/stellar-rpc.dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/var/lib/stellar/
/var/log/stellar/
1 change: 1 addition & 0 deletions stellar-rpc/debian/stellar-rpc.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stellar-rpc usr/bin/
1 change: 1 addition & 0 deletions stellar-rpc/debian/stellar-rpc.links
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/stellar/stellar-core_captive-futurenet.cfg /etc/stellar/soroban-rpc/stellar-captive-core.cfg
46 changes: 46 additions & 0 deletions stellar-rpc/debian/stellar-rpc.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh
# postinst script for stellar-rpc
#
# see: dh_installdeb(1)

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
ROLE=stellar;

case "$1" in
configure)
# check stellar user exists
if ! getent passwd stellar > /dev/null; then
adduser --system --group --quiet --home /var/lib/stellar \
--no-create-home --disabled-password --shell /bin/bash $ROLE;
fi

chown -R stellar:stellar /var/lib/stellar/ /var/log/stellar/
;;

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
21 changes: 21 additions & 0 deletions stellar-rpc/debian/stellar-rpc.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description=SDF - stellar-rpc
Before=multi-user.target

[Service]
User=stellar
Group=stellar
LimitNOFILE=8192
StandardOutput=append:/var/log/stellar/stellar-rpc.log
StandardError=append:/var/log/stellar/stellar-rpc.log
SyslogIdentifier=stellar-rpc
EnvironmentFile=/etc/default/stellar-rpc
ExecStart=/usr/bin/stellar-rpc
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=simple

[Install]
WantedBy=multi-user.target
33 changes: 33 additions & 0 deletions stellar-rpc/stellar-core_captive-futurenet.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is a sample configuration from the stellar-captive-core package.
# Please note that only HOME_DOMAINS and VALIDATORS tables are required.

# IMPORTANT
# You need to change domains and validators below to fit your needs

# captive core config for futurenet
NETWORK_PASSPHRASE="Test SDF Future Network ; October 2022"
# disable the web service port, not used
HTTP_PORT=0
PUBLIC_HTTP_PORT=false
# To avoid conflicts with the core instance
PEER_PORT=11726
DATABASE="sqlite3:///var/lib/stellar/soroban-rpc/captive-core/stellar-rpc.db"

EXPERIMENTAL_BUCKETLIST_DB=true
EXPERIMENTAL_BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT=12
ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=false

FAILURE_SAFETY=0
UNSAFE_QUORUM=true

[[HOME_DOMAINS]]
HOME_DOMAIN="futurenet.stellar.org"
QUALITY="MEDIUM"

[[VALIDATORS]]
NAME="sdf_futurenet_1"
HOME_DOMAIN="futurenet.stellar.org"
PUBLIC_KEY="GBRIF2N52GVN3EXBBICD5F4L5VUFXK6S6VOUCF6T2DWPLOLGWEPPYZTF"
ADDRESS="core-live-futurenet.stellar.org:11625"
HISTORY="curl -sf https://history-futurenet.stellar.org/{0} -o {1}"

0 comments on commit 3ebbe77

Please sign in to comment.