-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
109 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
#!/bin/bash -e | ||
source /usr/bin/philbot_init_otel | ||
|
||
if [ "$1" = "triggered" ]; then | ||
philbot_stop | ||
if [ "$1" = 'abort-configure' ] || [ "$1" = 'abort-upgrade' ] || [ "$1" = 'abort-remove' ] || [ "$1" = 'abort-deconfigure' ]; then | ||
exit 0 | ||
elif [ "$1" = 'triggered' ] || [ "$1" = 'reconfigure' ]; then | ||
philbot_config_populate | ||
philbot_restart | ||
elif [ "$1" = 'configure' ]; then | ||
philbot_config_populate | ||
source /usr/bin/philbot_init_otel | ||
wget -O /opt/philbot/libopus.tar.bz2 https://anaconda.org/anaconda/libopus/1.3/download/linux-64/libopus-1.3-h7b6447c_0.tar.bz2 | ||
tar -xf /opt/philbot/libopus.tar.bz2 -C /opt/philbot | ||
rm /opt/philbot/libopus.tar.bz2 | ||
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 | ||
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 4443 | ||
iptables-save > /etc/iptables/rules.v4 | ||
systemctl daemon-reload | ||
systemctl enable philbot_scheduler philbot_discordgateway2http philbot_backend philbot_voice | ||
philbot_start | ||
else | ||
exit 1 | ||
fi | ||
|
||
philbot_config_populate | ||
source /usr/bin/philbot_init_otel | ||
|
||
wget -O /opt/philbot/libopus.tar.bz2 https://anaconda.org/anaconda/libopus/1.3/download/linux-64/libopus-1.3-h7b6447c_0.tar.bz2 | ||
tar -xf /opt/philbot/libopus.tar.bz2 -C /opt/philbot | ||
rm /opt/philbot/libopus.tar.bz2 | ||
|
||
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 | ||
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 4443 | ||
iptables-save > /etc/iptables/rules.v4 | ||
|
||
systemctl daemon-reload | ||
systemctl enable philbot_scheduler philbot_discordgateway2http philbot_backend philbot_voice | ||
philbot_start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
#!/bin/bash | ||
#!/bin/bash -e | ||
if [ -f /usr/bin/philbot_init_otel ]; then | ||
source /usr/bin/philbot_init_otel | ||
fi | ||
systemctl daemon-reload | ||
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then | ||
rm -rf /opt/philbot | ||
if [ "$1" = 'remove' ] || [ "$1" = 'purge' ] || [ "$1" = 'disappear' ]; then | ||
rm -rf /opt/philbot /var/lib/philbot/collector.yaml /var/lib/philbot/environment.properties.* | ||
elif [ "$1" = 'upgrade' ]; then | ||
true | ||
elif [ "$1" = 'failed-upgrade' ] || [ "$1" = 'abort-install' ] || [ "$1" = 'abort-upgrade' ]; then | ||
true | ||
else | ||
exit 1 | ||
fi | ||
rm /var/lib/philbot/collector.yaml /var/lib/philbot/environment.properties.* | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
#!/bin/bash | ||
#!/bin/bash -e | ||
if [ -f /usr/bin/philbot_init_otel ]; then | ||
source /usr/bin/philbot_init_otel | ||
fi | ||
philbot_stop | ||
exit 0 | ||
if [ "$1" = 'install' ]; then | ||
true | ||
elif [ "$1" = 'upgrade' ]; then | ||
philbot_stop | ||
elif [ "$1" = 'abort-upgrade' ]; then | ||
philbot_start || true | ||
else | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
#!/bin/bash | ||
#!/bin/bash -e | ||
source /usr/bin/philbot_init_otel | ||
philbot_stop | ||
systemctl disable philbot_scheduler philbot_discordgateway2http philbot_backend philbot_voice | ||
exit 0 | ||
if [ "$1" = 'remove' ] || [ "$1" = 'upgrade' ] || [ "$1" = 'deconfigure' ]; then | ||
philbot_stop | ||
systemctl disable philbot_scheduler philbot_discordgateway2http philbot_backend philbot_voice | ||
elif [ "$1" = 'failed-upgrade' ]; then | ||
philbot_start || true | ||
else | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
Package: philbot-containerized | ||
Provides: philbot-deployment | ||
Version: 2.8.10 | ||
Version: 2.9.0 | ||
Architecture: all | ||
Depends: philbot-config (>= 4.0.0), debconf, bash, parallel, cron, wget, docker.io, iptables-persistent, jq, opentelemetry-shell (>= 2.6.1) | ||
Conflicts: philbot-baremetal, philbot-k8s | ||
Priority: extra | ||
Maintainer: Philipp Lengauer <[email protected]> | ||
Homepage: https://github.com/plengauer/Philbot | ||
Description: Philbot as containerized installation, bot will auto-update | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,39 @@ | ||
#!/bin/bash -e | ||
source /usr/bin/philbot_init_otel | ||
|
||
if [ "$1" = "triggered" ]; then | ||
philbot_stop >&2 | ||
if [ "$1" = 'abort-configure' ] || [ "$1" = 'abort-upgrade' ] || [ "$1" = 'abort-remove' ] || [ "$1" = 'abort-deconfigure' ]; then | ||
true | ||
elif [ "$1" = 'triggered' ] || [ "$1" = 'reconfigure' ]; then | ||
philbot_config_populate | ||
philbot_stop | ||
philbot_start | ||
elif [ "$1" = 'configure' ]; then | ||
philbot_config_populate | ||
source /usr/bin/philbot_init_otel | ||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.scheduler | ||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.discordgateway2http | ||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.backend | ||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.voice | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.scheduler | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.discordgateway2http | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.backend | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.voice | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.scheduler | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.discordgateway2http | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.backend | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.voice | ||
. /usr/share/debconf/confmodule | ||
config() { db_get philbot-containerized/"$*"; echo "$*=$RET"; } | ||
config SHARD_COUNT_MIN >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
config SHARD_COUNT_MAX >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
config SHARD_COUNT_REDUNDANT >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
db_stop | ||
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 | ||
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 4443 | ||
iptables-save > /etc/iptables/rules.v4 | ||
if [ ! -f "/opt/philbot/shards" ]; then echo "SHARD_COUNT=0" > /opt/philbot/shards; fi | ||
philbot_start >&2 | ||
curl -v http://127.0.0.1:8080/invite 2>&1 | grep location | rev | cut -d' ' -f1 | rev | xargs echo 'Invite with' >&2 | ||
fi | ||
|
||
philbot_config_populate | ||
source /usr/bin/philbot_init_otel | ||
|
||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.scheduler | ||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.discordgateway2http | ||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.backend | ||
echo "OPENTELEMETRY_TRACES_API_ENDPOINT=http://127.0.0.1:4318/v1/traces" >> /var/lib/philbot/environment.properties.voice | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.scheduler | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.discordgateway2http | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.backend | ||
echo "OPENTELEMETRY_METRICS_API_ENDPOINT=http://127.0.0.1:4318/v1/metrics" >> /var/lib/philbot/environment.properties.voice | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.scheduler | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.discordgateway2http | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.backend | ||
echo "OPENTELEMETRY_LOGS_API_ENDPOINT=http://127.0.0.1:4318/v1/logs" >> /var/lib/philbot/environment.properties.voice | ||
|
||
. /usr/share/debconf/confmodule | ||
config() { | ||
db_get philbot-containerized/"$*" | ||
echo "$*=$RET" | ||
} | ||
config SHARD_COUNT_MIN >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
config SHARD_COUNT_MAX >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
config SHARD_COUNT_REDUNDANT >> /var/lib/philbot/environment.properties.discordgateway2httpmaster | ||
db_stop | ||
|
||
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 | ||
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 4443 | ||
iptables-save > /etc/iptables/rules.v4 | ||
|
||
if [ ! -f "/opt/philbot/shards" ]; then | ||
echo "SHARD_COUNT=0" > /opt/philbot/shards | ||
fi | ||
philbot_start >&2 | ||
|
||
curl -v http://127.0.0.1:8080/invite 2>&1 | grep location | rev | cut -d' ' -f1 | rev | xargs echo 'Invite with' >&2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
#!/bin/bash | ||
#!/bin/bash -e | ||
if [ -f /usr/bin/philbot_init_otel ]; then | ||
source /usr/bin/philbot_init_otel | ||
fi | ||
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then | ||
if [ "$1" = 'remove' ] || [ "$1" = 'purge' ] || [ "$1" = 'disappear' ]; then | ||
rm /opt/philbot/shards /var/lib/philbot/collector.yaml /var/lib/philbot/environment.properties.* | ||
docker image prune --all --force | ||
elif [ "$1" = 'upgrade' ]; then | ||
true | ||
elif [ "$1" = 'failed-upgrade' ] || [ "$1" = 'abort-install' ] || [ "$1" = 'abort-upgrade' ]; then | ||
true | ||
else | ||
exit 1 | ||
fi | ||
rm /opt/philbot/shards /var/lib/philbot/collector.yaml /var/lib/philbot/environment.properties.* | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
#!/bin/bash | ||
#!/bin/bash -e | ||
if [ -f /usr/bin/philbot_init_otel ]; then | ||
source /usr/bin/philbot_init_otel | ||
fi | ||
philbot_stop | ||
exit 0 | ||
if [ "$1" = 'install' ] || [ "$1" = 'upgrade' ]; then | ||
philbot_stop | ||
elif [ "$1" = 'abort-upgrade' ]; then | ||
philbot_start || true | ||
else | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
#!/bin/bash -e | ||
source /usr/bin/philbot_init_otel | ||
philbot_stop | ||
if [ "$1" = 'remove' ] || [ "$1" = 'upgrade' ] || [ "$1" = 'deconfigure' ]; then | ||
philbot_stop | ||
elif [ "$1" = 'failed-upgrade' ]; then | ||
philbot_start || true | ||
else | ||
exit 1 | ||
fi |