Skip to content

Commit

Permalink
Github workflow (#19)
Browse files Browse the repository at this point in the history
* Github workflow

* Improve Readme
  • Loading branch information
cocool97 committed Jan 11, 2024
1 parent a32fc92 commit 13afa23
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 5 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Docker image

on: [push, release]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "docker login"
run: |
docker login --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASSWORD }}
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: "docker build"
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USER }}/rhole:${BRANCH_NAME}
env:
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
- name: "docker push"
run: docker push ${{ secrets.DOCKER_USER }}/rhole:${BRANCH_NAME}
env:
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
- name: "docker push latest"
if: ${{ github.event_name == 'release' }}
run: docker push ${{ secrets.DOCKER_USER }}/rhole:latest
15 changes: 15 additions & 0 deletions .github/workflows/rust-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Rust - Build

on: [push]

env:
CARGO_TERM_COLOR: always

jobs:
build-release:
name: "Build release binary"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --release
41 changes: 41 additions & 0 deletions .github/workflows/rust-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Rust - Quality

on: [push]

env:
CARGO_TERM_COLOR: always

jobs:
clippy:
name: "Clippy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup component add clippy
- run : cargo clippy

tests:
name: "Tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: cargo test --verbose

tarpaulin:
name: "Tarpaulin: Code coverage"
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate code coverage
run: |
cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

[![dependency status](https://deps.rs/repo/github/cocool97/rhole/status.svg)](https://deps.rs/repo/github/cocool97/rhole)
[![codecov](https://codecov.io/gh/cocool97/rhole/branch/master/graph/badge.svg)](https://codecov.io/gh/cocool97/rhole)
[![docker pull](https://img.shields.io/docker/pulls/cocool97/rhole.svg)](https://hub.docker.com/repository/docker/cocool97/rhole/tags)

rhole is a fully open-source and community Rust / ReactJS project aiming to empower your privacy, by providing an easy-to-setup DNS server.

Expand Down Expand Up @@ -85,15 +86,15 @@ sources:
## Deployment
A Docker image is compiled at every release and is available on Docker Hub: <https://hub.docker.com/repository/docker/cocool97/rhole/tags>
### Using containers: Docker / Podman
A `Dockerfile` is provided to ease setup.

The previous environment variables can be mounted in Docker image using `-e VAR=VALUE` flag (many times if needed).

```bash
docker build -t rhole:latest -f Dockerfile .
docker run \
-it \
--rm \
Expand All @@ -103,15 +104,14 @@ docker run \
-p 443:443/tcp \
-e DNS_ADDR="0.0.0.0:53" \
-e WEB_ADDR="0.0.0.0:443" \
-e DEBUG=1 \
rhole:latest
cocool97/rhole:latest
```

### Host it behind a reverse proxy

This may be a good security practice to host `rhole` behind a reverse proxy like Nginx, Apache...

Configuration is classic, except the fact that websockets must be accepted to allow for real-time traffic monitoring. The configuration may differ depending on which reverse proxy you choose, you may need to have a look at documentation.
Configuration is classic, except the fact that websockets must be forwarded to allow for real-time traffic monitoring. The configuration may differ depending on which reverse proxy you choose, you may need to have a look at documentation.

## How to use it ?

Expand Down

0 comments on commit 13afa23

Please sign in to comment.