-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a4ea5d
commit a396827
Showing
13 changed files
with
792 additions
and
76 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,16 @@ | ||
** | ||
|
||
# Allowed things | ||
!src/** | ||
!Cargo.lock | ||
!Cargo.toml | ||
!LICENSE | ||
|
||
# Extra exclude from allowed things | ||
**/*~ | ||
**/*.log | ||
**/.DS_Store | ||
**/Thumbs.db | ||
**/__pycache__ | ||
**/*.md | ||
**/*.rst |
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,71 @@ | ||
name: Publish Docker image | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
tags: ["v*"] | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ vars.DOCKER_REGISTRY }} | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ vars.DOCKER_REGISTRY }}/${{ vars.DOCKER_REPOSITORY }} | ||
tags: | | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.event.ref, 'refs/tags/v') | ||
needs: [build-and-push-image] | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
generate_release_notes: true | ||
|
||
- name: Update Docker Hub repository description | ||
uses: peter-evans/dockerhub-description@v4 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: ${{ vars.DOCKER_REPOSITORY }} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,6 +1,6 @@ | ||
[package] | ||
name = "onepassword-exporter" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
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,12 @@ | ||
FROM rustlang/rust:nightly-bookworm-slim AS builder | ||
|
||
WORKDIR /build | ||
COPY . . | ||
RUN cargo build --release | ||
|
||
FROM 1password/op:2 AS runtime | ||
|
||
COPY --from=builder /build/target/release/onepassword-exporter /usr/local/bin/onepassword-exporter | ||
|
||
ENTRYPOINT ["onepassword-exporter"] | ||
CMD ["--host", "0.0.0.0"] |
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 @@ | ||
OP_SERVICE_ACCOUNT_TOKEN="ops_ey..." |
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,21 @@ | ||
# Grafana Dashboard Example | ||
|
||
This example shows example setup using Docker Compose with preconfigured Grafana dashboard for 1Password Exporter. | ||
|
||
## Usage | ||
|
||
Create `.env` file with appropriate values (see `.env.example` for required values): | ||
|
||
```dotenv | ||
OP_SERVICE_ACCOUNT_TOKEN='ops_...' | ||
``` | ||
|
||
Start Docker Compose: | ||
|
||
```bash | ||
$ docker compose up -d | ||
``` | ||
|
||
Then open Grafana running at http://localhost:3000 (default admin username and password are both `"admin"`) then go to Dashboards and you will find 1Password Exporter dashboard. | ||
|
||
![Dashboard Screenshot](dashboard-screenshot.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.