Compare commits

...
5 Commits
Author SHA1 Message Date
julian 6cab77cf22 Add Readme 2026-06-22 08:37:36 +02:00
julian 24e54a1da0 Ignore nix build result 2026-06-22 08:37:27 +02:00
julian ed961c58dd Remove unneeded script 2026-06-22 08:37:16 +02:00
julian 0d80be4715 caddy: fix location from where to serve files 2026-06-22 08:36:57 +02:00
julian f63c603ddb Fix fdroid update in the container 2026-06-22 08:36:34 +02:00
5 changed files with 60 additions and 11 deletions
+1
View File
@@ -14,3 +14,4 @@ devenv.local.nix
# pre-commit
.pre-commit-config.yaml
/result
+47
View File
@@ -0,0 +1,47 @@
# Frajul's F-Droid Repo
This contains the code for the deployment of my own F-Droid.
## Deployment overview
The deployment works via `docker`.
The container is defined in `flake.nix`.
Every `30 min`, it runs the script `hosting/update.sh`, which git-pulls this repo to update its scripts, then executes `scripts/update-apks.sh` and if any apks have been added or removed, it runs `fdroid update` to re-build the repo, which is located in the `fdroid` directory.
This repo is served by a `caddy` server from the container on port `:8080`.
### How to build and deploy
To build the container run:
```sh
nix build .#container
```
To load the resulting `gitlab.julian-mutter.de/julian/fdroid-frajul:latest` container into the local docker daemon, run:
```sh
docker load < result
```
For building and deploying the container to the remote registry, simply run the following command, which is provided by the `flake.nix` dev shell:
```sh
deploy
```
## Container configuration
### Environment variables
- *SOPS_AGE_KEY*
The files `fdroid/config.yml` and `fdroid/keystore.p12` are encrypted with `sops`.
The update script automatically decrypts them on the first start of the container.
For this to work the environment variable `SOPS_AGE_KEY` must be set to the age key used for encrypting.
This key can be generated by running `age-keygen -o key.txt`.
### External volumes
- */apks*
The update script downloads new apk versions into the `/apks` directory.
The apks in there are synced on each update run to the `/src/code/fdroid/repo` directory, where they are served from.
Therefore, the `/apks` directory is the perfect place to mount an external volume to persist all apks and avoid re-downloading on container restart.
## Apk update scripts
To automatically pull new versions of an apk, create a bash script in the `scripts/apk-update-scripts` directory.
This script should be idempotent and download all available apk versions with differring file names into the `/apks` directory, if not already present.
All these scripts are automatically run regularly by `scripts/update-apks.sh`.
+10 -4
View File
@@ -46,19 +46,20 @@
tag = "latest";
contents = with pkgs; [
coreutils
bashInteractive
caddy
dockerTools.fakeNss # Provides fake /etc/passwd for basic user emulation
dockerTools.usrBinEnv
dockerTools.binSh
dockerTools.caCertificates
coreutils
bashInteractive
caddy
fdroidserver
jq
curl
sops
git
rsync
busybox
];
config = {
@@ -67,6 +68,9 @@
ExposedPorts = {
"8080/tcp" = {};
};
Env = [
"PATH=/bin:${pkgs.jdk21_headless}/bin"
];
};
maxLayers = 10;
};
@@ -74,6 +78,8 @@
# nix build .#container
# docker load < result
packages.${system}.container = dockerImage;
# deploy
devShells.${system}.default = pkgs.mkShell {
packages = [
deploy-script
+2 -3
View File
@@ -5,9 +5,8 @@
# 2. Redirect without trailing slash to ensure correct routing
redir /fdroid/repo /fdroid/repo/ 302
# 3. Strip '/fdroid/repo' from the URL and serve the underlying files
handle_path /fdroid/repo/* {
root * /repo/fdroid/repo
file_server browse
root * /src/code/fdroid/repo
file_server
}
}
-4
View File
@@ -1,4 +0,0 @@
#!/usr/bin/env sh
docker build . -t gitlab.julian-mutter.de/julian/fdroid-frajul:latest
docker push gitlab.julian-mutter.de/julian/fdroid-frajul:latest