Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docusaurus docs #42

Merged
merged 22 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
85bcc79
deploy docusaurus docs
Lukas-Heiligenbrunner Aug 4, 2024
fb65e50
add yarn lock
Lukas-Heiligenbrunner Aug 4, 2024
081b854
add path to yarn.lock
Lukas-Heiligenbrunner Aug 4, 2024
f1e98e4
prefix build path
Lukas-Heiligenbrunner Aug 4, 2024
3da6d14
set baseurl
Lukas-Heiligenbrunner Aug 4, 2024
7f0d5fd
set baseurl
Lukas-Heiligenbrunner Aug 4, 2024
1a32734
remove unneeded res folder
Lukas-Heiligenbrunner Aug 4, 2024
46d8afc
improve docs
Lukas-Heiligenbrunner Aug 9, 2024
21216e5
add more infos to docs
Lukas-Heiligenbrunner Aug 16, 2024
858cc8a
add new icon
Lukas-Heiligenbrunner Sep 28, 2024
f265f56
add logo to readme
Lukas-Heiligenbrunner Sep 28, 2024
51cfb97
add tag badges
Lukas-Heiligenbrunner Sep 28, 2024
30246ab
Merge branch 'master' into docusaurus-docs
Lukas-Heiligenbrunner Sep 28, 2024
f47bfad
Merge branch 'logo' into docusaurus-docs
Lukas-Heiligenbrunner Sep 28, 2024
6ee201b
remove default images
Lukas-Heiligenbrunner Sep 28, 2024
7701205
improve quickstart and requirements page
Lukas-Heiligenbrunner Sep 29, 2024
2e8d9d8
add authenticatiion docs
Lukas-Heiligenbrunner Sep 29, 2024
e181ba7
split env setup into several categories
Lukas-Heiligenbrunner Sep 29, 2024
5da0776
add info how to add pacman repo
Lukas-Heiligenbrunner Sep 29, 2024
8642648
cleanup readme and add development.md
Lukas-Heiligenbrunner Sep 29, 2024
7795386
use version without <>
Lukas-Heiligenbrunner Sep 29, 2024
6e2a9ad
build gh pages only on master push or workflow_dispatch
Lukas-Heiligenbrunner Sep 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- 'master'
workflow_dispatch:

jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
cache-dependency-path: './docs/yarn.lock'

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/build

deploy:
name: Deploy to GitHub Pages
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
161 changes: 22 additions & 139 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,152 +1,35 @@
<p align="center">
<a href="https://lukas-heiligenbrunner.github.io/AURCache/">
<img src="frontend/assets/icons/icon.svg" width="200"></a><!-- </a> being on the same line as the <img> tag is intentional! -->
<br>
<br>
<a href="https://github.com/lukas-heiligenbrunner/aurcache/releases">
<img src="https://img.shields.io/github/v/release/lukas-heiligenbrunner/aurcache?style=flat&labelColor=1C2C2E&color=C96329&logo=GitHub&logoColor=white"></a>
<a href="https://github.com/Lukas-Heiligenbrunner/AURCache/pkgs/container/aurcache">
<img src="https://ghcr-badge.egpl.dev/lukas-heiligenbrunner/aurcache/tags?color=%23c26632&ignore=latest&n=3&label=Tags&trim="></a>
<a href="https://github.com/Lukas-Heiligenbrunner/AURCache/pkgs/container/aurcache">
<img src="https://ghcr-badge.egpl.dev/lukas-heiligenbrunner/aurcache/size?color=%23c26632&tag=latest&label=Size&trim="></a>
<br>
</p>

<h4 align="center">
<a href="https://lukas-heiligenbrunner.github.io/AURCache/docs/overview/introduction">Documentation</a> |
<a href="https://lukas-heiligenbrunner.github.io/AURCache/">Website</a>
</h4>

# AURCache

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.

<p><img src="res/imgs/screenshot1.png" alt=""/>
<p><img src="docs/static/img/screenshot1.png" alt=""/>

<details>
<summary>More Images:</summary>
<br>
<img src="res/imgs/screenshot2.png" alt=""/>
<img src="res/imgs/screenshot3.png" alt=""/></p>
<img src="docs/static/img/screenshot2.png" alt=""/>
<img src="docs/static/img/screenshot3.png" alt=""/></p>
</details>

## 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: ghcr.io/lukas-heiligenbrunner/aurcache:latest
ports:
- "8080:8080"
- "8081:8081"
volumes:
- ./aurcache/db:/app/db
- ./aurcache/repo:/app/repo
privileged: true
```

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.
It needs to be a priviledged container to be able to use dind for spawining build containers.

If you are uncomfortable with the priviledged container you can pass through the docker socket and create a volume mounted to
`/app/builds` on aurcache container and set the `BUILD_ARTIFACT_DIR` environment variable to the volume.

For example:
```yaml
version: '3'
services:
aurcache:
image: ghcr.io/lukas-heiligenbrunner/aurcache:latest
ports:
- "8080:8080"
- "8081:8081"
volumes:
- ./aurcache/db:/app/db
- ./aurcache/repo:/app/repo
- /var/run/docker.sock:/var/run/docker.sock
- artifact_cache:/app/builds
environment:
- BUILD_ARTIFACT_DIR=artifact_cache # also absolute path is possible
volumes:
artifact_cache:
name: artifact_cache # this name should match env name above
driver: local
```

But keep in mind with this method containers are spawned on the host system and not in the aurcache container.
(And destroyed afterwards)

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/
```

