Skip to content

Commit

Permalink
Merged with main
Browse files Browse the repository at this point in the history
  • Loading branch information
ottojwittner committed Jan 31, 2024
2 parents 3f76ba7 + ffa56e0 commit 50537a5
Show file tree
Hide file tree
Showing 15 changed files with 543 additions and 381 deletions.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: [Ravinou]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for GitHub Actions
# src: https://github.com/marketplace/actions/build-and-push-docker-images#keep-up-to-date-with-github-dependabot
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
34 changes: 34 additions & 0 deletions .github/workflows/docker-image-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and Push Docker Image

on:
push:
branches:
- 'main'

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm
tags: borgwarehouse/borgwarehouse:latest
38 changes: 38 additions & 0 deletions .github/workflows/docker-image-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and Push Docker Image on Release

on:
release:
types:
- published

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Get Release Tag
id: get_release_tag
run: echo "::set-output name=TAG::${{ github.event.release.tag_name }}"
-
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: borgwarehouse/borgwarehouse:${{ steps.get_release_tag.outputs.TAG }}
24 changes: 24 additions & 0 deletions .github/workflows/docker-image-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test Docker Container Build on Pull Request

on:
pull_request:
branches:
- main

jobs:
build-container:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build Docker Container
run: |
docker buildx build --platform linux/amd64,linux/arm64 -t borgwarehouse:pr-${{ github.event.pull_request.number }} .
23 changes: 23 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches:
- main
- develop
pull_request:
branches: main

name: "Shellcheck"
permissions: {}

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC1091
10 changes: 6 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Run test against shells with "pre-commit run shellcheck --all-files"
repos:
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
files: helpers/shells/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-bookworm-slim as base
FROM node:20-bookworm-slim as base

# build stage
FROM base AS deps
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
</a>
</div>

## ⭐ Support the Project

If you find BorgWarehouse helpful or interesting, please consider **giving it a star on GitHub** and **[sponsoring](https://github.com/sponsors/Ravinou)**. Your support is greatly appreciated!

## ✨ What is BorgWarehouse ?

**BorgWarehouse is a graphical interface to manage a central [BorgBackup](https://borgbackup.readthedocs.io/en/stable/#what-is-borgbackup) repository server.**
Expand All @@ -46,7 +50,7 @@ The whole system part is automatically managed by BorgWarehouse and **you don't

You can find the documentation here : [borgwarehouse.com](https://borgwarehouse.com/docs/prologue/introduction/)

## :key: Environment Variables
## 🔑 Environment Variables

To run this project, you will need to add some environment variables.

Expand All @@ -59,6 +63,10 @@ Check the online documentation [just here](https://borgwarehouse.com/docs/admin-
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->

## ❤️ Special thanks to sponsors ❤️

<a href="https://github.com/shad-lp"><img src="https://avatars.githubusercontent.com/shad-lp" style="width:50px; border-radius:50%;"/></a>

[next.js]: https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white
[next-url]: https://nextjs.org/
[react.js]: https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB
Expand Down
7 changes: 4 additions & 3 deletions helpers/shells/deleteRepo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ fi
# Delete the repository and the line associated in the authorized_keys file
if [ -d "${pool}/${repositoryName}" ]; then
# Delete the repository
rm -rf "${pool}/${repositoryName}"
rm -rf """${pool}""/""${repositoryName:?}"""
# Delete the line in the authorized_keys file
sed -i "/${repositoryName}/d" "${authorized_keys}"
echo -n "The folder "${pool}/${repositoryName}" and all its data have been deleted. The line associated in the authorized_keys file has been deleted."
echo -n "The folder ""${pool}"/"${repositoryName}"" and all its data have been deleted. The line associated in the authorized_keys file has been deleted."
else
# Delete the line in the authorized_keys file
sed -i "/${repositoryName}/d" "${authorized_keys}"
echo -n "The folder "${pool}/${repositoryName}" did not exist (repository never initialized or used). The line associated in the authorized_keys file has been deleted."
echo -n "The folder ""${pool}"/"${repositoryName}"" did not exist (repository never initialized or used). The line associated in the authorized_keys file has been deleted."
fi

HOSTNAME=$2
Expand All @@ -61,3 +61,4 @@ if [ $HOSTNAME ]; then
# Run ufw command
bash -c "$UFW_CMD" 2>&1 >/dev/null
fi

4 changes: 2 additions & 2 deletions helpers/shells/getLastSave.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ fi
# Default value if .env not exists
: "${home:=/home/borgwarehouse}"

if [ -n "$(find -L ${home}/repos -mindepth 1 -maxdepth 1 -type d)" ]; then
if [ -n "$(find "${home}"/repos -mindepth 1 -maxdepth 1 -type d)" ]; then
stat --format='{"repositoryName":"%n","lastSave":%Y}' \
${home}/repos/*/integrity* |
"${home}"/repos/*/integrity* |
jq --slurp '[.[] | .repositoryName = (.repositoryName | split("/")[-2])]'
else
echo "[]"
Expand Down
2 changes: 1 addition & 1 deletion helpers/shells/getStorageUsed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ fi
: "${home:=/home/borgwarehouse}"

# Use jc to output a JSON format with du command
cd ${home}/repos
cd "${home}"/repos
du -s -- * | jc --du
2 changes: 1 addition & 1 deletion helpers/shells/updateRepo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ regex="command=\".*${repositoryName}.*\",restrict"
while IFS= read -r line; do
if [[ $line =~ $pattern ]]; then
# Get the SSH pub key of the line (ignore the comment)
key1=$(echo ${BASH_REMATCH[0]} | awk '{print $1 " " $2}')
key1=$(echo "${BASH_REMATCH[0]}" | awk '{print $1 " " $2}')
# Get the SSH pub key of the new SSH pub key (ignore the comment)
key2=$(echo "$2" | awk '{print $1 " " $2}')

Expand Down
Loading

0 comments on commit 50537a5

Please sign in to comment.