Compare commits

..

2 Commits

Author SHA1 Message Date
Tristan Andrus e1e8c67e5f Add infrastructure to deal with keys 2025-03-27 07:03:06 -06:00
Tristan Andrus 527ca78721 Add gitignore 2025-03-27 07:02:39 -06:00
5 changed files with 19 additions and 3 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
keys/*
venv/*

View File

@ -6,7 +6,9 @@ COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
RUN apt-get update -y && apt-get upgrade -y RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y rsync RUN apt-get install -y rsync ssh
# TODO: Need to install ssh key here
COPY . ./ COPY . ./

View File

@ -24,7 +24,12 @@ def requestsync():
try: try:
# Run rsync # Run rsync
print("Sync requested... running now.") print("Sync requested... running now.")
subprocess.run(['rsync', '-ravzL', REMOTE_DIRECTORY, LOCAL_DEST], check=True) subprocess.run(['rsync',
'-ravzL',
'-e',
'ssh -i /root/.ssh/id_rsa',
REMOTE_DIRECTORY,
LOCAL_DEST], check=True)
return jsonify({'status': 'OK'}) return jsonify({'status': 'OK'})
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
return jsonify({"error": 'rsync failed', 'details': str(e)}), 500 return jsonify({"error": 'rsync failed', 'details': str(e)}), 500

View File

@ -6,7 +6,6 @@ services:
- "35350:35350" - "35350:35350"
volumes: volumes:
- /serve/data/basket:/serve/data/basket - /serve/data/basket:/serve/data/basket
- $HOME/.ssh:/root/.ssh
environment: environment:
- UID=${UID:-1000} - UID=${UID:-1000}
- GID=1000 - GID=1000

8
setupkeys.sh Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -u -e -o pipefail
mkdir -p keys
ssh-keygen -f keys/id_rsa -t rsa
ssh-copy-id -i keys/id_rsa sinbad@margarita