### Docker Tags
`:git` - current master branch build

`:latest` - latest version

`:<version>` - <version> git tag (latest version = latest tag)
## Configuration
Environment Variables

| Variable | Type | Description | Default |
|------------------------|-----------------------|---------------------------------------------------------------------|---------------------------|
| DB_TYPE | (POSTGRESQL\| SQLITE) | Type of Database (SQLite, PostgreSQL) | SQLITE |
| DB_USER | String | POSTGRES Username (ignored if sqlite) | null |
| DB_PWD | String | POSTGRES Password (ignored if sqlite) | null |
| DB_HOST | String | POSTGRES Host (ignored if sqlite) | null |
| DB_NAME | String | Database name | 'db.sqlite' or 'postgres' |
| VERSION_CHECK_INTERVAL | Integer | Interval in seconds for checking package versions | 3600 |
| BUILD_ARTIFACT_DIR | String | pkg share directory between aurcache container and build containers | null |
| LOG_LEVEL | String | Log level | INFO |
| MAX_CONCURRENT_BUILDS | Integer | Max concurrent builds | 1 |
| CPU_LIMIT | Integer | CPU limit of build container in milli CPUs | 0 |
| MEMORY_LIMIT | Integer | Memory limit of build container in MB | -1 |
| JOB_TIMEOUT | Integer | Job timeout for build in Seconds | 3600 |
| OAUTH_AUTH_URI | String | Oauth authorize endpoint | null |
| OAUTH_TOKEN_URI | String | Oauth token endpoint | null |
| OAUTH_REDIRECT_URI | String | Oauth redirect uri back to AURCache | null |
| OAUTH_CLIENT_ID | String | Oauth client ID | null |
| OAUTH_CLIENT_SECRET | String | Oauth client Secret | null |
| SECRET_KEY | String | \>32Byte Random String for singing cookies | Random |

To disable Oauth support (default) leave all OAUTH_* variables undefined.
## 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

* proper error return from api
* proper logging
* auto update packages
* implement repo-add in rust
* keep older pkg versions in repo (repo-add limitation)


## 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.
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
5 changes: 5 additions & 0 deletions docs/docs/Configuration/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Configuration",
"position": 3
}

16 changes: 16 additions & 0 deletions docs/docs/Configuration/authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Authentication via OAuth2

AURCache supports OAuth2 authentication via various Oauth2 providers such as Authentik or Keycloak.
This allows you to restrict access to your AURCache instance to only users who have authenticated with one of these services.

Setup the following Environment Variables to enable OAuth2 authentication:

| Variable | Type | Description | Default |
|------------------------|-----------------------|---------------------------------------------------------------------|---------------------------|
| OAUTH_AUTH_URI | String | Oauth authorize endpoint | null |
| OAUTH_TOKEN_URI | String | Oauth token endpoint | null |
| OAUTH_REDIRECT_URI | String | Oauth redirect uri back to AURCache | null |
| OAUTH_CLIENT_ID | String | Oauth client ID | null |
| OAUTH_CLIENT_SECRET | String | Oauth client Secret | null |

To disable Authentiation leave all `OAUTH_*` variables undefined.
28 changes: 28 additions & 0 deletions docs/docs/Configuration/environment-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
sidebar_position: 1
---

# Environment Variables
AURCache can be configured using the following environment variables:

## Database Configuration
| Variable | Type | Description | Default |
|------------------------|-----------------------|---------------------------------------------------------------------|---------------------------|
| DB_TYPE | (POSTGRESQL\| SQLITE) | Type of Database (SQLite, PostgreSQL) | SQLITE |
| DB_USER | String | POSTGRES Username (ignored if sqlite) | null |
| DB_PWD | String | POSTGRES Password (ignored if sqlite) | null |
| DB_HOST | String | POSTGRES Host (ignored if sqlite) | null |
| DB_NAME | String | Database name | 'db.sqlite' or 'postgres' |

## General Settings

| Variable | Type | Description | Default |
|------------------------|-----------------------|---------------------------------------------------------------------|---------------------------|
| VERSION_CHECK_INTERVAL | Integer | Interval in seconds for checking package versions | 3600 |
| BUILD_ARTIFACT_DIR | String | pkg share directory between aurcache container and build containers | null |
| LOG_LEVEL | String | Log level | INFO |
| MAX_CONCURRENT_BUILDS | Integer | Max concurrent builds | 1 |
| CPU_LIMIT | Integer | CPU limit of build container in milli CPUs | 0 |
| MEMORY_LIMIT | Integer | Memory limit of build container in MB | -1 |
| JOB_TIMEOUT | Integer | Job timeout for build in Seconds | 3600 |
| SECRET_KEY | String | \>32Byte Random String for singing cookies | Random |
5 changes: 5 additions & 0 deletions docs/docs/overview/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Overview",
"position": 1
}

24 changes: 24 additions & 0 deletions docs/docs/overview/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Development
If you want to contribute to the project feel free to checkout the code and try to fix a bug or implement a feature.

## 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
```
Loading