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

Don't enforce /pds for PDS_DATADIR #196

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ services:
restart: unless-stopped
volumes:
- type: bind
source: /pds/caddy/data
source: @PDS_DATADIR@/caddy/data
target: /data
- type: bind
source: /pds/caddy/etc/caddy
source: @PDS_DATADIR@/caddy/etc/caddy
target: /etc/caddy
pds:
container_name: pds
Expand All @@ -21,10 +21,10 @@ services:
restart: unless-stopped
volumes:
- type: bind
source: /pds
source: @PDS_DATADIR@
target: /pds
env_file:
- /pds/pds.env
- @PDS_DATADIR@/pds.env
watchtower:
container_name: watchtower
image: containrrr/watchtower:latest
Expand Down
10 changes: 2 additions & 8 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ function main {
exit 1
fi

# Enforce that the data directory is /pds since we're assuming it for now.
# Later we can make this actually configurable.
if [[ "${PDS_DATADIR}" != "/pds" ]]; then
usage "The data directory must be /pds. Exiting..."
fi

# Check if PDS is already installed.
if [[ -e "${PDS_DATADIR}/pds.sqlite" ]]; then
echo
Expand Down Expand Up @@ -354,8 +348,8 @@ PDS_CONFIG
--output "${PDS_DATADIR}/compose.yaml" \
"${COMPOSE_URL}"

# Replace the /pds paths with the ${PDS_DATADIR} path.
sed --in-place "s|/pds|${PDS_DATADIR}|g" "${PDS_DATADIR}/compose.yaml"
# Replace the @PDS_DATADIR@ paths with the ${PDS_DATADIR} path.
sed --in-place "s|@PDS_DATADIR@|${PDS_DATADIR}|g" "${PDS_DATADIR}/compose.yaml"

#
# Create the systemd service.
Expand Down
7 changes: 6 additions & 1 deletion pdsadmin/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ set -o errexit
set -o nounset
set -o pipefail

PDS_DATADIR="/pds"
PDS_ENV_FILE=${PDS_ENV_FILE:-"/pds/pds.env"}
source "${PDS_ENV_FILE}"

COMPOSE_FILE="${PDS_DATADIR}/compose.yaml"
COMPOSE_URL="https://raw.githubusercontent.com/bluesky-social/pds/main/compose.yaml"

Expand All @@ -20,6 +22,9 @@ curl \
--output "${COMPOSE_TEMP_FILE}" \
"${COMPOSE_URL}"

# Replace the /pds paths with the ${PDS_DATADIR} path.
sed --in-place "s|@PDS_DATADIR@|${PDS_DATADIR}|g" "${COMPOSE_TEMP_FILE}"

if cmp --quiet "${COMPOSE_FILE}" "${COMPOSE_TEMP_FILE}"; then
echo "PDS is already up to date"
rm --force "${COMPOSE_TEMP_FILE}"
Expand Down