Skip to content

Commit

Permalink
feat: add notary snap
Browse files Browse the repository at this point in the history
Signed-off-by: guillaume <[email protected]>
  • Loading branch information
gruyaume committed Sep 6, 2024
1 parent 22fd0b8 commit ecb1a83
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ pebble_notifications: true
## Installation
### From Snap
Install the snap:
```bash
sudo snap install notary
```

Generate (or copy) a certificate and private key to the following location:
```bash
sudo openssl req -newkey rsa:2048 -nodes -keyout /var/snap/notary/common/key.pem -x509 -days 1 -out /var/snap/notary/common/cert.pem -subj "/CN=example.com"
```

Start the service:
```bash
sudo snap start notary.notaryd
```

Navigate to `https://localhost:3000` to access the Notary UI.

### From OCI Image

```bash
Expand Down
5 changes: 5 additions & 0 deletions notary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
key_path: "key.pem"
cert_path: "cert.pem"
db_path: "certs.db"
port: 3000
pebble_notifications: false
5 changes: 5 additions & 0 deletions service/bin/notaryd-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -ex

"$SNAP"/bin/notary -config "$SNAP_COMMON"/notary.yaml
5 changes: 5 additions & 0 deletions service/notary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
key_path: "/var/snap/notary/common/key.pem"
cert_path: "/var/snap/notary/common/cert.pem"
db_path: "/var/snap/notary/common/certs.db"
port: 3000
pebble_notifications: false
4 changes: 4 additions & 0 deletions snap/hooks/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh -e

# Create Notary config file
cp "$SNAP/notary.yaml" "$SNAP_COMMON/notary.yaml"
41 changes: 41 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: notary
base: core24
version: '0.0.3'
summary: Notary is a certificate management tool.
description: Notary is a certificate management tool.

grade: stable
confinement: strict

apps:
notary:
command: bin/notary
plugs:
- network
- network-bind
- home
notaryd:
daemon: simple
install-mode: disable
command: bin/notaryd-start
refresh-mode: endure
plugs:
- network
- network-bind

parts:
notary:
plugin: go
source: .
source-type: local
build-snaps:
- go/1.22/stable
- node/20/stable
override-build: |
npm install --prefix ui
npm run build --prefix ui
craftctl default
service-files:
plugin: dump
source: service

0 comments on commit ecb1a83

Please sign in to comment.