@@ -1,7 +1,6 @@ | |||||
*.iml | *.iml | ||||
.idea | .idea | ||||
tmp | tmp | ||||
logs | |||||
dependency-reduced-pom.xml | dependency-reduced-pom.xml | ||||
*.log | *.log | ||||
*~ | *~ | ||||
@@ -2,7 +2,7 @@ | |||||
ANSIBLE_USER="{{node.user}}" | ANSIBLE_USER="{{node.user}}" | ||||
ANSIBLE_HOME="$(cd ~{{node.user}} && pwd)" | ANSIBLE_HOME="$(cd ~{{node.user}} && pwd)" | ||||
LOG=/tmp/bubble.ansible.log | |||||
LOG=/var/log/bubble/ansible.log | |||||
# Stop unattended upgrades so that apt installs will work | # Stop unattended upgrades so that apt installs will work | ||||
# unattended upgrades are re-enabled at the end of the ansible run | # unattended upgrades are re-enabled at the end of the ansible run | ||||
@@ -17,7 +17,7 @@ set -m | |||||
{{#if isNode}} | {{#if isNode}} | ||||
# touch algo log and start tailing it | # touch algo log and start tailing it | ||||
ALGO_LOG=/tmp/bubble.install_algo.log | |||||
ALGO_LOG=/var/log/bubble/install_algo.log | |||||
touch ${ALGO_LOG} && tail -f ${ALGO_LOG} & | touch ${ALGO_LOG} && tail -f ${ALGO_LOG} & | ||||
{{/if}} | {{/if}} | ||||
@@ -14,7 +14,7 @@ | |||||
# Don't setup algo when in restore mode, bubble_restore_monitor.sh will set it up after the CA key has been restored | # Don't setup algo when in restore mode, bubble_restore_monitor.sh will set it up after the CA key has been restored | ||||
- name: Run algo playbook to install algo | - name: Run algo playbook to install algo | ||||
shell: bash -c "/root/ansible/roles/algo/algo/install_algo.sh 2>&1 >> /tmp/bubble.install_algo.log" | |||||
shell: bash -c "/root/ansible/roles/algo/algo/install_algo.sh 2>&1 >> /var/log/bubble/install_algo.log" | |||||
tags: algo_related | tags: algo_related | ||||
# Algo installation clears out iptable rules. Add needed bubble rules back: | # Algo installation clears out iptable rules. Add needed bubble rules back: | ||||
@@ -1,7 +1,7 @@ | |||||
[program:bubble] | [program:bubble] | ||||
stdout_logfile = /home/bubble/logs/bubble-out.log | |||||
stderr_logfile = /home/bubble/logs/bubble-err.log | |||||
stdout_logfile = /var/log/bubble/api-server-out.log | |||||
stderr_logfile = /var/log/bubble/api-server-err.log | |||||
command=sudo -u bubble bash -c "/usr/bin/java \ | command=sudo -u bubble bash -c "/usr/bin/java \ | ||||
-Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true \ | -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true \ | ||||
-XX:+UseG1GC -XX:MaxGCPauseMillis=400 {{ bubble_java_opts }} \ | -XX:+UseG1GC -XX:MaxGCPauseMillis=400 {{ bubble_java_opts }} \ | ||||
@@ -2,7 +2,7 @@ | |||||
# | # | ||||
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | ||||
# | # | ||||
LOG=/tmp/bubble.algo_refresh_users.log | |||||
LOG=/var/log/bubble/algo_refresh_users.log | |||||
ALGO_BASE=/root/ansible/roles/algo/algo | ALGO_BASE=/root/ansible/roles/algo/algo | ||||
REFRESH_MARKER=${ALGO_BASE}/.refreshing_users | REFRESH_MARKER=${ALGO_BASE}/.refreshing_users | ||||
@@ -2,7 +2,7 @@ | |||||
# | # | ||||
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | ||||
# | # | ||||
LOG=/tmp/bubble.algo_refresh_users_monitor.log | |||||
LOG=/var/log/bubble/algo_refresh_users_monitor.log | |||||
function die { | function die { | ||||
echo 1>&2 "${1}" | echo 1>&2 "${1}" | ||||
@@ -2,7 +2,7 @@ | |||||
# | # | ||||
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | ||||
# | # | ||||
LOG=/tmp/bubble.wg_monitor_connections.log | |||||
LOG=/var/log/bubble/wg_monitor_connections.log | |||||
function die { | function die { | ||||
echo 1>&2 "${1}" | echo 1>&2 "${1}" | ||||
@@ -12,7 +12,7 @@ BUBBLE_SELF_NODE="${BUBBLE_HOME}/${SELF_NODE}" | |||||
ADMIN_PORT=${1:?no admin port provided} | ADMIN_PORT=${1:?no admin port provided} | ||||
TIMEOUT=${2:-3600} # 60 minutes default timeout | TIMEOUT=${2:-3600} # 60 minutes default timeout | ||||
LOG=/tmp/bubble.restore.log | |||||
LOG=/var/log/bubble/restore.log | |||||
function die { | function die { | ||||
echo 1>&2 "${1}" | echo 1>&2 "${1}" | ||||
@@ -5,7 +5,7 @@ | |||||
BUBBLE_HOME="/home/bubble" | BUBBLE_HOME="/home/bubble" | ||||
UPGRADE_JAR="${BUBBLE_HOME}/upgrade.jar" | UPGRADE_JAR="${BUBBLE_HOME}/upgrade.jar" | ||||
BUBBLE_JAR="${BUBBLE_HOME}/api/bubble.jar" | BUBBLE_JAR="${BUBBLE_HOME}/api/bubble.jar" | ||||
LOG=/tmp/bubble.upgrade.log | |||||
LOG=/var/log/bubble/upgrade.log | |||||
function die { | function die { | ||||
echo 1>&2 "${1}" | echo 1>&2 "${1}" | ||||
@@ -6,7 +6,7 @@ THIS_DIR="$(cd "$(dirname "${0}")" && pwd)" | |||||
BUBBLE_HOME="/home/bubble" | BUBBLE_HOME="/home/bubble" | ||||
UPGRADE_JAR="${BUBBLE_HOME}/upgrade.jar" | UPGRADE_JAR="${BUBBLE_HOME}/upgrade.jar" | ||||
LOG=/tmp/bubble.upgrade.log | |||||
LOG=/var/log/bubble/upgrade.log | |||||
function log { | function log { | ||||
echo "$(date): ${1}" >> ${LOG} | echo "$(date): ${1}" >> ${LOG} | ||||
@@ -4,7 +4,7 @@ | |||||
# | # | ||||
echo "$@" > /tmp/init.args | echo "$@" > /tmp/init.args | ||||
LOG=/tmp/bubble.init_db.log | |||||
LOG=/var/log/bubble/init_db.log | |||||
function die { | function die { | ||||
echo 1>&2 "${1}" | echo 1>&2 "${1}" | ||||
@@ -9,7 +9,7 @@ function die { | |||||
exit 1 | exit 1 | ||||
} | } | ||||
BUBBLE_TMP_LOGS=/tmp/bubble.* | |||||
BUBBLE_LOGS_FOLDER=/var/log/bubble | |||||
REDIS_LOG_FLAG_KEY="bubble.StandardSelfNodeService.bubble_server_logs_enabled" | REDIS_LOG_FLAG_KEY="bubble.StandardSelfNodeService.bubble_server_logs_enabled" | ||||
SUPERVISOR_CONFIG_DIR=/etc/supervisor/conf.d | SUPERVISOR_CONFIG_DIR=/etc/supervisor/conf.d | ||||
@@ -33,7 +33,7 @@ REDIS_LOG_FLAG=$(test "${REDIS_LOG_FLAG_VALUE}" == "true" && echo true || echo f | |||||
function setLoggingForSupervisorConfig { | function setLoggingForSupervisorConfig { | ||||
cfgFile=${1} | cfgFile=${1} | ||||
logFlag=${2} | logFlag=${2} | ||||
tmpFile=$(mktemp /tmp/bubble_tmp.log_manager.XXXXXX) | |||||
tmpFile=$(mktemp /tmp/bubble.log_manager.XXXXXX) | |||||
while IFS= read -r line; do | while IFS= read -r line; do | ||||
if [[ ${line} == std???_logfile* ]]; then | if [[ ${line} == std???_logfile* ]]; then | ||||
@@ -43,8 +43,9 @@ function setLoggingForSupervisorConfig { | |||||
else | else | ||||
# truncate current log files: | # truncate current log files: | ||||
logFile=$(echo "${line}" | awk -F "=" '{print $2}' | xargs echo) | logFile=$(echo "${line}" | awk -F "=" '{print $2}' | xargs echo) | ||||
truncate -c - s0 "${logFile}" | |||||
# also remove old logs if any: | |||||
# note that current log file will be truncated afterwards at the very end of this shell script together with | |||||
# other logs from this same folder (the log should be in ${BUBBLE_LOGS_FOLDER}). | |||||
# remove old logs if any: | |||||
rm "${logFile}.*" | rm "${logFile}.*" | ||||
# finally, set NONE got log output in supervisor config file's line: | # finally, set NONE got log output in supervisor config file's line: | ||||
echo "${line/_logfile = NONE # /_logfile = /}" >> "${tmpFile}" | echo "${line/_logfile = NONE # /_logfile = /}" >> "${tmpFile}" | ||||
@@ -59,14 +60,14 @@ function setLoggingForSupervisorConfig { | |||||
} | } | ||||
if [[ "${REDIS_LOG_FLAG}" != "true" ]]; then | |||||
# truncate tmp bubble log files each time as those might have some output in between: | |||||
ls "${BUBBLE_TMP_LOGS}" | xargs truncate -c - s0 | |||||
fi | |||||
if [[ "${SUPERVISOR_LOG_FLAG}" != "${REDIS_LOG_FLAG}" ]]; then | if [[ "${SUPERVISOR_LOG_FLAG}" != "${REDIS_LOG_FLAG}" ]]; then | ||||
# change log setup on supervisor configs to match value from redis | # change log setup on supervisor configs to match value from redis | ||||
for cfgFile in ${SUPERVISOR_CONFIG_DIR}/* ; do | for cfgFile in ${SUPERVISOR_CONFIG_DIR}/* ; do | ||||
setLoggingForSupervisorConfig cfgFile REDIS_LOG_FLAG | setLoggingForSupervisorConfig cfgFile REDIS_LOG_FLAG | ||||
done | done | ||||
fi | fi | ||||
if [[ "${REDIS_LOG_FLAG}" != "true" ]]; then | |||||
# truncate tmp bubble log files each time as those might have some output in between: | |||||
ls "${BUBBLE_LOGS_FOLDER}/*" | xargs truncate -c - s0 | |||||
fi |
@@ -2,7 +2,7 @@ | |||||
# | # | ||||
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | ||||
# | # | ||||
LOG=/tmp/bubble.refresh_bubble_ssh_keys.log | |||||
LOG=/var/log/bubble/refresh_bubble_ssh_keys.log | |||||
function die { | function die { | ||||
echo 1>&2 "${1}" | echo 1>&2 "${1}" | ||||
@@ -2,7 +2,7 @@ | |||||
# | # | ||||
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | ||||
# | # | ||||
LOG=/tmp/bubble.ssh_keys_monitor.log | |||||
LOG=/var/log/bubble/ssh_keys_monitor.log | |||||
function die { | function die { | ||||
echo 1>&2 "${1}" | echo 1>&2 "${1}" | ||||
@@ -9,6 +9,10 @@ | |||||
- import_tasks: postgresql.yml | - import_tasks: postgresql.yml | ||||
- name: Create bubble-log group | |||||
group: | |||||
name: bubble-log | |||||
- name: Create bubble user | - name: Create bubble user | ||||
user: | user: | ||||
name: bubble | name: bubble | ||||
@@ -16,6 +20,7 @@ | |||||
shell: /bin/bash | shell: /bin/bash | ||||
system: yes | system: yes | ||||
home: /home/bubble | home: /home/bubble | ||||
groups: bubble-log | |||||
- name: Creates bubble API dir | - name: Creates bubble API dir | ||||
file: | file: | ||||
@@ -27,9 +32,9 @@ | |||||
- name: Creates bubble logs dir | - name: Creates bubble logs dir | ||||
file: | file: | ||||
path: /home/bubble/logs | |||||
path: /var/log/bubble | |||||
owner: bubble | owner: bubble | ||||
group: root | |||||
group: bubble-log | |||||
mode: 0770 | mode: 0770 | ||||
state: directory | state: directory | ||||
@@ -4,7 +4,7 @@ | |||||
# | # | ||||
TARGET_FILE=${1:?no target file provided} | TARGET_FILE=${1:?no target file provided} | ||||
TIMEOUT=${2:?no timeout provided} | TIMEOUT=${2:?no timeout provided} | ||||
LOG=/tmp/bubble.ensure_file_$(echo ${TARGET_FILE} | tr '/' '_').log | |||||
LOG=/var/log/bubble/ensure_file_$(echo ${TARGET_FILE} | tr '/' '_').log | |||||
start=$(date +%s) | start=$(date +%s) | ||||
while [[ ! -s ${TARGET_FILE} && $(expr $(date +%s) - ${start}) -le ${TIMEOUT} ]] ; do | while [[ ! -s ${TARGET_FILE} && $(expr $(date +%s) - ${start}) -le ${TIMEOUT} ]] ; do | ||||
@@ -5,7 +5,7 @@ | |||||
SCRIPT="${0}" | SCRIPT="${0}" | ||||
SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) | SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) | ||||
LOG=/tmp/bubble.snapshot_ansible.log | |||||
LOG=/var/log/bubble/snapshot_ansible.log | |||||
function die { | function die { | ||||
echo 1>&2 "${1}" | echo 1>&2 "${1}" | ||||
@@ -1,5 +1,5 @@ | |||||
[program:nodemanager] | [program:nodemanager] | ||||
stdout_logfile = /home/bubble/logs/nodemanager-out.log | |||||
stderr_logfile = /home/bubble/logs/nodemanager-err.log | |||||
stdout_logfile = /var/log/bubble/nodemanager-out.log | |||||
stderr_logfile = /var/log/bubble/nodemanager-err.log | |||||
command=/usr/sbin/bubble-nodemanager | command=/usr/sbin/bubble-nodemanager |
@@ -2,7 +2,7 @@ | |||||
# | # | ||||
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | ||||
# | # | ||||
LOG=/tmp/bubble.mitm_monitor.log | |||||
LOG=/var/log/bubble/mitm_monitor.log | |||||
function die { | function die { | ||||
echo 1>&2 "${1}" | echo 1>&2 "${1}" | ||||
@@ -27,6 +27,7 @@ | |||||
shell: /bin/bash | shell: /bin/bash | ||||
system: yes | system: yes | ||||
home: /home/mitmproxy | home: /home/mitmproxy | ||||
groups: bubble-log | |||||
- name: Creates mitmproxy dir | - name: Creates mitmproxy dir | ||||
file: | file: | ||||
@@ -2,7 +2,7 @@ | |||||
# | # | ||||
# Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ | ||||
# | # | ||||
LOG=/tmp/bubble.init_certbot.log | |||||
LOG=/var/log/bubble/init_certbot.log | |||||
function log { | function log { | ||||
echo "$(date): ${1}" >> ${LOG} | echo "$(date): ${1}" >> ${LOG} | ||||
@@ -1,6 +1,6 @@ | |||||
#!/bin/bash | #!/bin/bash | ||||
LOG=/tmp/bubble.dhparams.log | |||||
LOG=/var/log/bubble/dhparams.log | |||||
DH_PARAMS=/etc/nginx/dhparams.pem | DH_PARAMS=/etc/nginx/dhparams.pem | ||||
function log { | function log { | ||||