Compare commits
10 commits
feature-ne
...
main
Author | SHA1 | Date | |
---|---|---|---|
0cea3f282b | |||
527c038f02 | |||
7098a6c5eb | |||
3a0a739fae | |||
146a2800cb | |||
20cbb33778 | |||
6f20779714 | |||
b8ec72877d | |||
05a536a17d | |||
8d4f92f7be |
14 changed files with 75 additions and 60 deletions
41
.gitignore
vendored
41
.gitignore
vendored
|
@ -1,31 +1,28 @@
|
||||||
# ---> Go
|
# Allowlisting gitignore template for GO projects prevents us
|
||||||
# If you prefer the allow list template instead of the deny list, see community template:
|
# from adding various unwanted local files, such as generated
|
||||||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
# files, developer configurations or IDE-specific files etc.
|
||||||
#
|
#
|
||||||
# Binaries for programs and plugins
|
# Recommended: Go.AllowList.gitignore
|
||||||
*.exe
|
|
||||||
*.exe~
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
*.dylib
|
|
||||||
|
|
||||||
# Test binary, built with `go test -c`
|
# Ignore everything
|
||||||
*.test
|
*
|
||||||
|
|
||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
# But not these files...
|
||||||
*.out
|
!/.gitignore
|
||||||
|
|
||||||
# Dependency directories (remove the comment below to include it)
|
!*.go
|
||||||
# vendor/
|
!go.sum
|
||||||
|
!go.mod
|
||||||
|
|
||||||
# Go workspace file
|
!examples/*
|
||||||
go.work
|
|
||||||
|
|
||||||
bin/
|
!*.md
|
||||||
|
!LICENSE
|
||||||
|
|
||||||
examples/testing/
|
!Makefile
|
||||||
|
|
||||||
*.yaml
|
# Woodpecker CI
|
||||||
!examples/*.yaml
|
!.woodpecker/*
|
||||||
|
|
||||||
test/
|
# ...even if they are in subdirectories
|
||||||
|
!*/
|
||||||
|
|
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
|
@ -9,7 +9,7 @@
|
||||||
"type": "go",
|
"type": "go",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"mode": "auto",
|
"mode": "auto",
|
||||||
"program": "${workspaceFolder}",
|
"program": "${workspaceFolder}/cmd/certwarden-deploy/main.go",
|
||||||
"args": ["--config", "${workspaceFolder}/config.yaml", "--dry-run"]
|
"args": ["--config", "${workspaceFolder}/config.yaml", "--dry-run"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
"type": "go",
|
"type": "go",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"mode": "auto",
|
"mode": "auto",
|
||||||
"program": "${workspaceFolder}",
|
"program": "${workspaceFolder}/cmd/certwarden-deploy/main.go",
|
||||||
"args": ["--config", "${workspaceFolder}/config.yaml", "--verbose"]
|
"args": ["--config", "${workspaceFolder}/config.yaml", "--verbose"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -20,13 +20,13 @@ steps:
|
||||||
- APP_NAME=certwarden-deploy
|
- APP_NAME=certwarden-deploy
|
||||||
- FORGE=https://code.lila.network
|
- FORGE=https://code.lila.network
|
||||||
commands:
|
commands:
|
||||||
- apk add --update --no-cache xz curl jq
|
- apk add --update --no-cache xz curl jq make git
|
||||||
- go mod download
|
- make build
|
||||||
- go build -o output/$APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM} main.go
|
- cd bin/
|
||||||
- cd output
|
- mv $APP_NAME $APP_NAME-${GOOS}-${GOARCH}${GOARM}
|
||||||
- xz --keep --compress $APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM}
|
- xz --keep --compress $APP_NAME-${GOOS}-${GOARCH}${GOARM}
|
||||||
- sha256sum $APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM} >> $APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM}.sha256
|
- sha256sum $APP_NAME-${GOOS}-${GOARCH}${GOARM} >> $APP_NAME-${GOOS}-${GOARCH}${GOARM}.sha256
|
||||||
- sha256sum $APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM}.xz >> $APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM}.xz.sha256
|
- sha256sum $APP_NAME-${GOOS}-${GOARCH}${GOARM}.xz >> $APP_NAME-${GOOS}-${GOARCH}${GOARM}.xz.sha256
|
||||||
- |-
|
- |-
|
||||||
export RELEASE_ID=`curl --location "$FORGE/api/v1/repos/$CI_REPO/releases?limit=10" \
|
export RELEASE_ID=`curl --location "$FORGE/api/v1/repos/$CI_REPO/releases?limit=10" \
|
||||||
--header 'Accept: application/json' -s -S \
|
--header 'Accept: application/json' -s -S \
|
||||||
|
@ -35,23 +35,23 @@ steps:
|
||||||
curl --location "$FORGE/api/v1/repos/$CI_REPO/releases/$RELEASE_ID/assets" \
|
curl --location "$FORGE/api/v1/repos/$CI_REPO/releases/$RELEASE_ID/assets" \
|
||||||
--header "Authorization: token $FORGEJO_APIKEY" \
|
--header "Authorization: token $FORGEJO_APIKEY" \
|
||||||
--header 'Content-Type: multipart/form-data' -s -S \
|
--header 'Content-Type: multipart/form-data' -s -S \
|
||||||
--form "attachment=@$APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM};type=application/octet-stream" \
|
--form "attachment=@$APP_NAME-${GOOS}-${GOARCH}${GOARM};type=application/octet-stream" \
|
||||||
--fail-with-body
|
--fail-with-body
|
||||||
- |-
|
- |-
|
||||||
curl --location "$FORGE/api/v1/repos/$CI_REPO/releases/$RELEASE_ID/assets" \
|
curl --location "$FORGE/api/v1/repos/$CI_REPO/releases/$RELEASE_ID/assets" \
|
||||||
--header "Authorization: token $FORGEJO_APIKEY" \
|
--header "Authorization: token $FORGEJO_APIKEY" \
|
||||||
--header 'Content-Type: multipart/form-data' -s -S \
|
--header 'Content-Type: multipart/form-data' -s -S \
|
||||||
--form "attachment=@$APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM}.xz;type=application/octet-stream" \
|
--form "attachment=@$APP_NAME-${GOOS}-${GOARCH}${GOARM}.xz;type=application/octet-stream" \
|
||||||
--fail-with-body
|
--fail-with-body
|
||||||
- |-
|
- |-
|
||||||
curl --location "$FORGE/api/v1/repos/$CI_REPO/releases/$RELEASE_ID/assets" \
|
curl --location "$FORGE/api/v1/repos/$CI_REPO/releases/$RELEASE_ID/assets" \
|
||||||
--header "Authorization: token $FORGEJO_APIKEY" \
|
--header "Authorization: token $FORGEJO_APIKEY" \
|
||||||
--header 'Content-Type: multipart/form-data' -s -S \
|
--header 'Content-Type: multipart/form-data' -s -S \
|
||||||
--form "attachment=@$APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM}.sha256;type=application/octet-stream" \
|
--form "attachment=@$APP_NAME-${GOOS}-${GOARCH}${GOARM}.sha256;type=application/octet-stream" \
|
||||||
--fail-with-body
|
--fail-with-body
|
||||||
- |-
|
- |-
|
||||||
curl --location "$FORGE/api/v1/repos/$CI_REPO/releases/$RELEASE_ID/assets" \
|
curl --location "$FORGE/api/v1/repos/$CI_REPO/releases/$RELEASE_ID/assets" \
|
||||||
--header "Authorization: token $FORGEJO_APIKEY" \
|
--header "Authorization: token $FORGEJO_APIKEY" \
|
||||||
--header 'Content-Type: multipart/form-data' -s -S \
|
--header 'Content-Type: multipart/form-data' -s -S \
|
||||||
--form "attachment=@$APP_NAME-${CI_COMMIT_TAG##v}-${GOOS}-${GOARCH}${GOARM}.xz.sha256;type=application/octet-stream" \
|
--form "attachment=@$APP_NAME-${GOOS}-${GOARCH}${GOARM}.xz.sha256;type=application/octet-stream" \
|
||||||
--fail-with-body
|
--fail-with-body
|
||||||
|
|
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
## [0.2.2] - 2024-07-30
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- changed the way the version string is handled internally
|
||||||
|
- CI pipeline changed
|
||||||
|
- documentation is now more sophisticated and has a new theme
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Makefile
|
||||||
|
|
||||||
## [0.2.1] - 2024-07-12
|
## [0.2.1] - 2024-07-12
|
||||||
### Fixed
|
### Fixed
|
||||||
- Configuration validation did not work as intended
|
- Configuration validation did not work as intended
|
||||||
|
@ -40,7 +50,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- some documentation
|
- some documentation
|
||||||
|
|
||||||
|
|
||||||
[unreleased]: https://code.lila.network/adoralaura/certwarden-deploy/compare/0.2.1...HEAD
|
[unreleased]: https://code.lila.network/adoralaura/certwarden-deploy/compare/0.2.2...HEAD
|
||||||
|
[0.2.2]: https://code.lila.network/adoralaura/certwarden-deploy/compare/0.2.1...0.2.2
|
||||||
[0.2.1]: https://code.lila.network/adoralaura/certwarden-deploy/compare/0.2.0...0.2.1
|
[0.2.1]: https://code.lila.network/adoralaura/certwarden-deploy/compare/0.2.0...0.2.1
|
||||||
[0.2.0]: https://code.lila.network/adoralaura/certwarden-deploy/compare/0.1.1...0.2.0
|
[0.2.0]: https://code.lila.network/adoralaura/certwarden-deploy/compare/0.1.1...0.2.0
|
||||||
[0.1.1]: https://code.lila.network/adoralaura/certwarden-deploy/compare/0.1.0...0.1.1
|
[0.1.1]: https://code.lila.network/adoralaura/certwarden-deploy/compare/0.1.0...0.1.1
|
||||||
|
|
13
Makefile
Normal file
13
Makefile
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Set the default Go build flags
|
||||||
|
GOFLAGS = -ldflags='-w -s -X constants.Version=$(VERSION)'
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
build:
|
||||||
|
go build $(GOFLAGS) -o bin/certwarden-deploy cmd/certwarden-deploy/main.go
|
||||||
|
|
||||||
|
# Clean the build artifacts
|
||||||
|
clean:
|
||||||
|
rm -rf bin
|
||||||
|
|
||||||
|
# Set a version for the build
|
||||||
|
VERSION := $(shell git describe --tags --always)
|
|
@ -12,9 +12,9 @@ Installation of the required CertWarden instance is out of scope of this documen
|
||||||
To quickly get started with `certwarden-deploy`, just download the binary...
|
To quickly get started with `certwarden-deploy`, just download the binary...
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# this downloads certwarden-deploy version 0.2.1
|
# this downloads certwarden-deploy version 0.2.2
|
||||||
# to /usr/local/bin/certwarden-deploy
|
# to /usr/local/bin/certwarden-deploy
|
||||||
sudo wget https://code.lila.network/adoralaura/certwarden-deploy/releases/download/0.2.1/certwarden-deploy-0.2.1-linux-amd64 -O /usr/local/bin/certwarden-deploy
|
sudo wget https://code.lila.network/adoralaura/certwarden-deploy/releases/download/0.2.2/certwarden-deploy-linux-amd64 -O /usr/local/bin/certwarden-deploy
|
||||||
|
|
||||||
sudo chmod +x /usr/local/bin/certwarden-deploy
|
sudo chmod +x /usr/local/bin/certwarden-deploy
|
||||||
```
|
```
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Copyright © 2024 Laura Kalb <dev@lauka.net>
|
Copyright © 2024 Laura Kalb <dev@lauka.net>
|
||||||
The code of this project is available under the MIT license. See the LICENSE file for more info.
|
The code of this project is available under the MIT license. See the LICENSE file for more info.
|
||||||
*/
|
*/
|
||||||
package cmd
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
@ -11,9 +11,7 @@ import (
|
||||||
"code.lila.network/adoralaura/certwarden-deploy/internal/configuration"
|
"code.lila.network/adoralaura/certwarden-deploy/internal/configuration"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
func main() {
|
||||||
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
|
||||||
func Execute() {
|
|
||||||
err := cli.RootCmd.Execute()
|
err := cli.RootCmd.Execute()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
2
docs/.gitignore
vendored
2
docs/.gitignore
vendored
|
@ -11,3 +11,5 @@ hugo.linux
|
||||||
|
|
||||||
# Temporary lock file while building
|
# Temporary lock file while building
|
||||||
/.hugo_build.lock
|
/.hugo_build.lock
|
||||||
|
|
||||||
|
!**.html
|
||||||
|
|
|
@ -16,7 +16,8 @@ uniqueHomePage = false # change to false to add sidebar to homepage
|
||||||
disableLanguageSwitchingButton = false
|
disableLanguageSwitchingButton = false
|
||||||
editURL = "https://code.lila.network/adoralaura/certwarden-deploy/_edit/main/docs/content/${FilePath}"
|
editURL = "https://code.lila.network/adoralaura/certwarden-deploy/_edit/main/docs/content/${FilePath}"
|
||||||
externalLinkTarget = "_blank"
|
externalLinkTarget = "_blank"
|
||||||
|
headingPre = '<script defer src="https://esseles.adora.codes/script.js" data-website-id="fe4ec517-25b2-4e0d-b502-6bd3a7420849"></script>'
|
||||||
|
disableExplicitIndexURLs = true
|
||||||
|
|
||||||
[params.author]
|
[params.author]
|
||||||
name = 'Adora Laura Kalb'
|
name = 'Adora Laura Kalb'
|
||||||
|
|
|
@ -17,9 +17,9 @@ Installation of the required CertWarden instance is out of scope of this documen
|
||||||
To quickly get started with `certwarden-deploy`, just download the binary...
|
To quickly get started with `certwarden-deploy`, just download the binary...
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# this downloads certwarden-deploy version 0.2.1
|
# this downloads certwarden-deploy version 0.2.2
|
||||||
# to /usr/local/bin/certwarden-deploy
|
# to /usr/local/bin/certwarden-deploy
|
||||||
sudo wget https://code.lila.network/adoralaura/certwarden-deploy/releases/download/0.2.1/certwarden-deploy-0.2.1-linux-amd64 -O /usr/local/bin/certwarden-deploy
|
sudo wget https://code.lila.network/adoralaura/certwarden-deploy/releases/download/0.2.2/certwarden-deploy-linux-amd64 -O /usr/local/bin/certwarden-deploy
|
||||||
|
|
||||||
sudo chmod +x /usr/local/bin/certwarden-deploy
|
sudo chmod +x /usr/local/bin/certwarden-deploy
|
||||||
```
|
```
|
||||||
|
|
|
@ -59,7 +59,7 @@ This string defines the file path where the downloaded private key will be saved
|
||||||
|
|
||||||
`action` (optional):
|
`action` (optional):
|
||||||
This string specifies a command to run after a certificate is updated or when the --force flag is used during execution.
|
This string specifies a command to run after a certificate is updated or when the --force flag is used during execution.
|
||||||
The example uses a systemd reload command for the popular reverse named "caddy".
|
The example uses a systemd reload command for the popular reverse proxy named "caddy".
|
||||||
|
|
||||||
Example Configuration:
|
Example Configuration:
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -82,4 +82,4 @@ Use code with caution.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
- This documentation assumes you have a basic understanding of YAML syntax. Resources for learning YAML are readily available online.
|
- This documentation assumes you have a basic understanding of YAML syntax. Resources for learning YAML are readily available online.
|
||||||
- Replace placeholder values like examplekey_notvalid_hrzjGDDw8z with your actual API keys.
|
- Replace placeholder values like `examplekey_notvalid_hrzjGDDw8z` with your actual API keys.
|
||||||
|
|
2
docs/layouts/partials/heading-post.html
Normal file
2
docs/layouts/partials/heading-post.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
{{ .Params.headingPost | safeHTML }}
|
||||||
|
<script defer src="https://esseles.adora.codes/script.js" data-website-id="fe4ec517-25b2-4e0d-b502-6bd3a7420849"></script>
|
|
@ -1,7 +1,9 @@
|
||||||
package constants
|
package constants
|
||||||
|
|
||||||
const Version = "0.2.1"
|
var Version string
|
||||||
|
|
||||||
|
var UserAgent = "certwarden-deploy/" + Version + " +https://code.lila.network/adoralaura/certwarden-deploy"
|
||||||
|
|
||||||
const CertificateApiPath = "/certwarden/api/v1/download/certificates/"
|
const CertificateApiPath = "/certwarden/api/v1/download/certificates/"
|
||||||
const KeyApiPath = "/certwarden/api/v1/download/privatekeys/"
|
const KeyApiPath = "/certwarden/api/v1/download/privatekeys/"
|
||||||
const ApiKeyHeaderName = "X-API-Key"
|
const ApiKeyHeaderName = "X-API-Key"
|
||||||
const UserAgent = "certwarden-deploy/" + Version + " +https://code.lila.network/adoralaura/certwarden-deploy"
|
|
||||||
|
|
11
main.go
11
main.go
|
@ -1,11 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright © 2024 Laura Kalb <dev@lauka.net>
|
|
||||||
The code of this project is available under the MIT license. See the LICENSE file for more info.
|
|
||||||
*/
|
|
||||||
package main
|
|
||||||
|
|
||||||
import cmd "code.lila.network/adoralaura/certwarden-deploy/cmd/certwarden-deploy"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
cmd.Execute()
|
|
||||||
}
|
|
Loading…
Reference in a new issue