Skip to content

Commit

Permalink
Merge pull request #21 from MindsHub/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Usioumeo authored Aug 20, 2024
2 parents 9e39bf5 + e8de276 commit e48cd6a
Show file tree
Hide file tree
Showing 63 changed files with 25,703 additions and 131 deletions.
42 changes: 42 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Rocket ###
debug/
target/
Cargo.lock
**/*.rs.bk
*.pdb
.env
#Rocket.toml

# temporaneo
pills.json
log
tree
nohup*
dump.sql
test.sql


# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/




# End of https://www.toptal.com/developers/gitignore/api/django

monitoring/

#Insigno.toml
docs
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ name="insignolib"
path = "src/lib.rs"

[dependencies]
openssl-sys = { version = "*", features = ["vendored"] }
diesel_migrations = {version="2.2.0"}
diesel = {version="2.0.3", default-features = false, features = ["chrono", "postgres"] }
postgis_diesel = {version="2.1.0", default-features = false}
#postgis = "0.9.0"
Expand All @@ -37,4 +39,7 @@ pq-sys={version="0.6", features = ["bundled"]}
regex = { features = ["std"], default-features = false, version = "1.9" }

[dev-dependencies]
form-data-builder = "1.0"
form-data-builder = "1.0"

[patch.crates-io]
pq-src = { path = "../pq-sys/pq-src" }
74 changes: 59 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,79 @@
# Leveraging the pre-built Docker images with
# cargo-chef and the Rust toolchain
FROM rust:alpine AS chef
WORKDIR /app
#
#base image to use to compile for each architecture

FROM --platform=$BUILDPLATFORM ghcr.io/cross-rs/x86_64-unknown-linux-musl AS build-amd64
FROM --platform=$BUILDPLATFORM ghcr.io/cross-rs/arm-unknown-linux-musleabihf AS build-armv6
FROM --platform=$BUILDPLATFORM ghcr.io/cross-rs/armv7-unknown-linux-musleabihf AS build-armv7
FROM --platform=$BUILDPLATFORM ghcr.io/cross-rs/aarch64-unknown-linux-musl AS build-arm64
FROM --platform=$BUILDPLATFORM rust AS rust
#FROM --platform=$BUILDPLATFORM ghcr.io/cross-rs/aarch64-unknown-linux-musl AS build-386
#FROM --platform=$BUILDPLATFORM ghcr.io/cross-rs/aarch64-unknown-linux-musl AS build-riscv64

RUN apk add --no-cache curl postgresql-dev openssl-dev openssl-libs-static
FROM build-$TARGETARCH$TARGETVARIANT AS chef
#some cross env

ARG PKG_CONFIG_ALLOW_CROSS=1
ARG CARGO_HOME=/root/.cargo
ARG CROSS_RUNNER=
ARG TERM
ARG USER=root
ARG BUILDPLATFORM
ARG TARGETVARIANT
ARG TARGETPLATFORM
ARG TARGETARCH
ARG RUSTUP_HOME=/root/.rustup
WORKDIR /app
#install rustup and cargo
COPY --from=rust /usr/local/cargo /root/.cargo
COPY --from=rust /usr/local/rustup /root/.rustup
#install cargo-chef
RUN curl -OL https://github.com/LukeMathWalker/cargo-chef/releases/download/v0.1.67/cargo-chef-x86_64-unknown-linux-musl.tar.gz ; tar xf ./cargo-chef-x86_64-unknown-linux-musl.tar.gz ; mv ./cargo-chef /root/.cargo/bin/cargo-chef
ENV PATH=$PATH:/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:/root/.cargo/bin

RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | ash
RUN cargo binstall cargo-chef -y
# get the scrypt to translate the architectures
RUN echo "case \"${TARGETPLATFORM}\" in \n\
\"linux/amd64\") echo \"x86_64-unknown-linux-musl\"\n\
;;\n\
\"linux/arm/v6\") echo \"arm-unknown-linux-musleabihf\"\n\
;;\n\
\"linux/arm/v7\") echo \"armv7-unknown-linux-musleabihf\"\n\
;;\n\
\"linux/arm64\") echo \"aarch64-unknown-linux-musl\"\n\
esac" > ./get_target.sh

#add compilation target
RUN rustup target add $(sh ./get_target.sh)
# clone pq-sys, and correct a little bug
RUN cd .. ; \
git clone --recurse-submodules -j8 https://github.com/sgrif/pq-sys.git ; \
sed -i '/#define PG_INT128_TYPE __int128/d' ./pq-sys/pq-src/additional_include/pg_config.h

#plan what it should be built
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
RUN cargo chef prepare --recipe-path recipe.json --bin insigno

FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
#build
FROM chef AS builder

COPY --from=planner /app/recipe.json recipe.json

# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
RUN cargo chef cook --release --target $(sh ./get_target.sh) --recipe-path recipe.json
COPY . .
RUN cargo build --release --target $(sh ./get_target.sh) --bin insigno
RUN cd /app/target/$(sh ./get_target.sh)/release/ ; ls -la
RUN mv /app/target/$(sh ./get_target.sh)/release/insigno /insigno

RUN cargo build --release

# We do not need the Rust toolchain to run the binary!
FROM alpine:latest AS runtime

WORKDIR /insigno

COPY --from=builder /app/target/release/insigno /app

ENV ROCKET_ADDRESS=0.0.0.0
EXPOSE 8000
COPY ./templates /app/templates
COPY --from=builder /insigno /app/insigno
ENTRYPOINT ["/app/insigno"]

1 change: 1 addition & 0 deletions build-and-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sudo docker build . --platform=linux/arm/v6,linux/arm/v7,linux/arm64,linux/amd64 -t mindshubalessio/insigno --push
26 changes: 26 additions & 0 deletions docker/Insigno.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[default]
oldest_supported_version="0.0.2"

# our custom config data
media_folder = "/app/media"
template_folder = "/app/templates"
intro_images = []
secret_key = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

[default.smtp]
user = ""
password = ""
server = ""
from_mail ="Insigno <[email protected]>"
port = 587

[default.scrypt]
log_n = 11
r = 8
p = 1
len = 30

[default.databases.db]
url = "postgres://root:test@postgresql:5432/root"
timeout = 5
pool_size = 5
70 changes: 70 additions & 0 deletions docker/dalvany-image-panel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Changelog

## Next version

- Fix license link to point to main branch instead of old master
- Upgrade minimum grafana version to 9.0.0

## 2.8.0

- Display `No data` like other panels instead of an alert ([#68](https://github.com/Dalvany/dalvany-image-panel/issues/68) thanks to @dazzatronic).
- Change license to MIT.

## 2.7.0

- Add a toogle to enable/disable infinite slideshow ([#65](https://github.com/Dalvany/dalvany-image-panel/issues/65) thanks to @dpooley).

## 2.6.0

- Support for "shared crosshair". Image background and border will according to
the configured colores (default to #FFFFFF10 for background and #FFFFFF20 for border)
([#16](https://github.com/Dalvany/dalvany-image-panel/issues/16) [#51](https://github.com/Dalvany/dalvany-image-panel/issues/51)).
- Support for shared tooltip ([#52](https://github.com/Dalvany/dalvany-image-panel/issues/52)).
- Use grafana tooltip instead of title attribute when slideshow is disabled (to make shared tooltip working).
- Hoovering over an image will now use "Shared crosshair" options.
- Require at least Grafana 8.5.0.
- Errors are shown in the panel instead of throwing an error, this avoids to refresh while configuring panels
([#57](https://github.com/Dalvany/dalvany-image-panel/issues/57)).
- When adding a new binding, it will get focus ([#60](https://github.com/Dalvany/dalvany-image-panel/issues/60)).
- Can now choose to open link in new tab or not. ([#62](https://github.com/Dalvany/dalvany-image-panel/issues/62))

## 2.5.0

- Allow to choose underline horizontal alignment ([#46](https://github.com/Dalvany/dalvany-image-panel/issues/46)).
- Allow to map underline text color based on metric value ([#46](https://github.com/Dalvany/dalvany-image-panel/issues/46)).

## 2.4.0

- Allow to open an URL by clicking on the image [#33](https://github.com/Dalvany/dalvany-image-panel/issues/33).
- Multiple image can now see with a slideshow [#35](https://github.com/Dalvany/dalvany-image-panel/issues/35).

## 2.3.0

- Add a gap between image.
- Add an underline.
- Fix tooltip [#15](https://github.com/Dalvany/dalvany-image-panel/issues/15).
- Fix image size when single fill enable
- Allow using variable for `base URL`, `Suffix`, `Image width` and `Image height` [#14](https://github.com/Dalvany/dalvany-image-panel/issues/14).
- Now when something is wrong an error is thrown instead of displaying a div. This will cause grafana to display the
error in the top left corner of the panel.
- When an image fail to load, a warning is logged containing the url
see [#11](https://github.com/Dalvany/dalvany-image-panel/issues/11).
- Possibility to add a square as overlay over pictures. Color can be chosen with a mapping for field values [#19](https://github.com/Dalvany/dalvany-image-panel/issues/19).
- Fix gap [#31](https://github.com/Dalvany/dalvany-image-panel/issues/31)

Note : if new options doesn't show up or plugin seems in an older version, please uninstall, reinstall and then restart
grafana (or if using docker, run a new container using the latest version of the plugin in GF_INSTALL_PLUGINS env
variable)

## 2.2.0

- Base URL and suffix are optional.

## 2.1.1

- Change default values for tooltip and date inclusion.

## 2.1.0

- Allow to select a field to use as `alt` image attribute.
- Add a configurable Tooltip.
21 changes: 21 additions & 0 deletions docker/dalvany-image-panel/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Dalvany

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
49 changes: 49 additions & 0 deletions docker/dalvany-image-panel/MANIFEST.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

{
"manifestVersion": "2.0.0",
"signatureType": "community",
"signedByOrg": "dalvany",
"signedByOrgName": "dalvany",
"plugin": "dalvany-image-panel",
"version": "3.1.0",
"time": 1713295476003,
"keyId": "7e4d0c6a708866e7",
"files": {
"LICENSE": "9c6251d731778db03cba79d3a61589507578baff49a4887f3473862afad0c2cb",
"README.md": "96bfc635816e6978cc4d67948aacceba271554db9e1281622f499a65f8843358",
"module.js": "591a4db8cef9d5af1da8f4582f0134cd095da200f2569e7bbde0ab704f0d211f",
"img/configuration_url.png": "73088f8b061d62a06351670ebb5410afd3dbd42012a97d646a9897669bbea739",
"img/screenshot03.png": "b04e4da219a7b91ba1d3c904a96321f4596c2fb5b9cce79d95a0033dcc9e9e3c",
"img/screenshot01.png": "39145a6543cd1beccb91d7502b8fab0e2d7c7ead3d1290535a79bddef5152a45",
"img/configuration_link.png": "b997c6513c2e7e17f7bb815c01e3f4f026e1d0e92e61339835ae05588827ed80",
"img/configuration_underline.png": "f1712420b3b7ab330c9aca3bc3b43570a115e7a172757582337a3a9e2b21f243",
"img/configuration_slideshow.png": "31e6360145a3b67b751087385269637addbe54397d82b9e555b3d7325b478de9",
"img/configuration_shared_crosshair.png": "41da44af9d891457ce30ee2dfd28e26effbae75cf080fe66445fbf6219f077dc",
"img/screenshot07.png": "1399920e77e051c04b3bc078727b4e509fef524d602a12239396d066ec872a89",
"img/screenshot04.png": "3c6013437a4c45605d6a0c02b5e0be97949aff82c091d3a357e692f8b3dc3aa9",
"img/configuration_image.png": "2a3089cd59ccc01865726a5af6f46bc5b2a056d72e48fef30aa87329c25645d1",
"img/screenshot02.png": "92bbac30ad21fed50bab32459e51007f1b52c890892c566ad83143629f433b54",
"img/logo.svg": "db811484b2b3e65df821e97a66e3520caaa4e9d62dbafb75348c7d70a2389a44",
"img/screenshot05.png": "127644f605cc925ed7c86de109fd7e0b0c9f82a601550cf6f30e6710e1c942da",
"img/configuration_tooltip.png": "b21423785b549e137690164be8eeeb0b20db521f7f525b1ad819f3460db9caf5",
"img/configuration_overlay.png": "fc242be71dd524871ecc2cbc04cfffcd314e6e3fbda75b4a1737d68c956d4593",
"img/screenshot06.png": "87a8116a7f75c0d03bc9680c3494eb195c76f66fde8b66f6ed44abde39276db4",
"plugin.json": "2fdde65bd22c970cf63ad1075e49a243a00e2f420f4af899c0b361c1880b2e9a",
"CHANGELOG.md": "970d16e47d2bfcf259c8862f0af5077f3c66d7081f3ff7c3541cd581fab325cc",
"module.js.map": "7a24bfddd0660297e13e02f749001ff28a64b3c0cab0c10158e0e61086fe58a5"
}
}
-----BEGIN PGP SIGNATURE-----
Version: OpenPGP.js v4.10.11
Comment: https://openpgpjs.org

wrkEARMKAAYFAmYe0HQAIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq
cIhm58i4AgkAdIJtY35eq+ViBDq/Az62aeCWsck1ucCR1cyBnC1BtHbUBM7A
D13PYexwI46eIiynJDgpahZUhd5a/FRVZjF3hNUCCQClRWpiBvsqg+DS2smv
VhDjOKetuZ5uxL9fBsmZYur1mUhm1UgiqaVrlzpE9Kv9Ra6vzoHRSGypy+Th
u/DdK3ao7g==
=bwtK
-----END PGP SIGNATURE-----
Loading

0 comments on commit e48cd6a

Please sign in to comment.