Browse Source

Initial commit

master
Roelf Wichertjes 2 years ago
commit
1404b291a4
Signed by: rewby GPG Key ID: 4C2B6D2972EE5423
3 changed files with 65 additions and 0 deletions
  1. +19
    -0
      .drone.yml
  2. +23
    -0
      Dockerfile
  3. +23
    -0
      mover.sh

+ 19
- 0
.drone.yml View File

@@ -0,0 +1,19 @@
---
kind: pipeline
name: default
steps:
- name: docker
image: plugins/docker
settings:
registry: atdr-writer.meo.ws
username:
from_secret: atdr_user
password:
from_secret: atdr_pass
repo: atdr-writer.meo.ws/rewby/ab-offload
dockerfile: Dockerfile
purge: true
auto_tag: false
tags:
- latest


+ 23
- 0
Dockerfile View File

@@ -0,0 +1,23 @@
FROM debian:bullseye

# Install tini
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

# Add user
RUN groupadd -g 1337 ab
RUN groupadd -r psudo
RUN useradd -rm -d /home/ab -s /bin/bash -g ab -G psudo -u 1337 ab

# Create data mount
RUN mkdir -p /data
RUN chown ab:ab /data

# Switch user
USER ab
WORKDIR /home/ab

COPY mover.sh /home/ab/mover.sh

ENTRYPOINT [ "/tini", "--" ]

+ 23
- 0
mover.sh View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euo pipefail

INCOMING="${INCOMING:-/data/incoming/}"
UPLOAD_QUEUE="${UPLOAD_QUEUE:-/data/upload-queue/}"

# find every .warc.gz in the rsync directory
find "${INCOMING}" -type f -not -name ".*"\
| while read filename
do
# skip partial uploads
if [[ $filename =~ rsync-tmp ]]
then
continue
fi

echo "Moving ${filename}"
mkdir -vp "${UPLOAD_QUEUE}"
mv -v "${filename}" "${UPLOAD_QUEUE}/"
done



Loading…
Cancel
Save