-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'private-master' into public-master
- Loading branch information
Showing
40 changed files
with
1,401 additions
and
344 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ logs/* | |
statuses/* | ||
tor/* | ||
app-data/* | ||
data/ | ||
|
||
# Commit these files | ||
|
||
|
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
Large diffs are not rendered by default.
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
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 @@ | ||
version: '3.7' | ||
|
||
services: | ||
tor_server: | ||
container_name: tor_server | ||
image: getumbrel/tor:0.4.7.8@sha256:2ace83f22501f58857fa9b403009f595137fa2e7986c4fda79d82a8119072b6a | ||
user: "1000:1000" | ||
# build: ./deps/tor | ||
restart: on-failure | ||
volumes: | ||
- ${PWD}/tor/torrc-server:/etc/tor/torrc:ro | ||
- ${PWD}/tor/data:/data | ||
environment: | ||
HOME: "/tmp" |
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,5 +1,4 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
./scripts/stop | ||
shutdown -r now |
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,61 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
UMBREL_ROOT="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../..)" | ||
USER_FILE="${UMBREL_ROOT}/db/user.json" | ||
STATUS_FILE="${UMBREL_ROOT}/statuses/remote-tor-access-status.json" | ||
SIGNAL_FILE="${UMBREL_ROOT}/events/signals/remote-tor-access" | ||
|
||
updateStatus() { | ||
local -r state="${1}" | ||
local -r progress="${2}" | ||
|
||
cat <<EOF > "${STATUS_FILE}" | ||
{"state": "${state}", "progress": ${progress}} | ||
EOF | ||
} | ||
|
||
if [[ ! -f "${SIGNAL_FILE}" ]]; then | ||
exit | ||
fi | ||
|
||
enabled=$(cat "${SIGNAL_FILE}") | ||
rm -f "${SIGNAL_FILE}" | ||
|
||
if [[ -f "${STATUS_FILE}" ]]; then | ||
state=$(cat "${STATUS_FILE}" 2> /dev/null | jq -r 'if has("state") then .state else "" end' || true) | ||
|
||
if [[ "${state}" == "running" ]]; then | ||
>&2 echo "Error: Already running!" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
updateStatus "running" "20" | ||
|
||
echo "Stopping Umbrel..." | ||
"${UMBREL_ROOT}/scripts/stop" || true | ||
|
||
updateStatus "running" "50" | ||
|
||
echo | ||
echo "Saving 'remoteTorAccess' setting..." | ||
|
||
while ! (set -o noclobber; echo "$$" > "${USER_FILE}.lock") 2> /dev/null; do | ||
echo "Waiting for JSON lock to be released for ${app} update..." | ||
sleep 1 | ||
done | ||
# This will cause the lock-file to be deleted in case of a | ||
# premature exit. | ||
trap "rm -f "${USER_FILE}.lock"; exit $?" INT TERM EXIT | ||
|
||
jq ".remoteTorAccess = ${enabled}" "${USER_FILE}" > /tmp/user.json | ||
mv /tmp/user.json "${USER_FILE}" | ||
|
||
rm -f "${USER_FILE}.lock" | ||
|
||
echo | ||
echo "Starting Umbrel..." | ||
"${UMBREL_ROOT}/scripts/start" | ||
|
||
updateStatus "complete" "100" |
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,44 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
UMBREL_ROOT="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../..)" | ||
|
||
updateStatus() { | ||
local -r state="${1}" | ||
local -r description="${2}" | ||
local -r url="${3}" | ||
|
||
cat <<EOF > "$UMBREL_ROOT"/statuses/repo-update-status.json | ||
{"state": "${state}", "description": "${description}", "url": "${url}"} | ||
EOF | ||
} | ||
|
||
signal="${1}" | ||
command=${signal%%"-"*} | ||
signal_file="${UMBREL_ROOT}/events/signals/repo-${command}" | ||
if [[ ! -f "${signal_file}" ]]; then | ||
exit | ||
fi | ||
|
||
url=$(cat "${signal_file}") | ||
rm -f "${signal_file}" | ||
|
||
updateStatus "running" "Updating local app repos" "${url}" | ||
|
||
"${UMBREL_ROOT}/scripts/repo" "${command}" "${url}" | ||
|
||
if [[ "${command}" == "add" ]]; then | ||
"${UMBREL_ROOT}/scripts/repo" "update" "${url}" | ||
|
||
# Check that the repo was cloned | ||
repo_path=$("${UMBREL_ROOT}/scripts/repo" path "${url}") | ||
if [[ -d "${repo_path}" ]]; then | ||
updateStatus "success" "Successfully added: ${url}" "${url}" | ||
else | ||
updateStatus "error" "Failed to add: ${url}" "${url}" | ||
fi | ||
elif [[ "${command}" == "remove" ]]; then | ||
updateStatus "success" "Successfully removed: ${url}" "${url}" | ||
else | ||
updateStatus "success" "" "${url}" | ||
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,4 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
./scripts/stop | ||
shutdown -h now |
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
Oops, something went wrong.