Skip to content

Commit

Permalink
Merge branch 'master' into pr/tsachiherman/492
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Sep 19, 2023
2 parents 2ce157a + f9301f2 commit b4094aa
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .do/deploy.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
value: stellar/quickstart:latest
scope: BUILD_TIME
- key: NETWORK
value: 'standalone'
value: 'local'
scope: RUN_TIME
- key: ENABLE_SOROBAN_RPC
value: 'false'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
soroban_tools_ref: v0.4.0
test_matrix: |
{
"network": ["testnet", "pubnet", "standalone"],
"network": ["testnet", "pubnet", "local"],
"options": ["", "--enable-horizon-captive-core"],
"exclude": [
{ "network": "testnet", "options": "--enable-horizon-captive-core" },
Expand All @@ -62,7 +62,7 @@ jobs:
soroban_tools_ref: v0.4.0
test_matrix: |
{
"network": ["testnet", "pubnet", "standalone"],
"network": ["testnet", "pubnet", "local"],
"options": ["", "--enable-horizon-captive-core"],
"exclude": [
{ "network": "testnet", "options": "--enable-horizon-captive-core" },
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-soroban-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
soroban_tools_ref: v20.0.0-rc1
test_matrix: |
{
"network": ["standalone"],
"network": ["local"],
"options": ["", "--enable-horizon-captive-core", "--enable-soroban-rpc"],
}
Expand All @@ -62,7 +62,7 @@ jobs:
soroban_rpc_build_runner_type: ubuntu-latest-16-cores
test_matrix: |
{
"network": ["standalone"],
"network": ["local"],
"options": ["", "--enable-horizon-captive-core", "--enable-soroban-rpc"],
}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
soroban_tools_ref: v0.4.0
test_matrix: |
{
"network": ["testnet", "pubnet", "standalone"],
"network": ["testnet", "pubnet", "local"],
"options": ["", "--enable-horizon-captive-core"],
"exclude": [
{ "network": "testnet", "options": "--enable-horizon-captive-core" },
Expand All @@ -63,7 +63,7 @@ jobs:
soroban_tools_ref: v0.4.0
test_matrix: |
{
"network": ["testnet", "pubnet", "standalone"],
"network": ["testnet", "pubnet", "local"],
"options": ["", "--enable-horizon-captive-core"],
"exclude": [
{ "network": "testnet", "options": "--enable-horizon-captive-core" },
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ jobs:
go run test_horizon_ingesting.go
curl http://localhost:8000
- name: Run friendbot test
if: ${{ matrix.network == 'standalone' }}
if: ${{ matrix.network == 'local' }}
run: |
echo "supervisorctl tail -f friendbot" | docker exec -i stellar sh &
echo "supervisorctl tail -f horizon" | docker exec -i stellar sh &
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ RUN ["ln", "-s", "/opt/stellar", "/stellar"]
RUN ["ln", "-s", "/opt/stellar/core/etc/stellar-core.cfg", "/stellar-core.cfg"]
RUN ["ln", "-s", "/opt/stellar/horizon/etc/horizon.env", "/horizon.env"]
ADD common /opt/stellar-default/common
ADD local /opt/stellar-default/local
ADD pubnet /opt/stellar-default/pubnet
ADD testnet /opt/stellar-default/testnet
ADD standalone /opt/stellar-default/standalone
ADD futurenet /opt/stellar-default/futurenet

ARG CORE_SUPPORTS_TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The image uses the following software:

To use this project successfully, you should first decide a few things:

First, decide whether you want your container to be part of the public, production Stellar network (referred to as the _pubnet_) or the test network (called testnet) that we recommend you use while developing software because you need not worry about losing money on the testnet. Additionally, we have added a standalone network (called standalone) which allows you to run your own private Stellar network.
First, decide whether you want your container to be part of the public, production Stellar network (referred to as the _pubnet_) or the test network (called testnet) that we recommend you use while developing software because you need not worry about losing money on the testnet. Alternatively, choose to run a local network (called local) which allows you to run your own private Stellar network.

Next, you must decide whether you will use a docker volume or not. When not using a volume, we say that the container is in _ephemeral mode_, that is, nothing will be persisted between runs of the container. _Persistent mode_ is the alternative, which should be used in the case that you need to either customize your configuration (such as to add a validation seed) or would like avoid a slow catchup to the Stellar network in the case of a crash or server restart. We recommend persistent mode for anything besides a development or test environment.

Expand All @@ -29,7 +29,7 @@ After deciding on the questions above, you can setup your container. Please ref

### Network Options

Provide either `--pubnet`, `--testnet` or `--standalone` as a command line flag when starting the container to determine which network (and base configuration file) to use.
Provide either `--pubnet`, `--testnet` or `--local` as a command line flag when starting the container to determine which network (and base configuration file) to use.

#### `--pubnet`

Expand All @@ -45,9 +45,9 @@ In futurenet network mode, the node will join the [Soroban] test network that de

[Soroban]: https://soroban.stellar.org

#### `--standalone`
#### `--local`

In standalone network mode, you can optionally pass `--protocol-version {version}` parameter to run a specific protocol version (defaults to latest version).
In local network mode, you can optionally pass `--protocol-version {version}` parameter to run a specific protocol version (defaults to latest version).

The network passphrase of the network defaults to:
```
Expand All @@ -64,29 +64,29 @@ Secret Key: SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L

The root account is derived from the network passphrase and if the network passphrase is changed the root account will change. To find out the root account when changing the network passphrase view the logs for stellar-core on its first start. See [Viewing logs](#viewing-logs) for more details.

In standalone network mode a ledger occurs every one second and so transactions
In local network mode a ledger occurs every one second and so transactions
are finalized faster than on deployed networks.

*Note*: The standalone network in this container is not suitable for any production use as it has a fixed root account. Any private network intended for production use would also required a unique network passphrase.
*Note*: The local network in this container is not suitable for any production use as it has a fixed root account. Any private network intended for production use would also required a unique network passphrase.

### Soroban Development

For local development of smart contracts on Stellar using [Soroban], run a `standalone` network and the Soroban stack locally via the `stellar/quickstart:soroban-dev` image:
For local development of smart contracts on Stellar using [Soroban], run a `local` network and the Soroban stack locally via the `stellar/quickstart:soroban-dev` image:

```
$ docker run --rm -it \
-p "8000:8000" \
--name stellar \
stellar/quickstart:soroban-dev \
--standalone \
--local \
--enable-soroban-rpc
```

This will run development versions of stellar-core, horizon, friendbot, and soroban-rpc server that are Soroban enabled.

**Warning: The Soroban RPC Server is in early development and the version included in any quickstart image is a development release with no production capabilities and no API compatibility guarantee. Not recommended for use in production or any environment requiring stability or safety.**

The Soroban RPC server is supported only with the `--standalone` and `--futurenet` network options.
The Soroban RPC server is supported only with the `--local` and `--futurenet` network options.

To enable the Soroban RPC server provide the following command line flags when starting the container:
`--enable-soroban-rpc`
Expand All @@ -102,22 +102,22 @@ http://<container_host>:6061/debug/pprof/

### Deploy to Digital Ocean

You can deploy the quickstart image to DigitalOcean by clicking the button below. It will by default create a container that can be used for development and testing, running the `latest` tag, in ephemeral mode, and on the `standalone` network.
You can deploy the quickstart image to DigitalOcean by clicking the button below. It will by default create a container that can be used for development and testing, running the `latest` tag, in ephemeral mode, and on the `local` network.

[![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/stellar/quickstart/tree/master)

After clicking the button above, the deployment can be configured to deploy a different variant of the image, or join a different network such as `testnet` or `futurenet` by changing environment variables.

Some example configurations that can be used are:
- Standalone network matching pubnet:
- Local network matching pubnet:
`IMAGE`: `stellar/quickstart:latest`
`NETWORK`: `standalone`
- Standalone network matching testnet:
`NETWORK`: `local`
- Local network matching testnet:
`IMAGE`: `stellar/quickstart:testing`
`NETWORK`: `standalone`
- Standalone network matching futurenet:
`NETWORK`: `local`
- Local network matching futurenet:
`IMAGE`: `stellar/quickstart:soroban-dev`
`NETWORK`: `standalone`
`NETWORK`: `local`
`ENABLE_SOROBAN_RPC`: `true`
- Futurenet node:
`IMAGE`: `stellar/quickstart:soroban-dev`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# simple configuration for a standalone test "network"
# simple configuration for a local test "network"
# see stellar-core_example.cfg for a description of the configuration parameters

HTTP_PORT=11626
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# simple captive core configuration for a standalone test "network"
# simple captive core configuration for a local test "network"
NETWORK_PASSPHRASE="__NETWORK__"
# disable the web service port, not used
HTTP_PORT=0
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# simple captive core configuration for a standalone test "network"
# simple captive core configuration for a local test "network"
NETWORK_PASSPHRASE="__NETWORK__"
# disable the web service port, not used
HTTP_PORT=0
Expand Down
41 changes: 23 additions & 18 deletions start
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ CURRENT_POSTGRES_PID=""

function main() {
process_args $*
if [ "$NETWORK" != "standalone" ] && [ "$NETWORK" != "futurenet" ] &&[ "$ENABLE_HORIZON_CAPTIVE_CORE" = "true" ]; then
echo "--enable-horizon-captive-core usage only supported on standalone/futurenet networks" >&2
if [ "$NETWORK" != "local" ] && [ "$NETWORK" != "futurenet" ] &&[ "$ENABLE_HORIZON_CAPTIVE_CORE" = "true" ]; then
echo "--enable-horizon-captive-core usage only supported on local/futurenet networks" >&2
exit 1
fi
if [ "$NETWORK" != "standalone" ] && [ "$NETWORK" != "futurenet" ] && [ "$ENABLE_SOROBAN_RPC" = "true" ]; then
echo "--enable-soroban-rpc usage only supported on standalone/futurenet networks" >&2
if [ "$NETWORK" != "local" ] && [ "$NETWORK" != "futurenet" ] && [ "$ENABLE_SOROBAN_RPC" = "true" ]; then
echo "--enable-soroban-rpc usage only supported on local/futurenet networks" >&2
exit 1
fi
if [ "$ENABLE_SOROBAN_RPC" != "true" ] && [ "$ENABLE_SOROBAN_DIAGNOSTIC_EVENTS" = "true" ]; then
Expand All @@ -50,8 +50,8 @@ function main() {
echo "--enable-soroban-rpc-admin-endpoint usage only supported with --enable-soroban-rpc" >&2
exit 1
fi
if [ "$NETWORK" != "standalone" ] && [ "$RANDOMIZE_NETWORK_PASSPHRASE" = "true" ]; then
echo "--randomize-network-passphrase is only supported in the standalone network" >&2
if [ "$NETWORK" != "local" ] && [ "$RANDOMIZE_NETWORK_PASSPHRASE" = "true" ]; then
echo "--randomize-network-passphrase is only supported in the local network" >&2
exit 1
fi
if [ "$ENABLE_LOGS" = "true" ]; then
Expand All @@ -68,7 +68,8 @@ function start() {
echo "Starting Stellar Quickstart"

echo "mode: $STELLAR_MODE"
echo "network: $NETWORK ($NETWORK_PASSPHRASE)"
echo "network: $NETWORK"
echo "network passphrase: $NETWORK_PASSPHRASE"

copy_defaults
init_db
Expand Down Expand Up @@ -97,8 +98,12 @@ function process_args() {
--pubnet)
NETWORK="pubnet"
;;
--local)
NETWORK="local"
;;
--standalone)
NETWORK="standalone"
echo "deprecated: option --standalone has been replaced by --local"
NETWORK="local"
;;
--futurenet)
NETWORK="futurenet"
Expand Down Expand Up @@ -149,7 +154,7 @@ function process_args() {
export NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015"
export HISTORY_ARCHIVE_URLS="https://history.stellar.org/prd/core-live/core_live_001"
;;
standalone)
local)
export NETWORK_PASSPHRASE="Standalone Network ; February 2017"
# h1570ry - we'll start a webserver connected to history directory later on
export HISTORY_ARCHIVE_URLS="http://localhost:1570"
Expand Down Expand Up @@ -337,7 +342,7 @@ function init_stellar_core() {
if [ -f $COREHOME/.quickstart-initialized ]; then
echo "core: already initialized"

if [ "$NETWORK" = "standalone" ]; then
if [ "$NETWORK" = "local" ]; then
start_postgres

run_silent "init-core-scp" sudo -u stellar stellar-core force-scp --conf $COREHOME/etc/stellar-core.cfg
Expand All @@ -348,13 +353,13 @@ function init_stellar_core() {

run_silent "finalize-core-config-pgpass" perl -pi -e "s/__PGPASS__/$PGPASS/g" etc/stellar-core.cfg
local RUN_STANDALONE=false
if [ "$NETWORK" = "standalone" ] && [ "$ENABLE_HORIZON_CAPTIVE_CORE" = "false" ] && [ "$ENABLE_SOROBAN_RPC" = "false" ]; then
if [ "$NETWORK" = "local" ] && [ "$ENABLE_HORIZON_CAPTIVE_CORE" = "false" ] && [ "$ENABLE_SOROBAN_RPC" = "false" ]; then
RUN_STANDALONE=true
fi

perl -pi -e "s/__NETWORK__/$NETWORK_PASSPHRASE/g" etc/stellar-core.cfg

run_silent "finalize-core-config-run-standalone" perl -pi -e "s/__RUN_STANDALONE__/$RUN_STANDALONE/g" etc/stellar-core.cfg
run_silent "finalize-core-config-run-local" perl -pi -e "s/__RUN_STANDALONE__/$RUN_STANDALONE/g" etc/stellar-core.cfg
run_silent "finalize-core-config-manual-close" perl -pi -e "s/__MANUAL_CLOSE__/$ENABLE_CORE_MANUAL_CLOSE/g" etc/stellar-core.cfg

if [ "$NETWORK" = "standalone" ] && [ "${CORE_SUPPORTS_TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE}" = "true" ]; then
Expand All @@ -367,7 +372,7 @@ function init_stellar_core() {

run_silent "init-core-db" sudo -u stellar stellar-core new-db --conf etc/stellar-core.cfg

if [ "$NETWORK" = "standalone" ]; then
if [ "$NETWORK" = "local" ]; then
run_silent "init-core-scp" sudo -u stellar stellar-core force-scp --conf etc/stellar-core.cfg

run_silent "init-history" sudo -u stellar stellar-core new-hist vs --conf $COREHOME/etc/stellar-core.cfg
Expand Down Expand Up @@ -417,7 +422,7 @@ EOF

run_silent "chown-horizon" chown -R stellar:stellar .

if [[ "$NETWORK" = "standalone" || (".$PROTOCOL_VERSION" != ".none" && $PROTOCOL_VERSION -gt 19) ]] ; then
if [[ "$NETWORK" = "local" || (".$PROTOCOL_VERSION" != ".none" && $PROTOCOL_VERSION -gt 19) ]] ; then
cat << EOF >> etc/horizon.env
export INGEST_DISABLE_STATE_VERIFICATION=True
EOF
Expand Down Expand Up @@ -468,9 +473,9 @@ function init_soroban_rpc() {
popd
}

function upgrade_standalone() {
# Upgrade standalone network's protocol version and base reserve to match pubnet/testnet
if [ "$NETWORK" = "standalone" ]; then
function upgrade_local() {
# Upgrade local network's protocol version and base reserve to match pubnet/testnet
if [ "$NETWORK" = "local" ]; then
# Wait for server
while ! echo "Stellar-core http server listening!" | nc localhost 11626 &> /dev/null; do sleep 1; done
if [ -z "$PROTOCOL_VERSION" ]; then
Expand All @@ -487,7 +492,7 @@ function upgrade_standalone() {

function exec_supervisor() {
echo "supervisor: starting"
upgrade_standalone &
upgrade_local &
service_status &
exec supervisord -n -c $SUPHOME/etc/supervisord.conf \
> >(sed -u 's/^/supervisor: /') \
Expand Down

0 comments on commit b4094aa

Please sign in to comment.