-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
translations: update tc, add papertrail (#121)
- Loading branch information
Showing
11 changed files
with
193 additions
and
18 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
set -exv | ||
|
||
# init helpers | ||
helpers_dir=${MONOPACKER_HELPERS_DIR:-"/etc/monopacker/scripts"} | ||
for h in ${helpers_dir}/*.sh; do | ||
. $h; | ||
done | ||
|
||
# steps from https://papertrailapp.com/systems/setup?type=system&platform=unix#unix-manual | ||
|
||
sudo wget -O /etc/papertrail-bundle.pem \ | ||
https://papertrailapp.com/tools/papertrail-bundle.pem | ||
|
||
# TODO: use helper functions | ||
sudo apt update | ||
sudo apt install rsyslog-gnutls -y | ||
|
||
# source secrets file | ||
. /etc/relops/relops_papertrail_secrets | ||
|
||
export RSYSLOG_FILE=/etc/rsyslog.conf | ||
|
||
cat << EOF >> $RSYSLOG_FILE | ||
# papertrail config | ||
\$DefaultNetstreamDriverCAFile /etc/papertrail-bundle.pem | ||
\$ActionSendStreamDriver gtls | ||
\$ActionSendStreamDriverMode 1 | ||
\$ActionSendStreamDriverAuthMode x509/name | ||
\$ActionSendStreamDriverPermittedPeer *.papertrailapp.com | ||
*.* @@$PAPERTRAIL_HOST:$PAPERTRAIL_PORT | ||
EOF | ||
|
||
# restart service (or wait for new instances to boot up?) | ||
# TOOD: remove/comment when testing is done | ||
sudo service rsyslog restart |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -exv | ||
|
||
# init helpers | ||
helpers_dir=${MONOPACKER_HELPERS_DIR:-"/etc/monopacker/scripts"} | ||
for h in ${helpers_dir}/*.sh; do | ||
. $h; | ||
done | ||
|
||
rm -rf /usr/src/* | ||
|
||
# Do one final package cleanup, just in case. | ||
apt-get autoremove -y --purge |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
set -exv | ||
|
||
# init helpers | ||
helpers_dir=${MONOPACKER_HELPERS_DIR:-"/etc/monopacker/scripts"} | ||
for h in ${helpers_dir}/*.sh; do | ||
. $h; | ||
done | ||
|
||
## using remote-syslog2 (recommended by PT) | ||
# - issues | ||
# - no service... | ||
|
||
# cd /tmp | ||
# wget https://github.com/papertrail/remote_syslog2/releases/download/v0.21/remote-syslog2_0.21_amd64.deb | ||
# sudo dpkg -i remote-syslog*.deb | ||
|
||
## using systemd & ncat (used in ronin-puppet) | ||
|
||
# nmap provides ncat | ||
apt update | ||
apt install -y ncat | ||
|
||
export SERVICE_FILE=/etc/systemd/system/papertrail.service | ||
# TODO: support multipe units? | ||
export UNIT_TO_MONITOR="generic-worker" | ||
|
||
# source secrets file | ||
. /etc/relops/relops_papertrail_secrets | ||
|
||
cat << EOF >> $SERVICE_FILE | ||
[Unit] | ||
Description=Papertrail | ||
After=systemd-journald.service | ||
Requires=systemd-journald.service | ||
[Service] | ||
ExecStart=/bin/sh -c "journalctl -u $UNIT_TO_MONITOR -f | ncat --ssl $PAPERTRAIL_HOST $PAPERTRAIL_PORT" | ||
TimeoutStartSec=0 | ||
Restart=on-failure | ||
RestartSec=5s | ||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
|
||
# reload systemctl so it knows about config | ||
systemctl daemon-reload | ||
|
||
# enable the service on boot | ||
systemctl enable papertrail | ||
|
||
# TODO: start also? can verify it's format is correct... | ||
# - shouldn't be any output on builder (w-m is not started) | ||
systemctl start papertrail |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -exv | ||
|
||
# init helpers | ||
helpers_dir=${MONOPACKER_HELPERS_DIR:-"/etc/monopacker/scripts"} | ||
for h in ${helpers_dir}/*.sh; do | ||
. $h; | ||
done | ||
|
||
rm -rf /usr/src/* | ||
|
||
# Do one final package cleanup, just in case. | ||
apt-get autoremove -y --purge |
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,3 @@ | ||
# This defines the current Taskcluster version, the default version for worker-runner and workers. | ||
env_vars: | ||
TASKCLUSTER_VERSION: 55.1.1 | ||
TASKCLUSTER_VERSION: 59.1.3 |
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