-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pavel Kirilin <[email protected]>
- Loading branch information
Showing
5 changed files
with
187 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: cargo | ||
# Look for `Cargo.toml` and `Cargo.lock` in the root directory | ||
directory: "/" | ||
# Check for updates every Monday | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 2 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
on: push | ||
on: | ||
push: | ||
tags-ignore: | ||
- '**' | ||
|
||
name: Lint check | ||
jobs: | ||
clippy_check: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
publish: | ||
name: Publishing for ${{ matrix.job.os }} | ||
runs-on: ${{ matrix.job.os }} | ||
strategy: | ||
matrix: | ||
rust: [stable] | ||
job: | ||
- os: macos-latest | ||
os-name: macos | ||
target: x86_64-apple-darwin | ||
architecture: x86_64 | ||
binary-postfix: "" | ||
use-cross: false | ||
- os: ubuntu-latest | ||
os-name: linux | ||
target: x86_64-unknown-linux-gnu | ||
architecture: x86_64 | ||
binary-postfix: "" | ||
use-cross: false | ||
- os: windows-latest | ||
os-name: windows | ||
target: x86_64-pc-windows-msvc | ||
architecture: x86_64 | ||
binary-postfix: ".exe" | ||
use-cross: false | ||
# - os: ubuntu-latest | ||
# os-name: linux | ||
# target: aarch64-unknown-linux-gnu | ||
# architecture: arm64 | ||
# binary-postfix: "" | ||
# use-cross: true | ||
# - os: ubuntu-latest | ||
# os-name: linux | ||
# target: i686-unknown-linux-gnu | ||
# architecture: i686 | ||
# binary-postfix: "" | ||
# use-cross: true | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
- uses: Swatinem/rust-cache@v1 | ||
- name: Cargo build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
use-cross: ${{ matrix.job.use-cross }} | ||
toolchain: ${{ matrix.rust }} | ||
args: --release --features=all --target ${{ matrix.job.target }} | ||
|
||
- name: install strip command | ||
shell: bash | ||
run: | | ||
if [[ ${{ matrix.job.target }} == aarch64-unknown-linux-gnu ]]; then | ||
sudo apt update | ||
sudo apt-get install -y binutils-aarch64-linux-gnu | ||
fi | ||
- name: Packaging final binary | ||
shell: bash | ||
run: | | ||
cd target/${{ matrix.job.target }}/release | ||
####### reduce binary size by removing debug symbols ####### | ||
BINARY_NAME=rustus${{ matrix.job.binary-postfix }} | ||
if [[ ${{ matrix.job.target }} == aarch64-unknown-linux-gnu ]]; then | ||
GCC_PREFIX="aarch64-linux-gnu-" | ||
else | ||
GCC_PREFIX="" | ||
fi | ||
"$GCC_PREFIX"strip $BINARY_NAME | ||
########## create tar.gz ########## | ||
RELEASE_NAME=rustus-${GITHUB_REF/refs\/tags\//}-${{ matrix.job.os-name }}-${{ matrix.job.architecture }} | ||
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME | ||
########## create sha256 ########## | ||
if [[ ${{ runner.os }} == 'Windows' ]]; then | ||
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256 | ||
else | ||
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 | ||
fi | ||
- name: Releasing assets | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
target/${{ matrix.job.target }}/release/rustus-*.tar.gz | ||
target/${{ matrix.job.target }}/release/rustus-*.sha256 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
docker_build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Export version | ||
run: echo "APP_VERSION=$(head -n 5 Cargo.toml | grep version | cut -d '"' -f2)" >> $GITHUB_ENV | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: deploy/Dockerfile | ||
tags: s3rius/rustus:latest,s3rius/rustus:${{env.APP_VERSION}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,10 +32,10 @@ from source using `cargo`. | |
cargo install --path . | ||
``` | ||
|
||
Or you can build a docker image. | ||
Or you can use a docker image. | ||
|
||
```bash | ||
docker build --tag="rustus:latest" --cache-from=s3rius/tuser:latest -f deploy/Dockerfile . | ||
docker run --rm -it -p 1081:1081 s3rius/rustus:latest | ||
``` | ||
|
||
Docker image and binaries will be available soon. | ||
|
@@ -47,13 +47,52 @@ In order to modify original file rustus searches for information about | |
the file in information storage. | ||
|
||
However, automatic migration between different information | ||
storages is not supported. | ||
storages is not supported yet. | ||
|
||
## Info storages | ||
|
||
## Configuration | ||
The info storage is a database or directory. The main goal is to keep track | ||
of uploads. Rustus stores information about download in json format inside | ||
database. | ||
|
||
File storage is a default one. You can customize the directory of an .info files | ||
by providing `--info-dir` parameter. | ||
|
||
```bash | ||
rustus --info-dir "./info_dir" | ||
``` | ||
|
||
If you want to choose different storage you have to specify its type and connection string. | ||
|
||
```bash | ||
# Redis info storage | ||
rustus --info-storage redis-info-storage --info-db-dsn "redis://localhost" | ||
# PostgreSQL info storage | ||
rustus --info-storage db-info-storage --info-db-dsn "postgres://rustus:[email protected]:5440/rustus" | ||
# SQLite3 info storage | ||
rustus --info-storage db-info-storage --info-db-dsn "sqlite:////test.sqlite3" | ||
# MySQL | ||
rustus --info-storage db-info-storage --info-db-dsn "mysql://rustus:[email protected]:3306/rustus" | ||
``` | ||
|
||
## Hooks | ||
|
||
Rustus supports several event hooks, such as: | ||
* File hooks; | ||
* HTTP hooks; | ||
* AMQP hooks. | ||
|
||
You can combine them, but you have to be careful, since | ||
AMQP hooks won't block uploading. | ||
|
||
If you want to check the "Authorization" header value or validate some information, | ||
you have to use webhooks or File hooks. | ||
|
||
Hooks have priorities: file hooks are the most important, then goes webhooks and AMQP hooks have the least priority. | ||
If pre-create hook failed, the upload would not start. | ||
Of course, since AMQP is a protocol that doesn't allow you to track responses. | ||
We can't validate anything to stop uploading. | ||
|
||
You can configure rustus via command line or environment variables. | ||
All options are listed in `rustus --help`. | ||
|
||
### Roadmap | ||
|
||
|
@@ -71,7 +110,7 @@ All options are listed in `rustus --help`. | |
* [x] Notification interface; | ||
* [x] Notifications via http hooks; | ||
* [x] Notifications via RabbitMQ; | ||
* [ ] S3 as data storage store support; | ||
* [ ] Executable files notifications; | ||
* [ ] S3 as data storage store support; | ||
* [ ] Rustus helm chart; | ||
* [ ] Cloud native rustus operator. |