Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage history-archive http server with supervisor #507

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions local/supervisor/etc/supervisord.conf.d/history-archive.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[program:history-archive]
user=stellar
directory=/tmp/stellar-core/history/vs
command=/usr/bin/python3 -m http.server 1570
autostart=true
autorestart=true
startretries=100
priority=10
redirect_stderr=true
5 changes: 1 addition & 4 deletions start
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ function copy_defaults() {
cp /opt/stellar-default/$NETWORK/supervisor/etc/supervisord.conf.d/soroban-rpc.conf $SUPHOME/etc/supervisord.conf.d 2>/dev/null || true
fi
cp /opt/stellar-default/$NETWORK/supervisor/etc/supervisord.conf.d/friendbot.conf $SUPHOME/etc/supervisord.conf.d 2>/dev/null || true
cp /opt/stellar-default/$NETWORK/supervisor/etc/supervisord.conf.d/history-archive.conf $SUPHOME/etc/supervisord.conf.d 2>/dev/null || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider replacing cp with install, as it's working around files in use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "install"? I'm not familiar with that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to merge because I'm not sure how to change to doing an install, and the line I'm adding here is consistent with how existing services confs get added. Let me know how to do an install and happy to follow up in another PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the linux install command is similar to cp, but act as

  1. rm dest
  2. then, cp src dest

The main advantage in using it is to avoid the potential failure of the cp command in case the file is being used.
( there are other benefits, but this is the important one, imho )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL. It also sounds like the other main reason to use install is that it removes the hard link meaning the copy will only replace the file at that one path, not files at all paths sharing the hardlink.

It's very unlikely the file is in use, and equally unlikely the file would have multiple hard links, so I don't think using install will have a material difference.

A downside of install is similar to sed, it's behavior is different on GNU vs BSD linux, so fun times if we encourage use and it ends up in scripts run on Linux and Mac.

fi

if [ -d $COREHOME/etc ]; then
Expand Down Expand Up @@ -367,10 +368,6 @@ function init_stellar_core() {
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
# Start local history server
pushd /tmp/stellar-core/history/vs
python3 -m http.server 1570 > /dev/null 2>&1 &
popd
fi

touch .quickstart-initialized
Expand Down