This commit is contained in:
Lukas-Heiligenbrunner 2024-02-15 22:17:39 +01:00 committed by GitHub
parent b641cc3c96
commit b07d0ea8a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 95 additions and 9 deletions

View File

@ -1,17 +1,82 @@
# AURCache # AURCache
A cache build server for Archlinux AUR packages and serving them
AURCache is a build server and repository for Archlinux packages sourced from the AUR (Arch User Repository). It features a Flutter frontend and Rust backend, enabling users to add packages for building and subsequently serves them as a pacman repository. Notably, AURCache automatically detects when a package is out of date and displays it within the frontend.
## Deployment with Docker and Docker-compose
To deploy AURCache using Docker and Docker-compose, you can use the following example docker-compose.yml file:
```yaml
version: '3'
services:
aurcache:
image: luki42/aurcache:latest
ports:
- "8080:8080"
- "8081:8081"
volumes:
- ./aurcache/db:/app/db
- ./aurcache/repo:/app/repo
```
Make sure to define the db path and repo path as volumes.
The default Port 8081 serves the Frontend and Port 8080 serves the Repository.
To start AURCache with Docker-compose, run:
```bash
docker-compose up -d
```
Access AURCache through your web browser at http://localhost:8081.
You can now start adding packages for building and utilizing the AURCache repository.
Add the following to your `pacman.conf` on your target machine to use the repo:
```bash
# nano /etc/pacman.conf
[repo]
SigLevel = Optional TrustAll
Server = http://localhost:8080/
```
## Build Info
The AURCache project comprises two main components: a Flutter frontend and a Rust backend.
### Frontend (Flutter)
To build the Flutter frontend, ensure you have Flutter SDK installed. Then, execute the following commands:
```bash
cd frontend
flutter pub get
flutter build web
```
### Backend (Rust)
To build the Rust backend, make sure you have Rust installed. Then, navigate to the backend directory and run:
```bash
cd backend
cargo build --release
```
## Things still missing ## Things still missing
* proper error return to api * proper error return from api
* package updates
* multiple package versions
* error checks if requested package does not exist
* proper logging * proper logging
* auto update packages * auto update packages
* built package version differs from aur pkg version eg. mesa-git
* implement repo-add in rust * implement repo-add in rust
* cicd * keep older pkg versions in repo (repo-add limitation)
* build table where all version builds are with stdout
* endpoint to get build log
## Contributors
Lukas-Heiligenbrunner
## License
This project is licensed under the MIT License. Feel free to contribute and modify as per the guidelines outlined in the license agreement.

View File

@ -14,6 +14,8 @@ use crate::api::embed::CustomHandler;
use crate::builder::types::Action; use crate::builder::types::Action;
use crate::db::migration::Migrator; use crate::db::migration::Migrator;
use crate::scheduler::aur_version_update::start_aur_version_checking; use crate::scheduler::aur_version_update::start_aur_version_checking;
use flate2::read::GzEncoder;
use flate2::Compression;
use rocket::config::Config; use rocket::config::Config;
use rocket::fs::FileServer; use rocket::fs::FileServer;
use rocket::futures::future::join_all; use rocket::futures::future::join_all;
@ -21,6 +23,9 @@ use rocket_okapi::swagger_ui::{make_swagger_ui, SwaggerUIConfig};
use sea_orm::{Database, DatabaseConnection}; use sea_orm::{Database, DatabaseConnection};
use sea_orm_migration::MigratorTrait; use sea_orm_migration::MigratorTrait;
use std::fs; use std::fs;
use std::fs::File;
use tar::Archive;
use tokio::fs::symlink;
use tokio::sync::broadcast; use tokio::sync::broadcast;
fn main() { fn main() {
@ -43,6 +48,22 @@ fn main() {
// create repo folder // create repo folder
if !fs::metadata("./repo").is_ok() { if !fs::metadata("./repo").is_ok() {
fs::create_dir("./repo").unwrap(); fs::create_dir("./repo").unwrap();
let tar_gz = File::create("./repo/repo.db.tar.gz").unwrap();
let enc = GzEncoder::new(tar_gz, Compression::default());
let mut tar = tar::Builder::new(enc);
tar.finish().expect("failed to create repo archive");
symlink("./repo/repo.db.tar.gz", "./repo/repo.db")
.await
.expect("failed to create repo symlink");
let tar_gz = File::create("./repo/repo.files.tar.gz").unwrap();
let enc = GzEncoder::new(tar_gz, Compression::default());
let mut tar = tar::Builder::new(enc);
tar.finish().expect("failed to create repo archive");
symlink("./repo/repo.files.tar.gz", "./repo/repo.files")
.await
.expect("failed to create repo symlink");
} }
let db2 = db.clone(); let db2 = db.clone();