Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #77

Merged
merged 111 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
fe05789
add: config path for docker container and mount point
HilkopterBob Aug 23, 2024
44592b9
ci: move binary into app dir
HilkopterBob Aug 26, 2024
9f66f44
chore: changed dependencies
HilkopterBob Aug 26, 2024
3d75de1
add: docker compose & usage to readme
HilkopterBob Aug 26, 2024
7b5de3f
add: mongo-db config options & generate command for initial admin user
HilkopterBob Sep 5, 2024
478ffbb
chore: add mongo db development container
HilkopterBob Sep 5, 2024
d96bd89
refactor: generate RSA Certificate
HilkopterBob Sep 5, 2024
b1e80c4
add: mongodb to initConfig()
HilkopterBob Sep 5, 2024
4f154a0
add: new User & ApiKey Structs
HilkopterBob Sep 5, 2024
4ac0f1d
add: db-connector, db module & db.Client, db.DB to globals
HilkopterBob Sep 5, 2024
02b22ac
fix: get Users from DB, add new JWT to user.apiKeys[]
HilkopterBob Sep 5, 2024
83889ba
ci: fix docker-compose file
HilkopterBob Sep 5, 2024
6accc76
add: mongodb
HilkopterBob Sep 5, 2024
a49347b
chore: comments
HilkopterBob Sep 5, 2024
8acd29b
chore: add test data generator for mongo db
HilkopterBob Sep 6, 2024
9adf160
chore: update dependencies
HilkopterBob Sep 6, 2024
35878af
feat: Package struct
HilkopterBob Sep 6, 2024
3c07ed6
rem: static synthetic data
HilkopterBob Sep 6, 2024
d61b259
refactor: move to mongodb
HilkopterBob Sep 6, 2024
61fe918
refactor: move to mongo db
HilkopterBob Sep 6, 2024
3080a82
refactor: move to mongo db
HilkopterBob Sep 6, 2024
97d5bae
refactor: move to mongo db
HilkopterBob Sep 6, 2024
056e6b6
rem: debug prints
HilkopterBob Sep 6, 2024
cd4ee60
fix: naming convention
HilkopterBob Sep 13, 2024
e2880a0
chore: update generate testuser cmd
HilkopterBob Sep 13, 2024
4b187b5
Extended Structs with more Informations
Kartoffel096 Oct 1, 2024
35636a8
Edited structs to support multiple network interfaces
Kartoffel096 Oct 1, 2024
617a240
Edited Structs to fit Pascal_Case and removed Domain from Interface
Kartoffel096 Oct 1, 2024
014f244
linting: conv to pascal case
HilkopterBob Oct 1, 2024
29e7b7a
Fixed Linting Workflow
Kartoffel096 Oct 1, 2024
ea5bd38
Merge pull request #48 from HilkopterBob/ExtendedStructs
HilkopterBob Oct 1, 2024
d13b480
Added Workflow for Unit Testing
Kartoffel096 Oct 1, 2024
b3415ba
Changed readme to include more Badges
Kartoffel096 Oct 1, 2024
ef5a08a
Added test-build workflow
Kartoffel096 Oct 1, 2024
50681ba
Merge pull request #50 from HilkopterBob/Readme-changes
HilkopterBob Oct 1, 2024
d7a6e5f
rem: old mongo connector file
HilkopterBob Oct 2, 2024
80cc622
add: Surreal DB connector file && global var `db.DB` for db-access
HilkopterBob Oct 2, 2024
406500e
ref: migrate to surrealDB
HilkopterBob Oct 2, 2024
75fff80
ref: add surrealDB json annotations
HilkopterBob Oct 2, 2024
186df27
ref: migrate Agents to surrealdb
HilkopterBob Oct 2, 2024
69e28a8
add: db.Select for whole-table selection in one line
HilkopterBob Oct 4, 2024
f121ec6
ref: migrate to surrealdb
HilkopterBob Oct 4, 2024
f82db2e
ref: switch to surrealdb
HilkopterBob Oct 4, 2024
88ff57d
add: pp, surrealdb, packagelock/db module
HilkopterBob Oct 4, 2024
58903a5
add: logging notice
HilkopterBob Oct 4, 2024
592f71a
add: comments
HilkopterBob Oct 4, 2024
729f7b8
feat: generate admin creates admin user
HilkopterBob Oct 4, 2024
c18b1a7
add dependencies
HilkopterBob Oct 4, 2024
b0085d2
REAMDE
HilkopterBob Oct 4, 2024
7a4513e
change: default config to reflect surrealdb default values
HilkopterBob Oct 4, 2024
82ead71
ref: use config for db connection details
HilkopterBob Oct 4, 2024
5dc3834
ref: move initConfig away from cobra Init. queue
HilkopterBob Oct 4, 2024
18e702a
Merge pull request #54 from HilkopterBob/db-refactor-surreal
HilkopterBob Oct 4, 2024
19ee2d4
rem: devel tools
HilkopterBob Oct 4, 2024
6f7c94b
Merge branch 'devel' into db-integration
HilkopterBob Oct 4, 2024
5a3b5b9
chore: various cleanups
HilkopterBob Oct 4, 2024
d7ea1fd
add: print help for common db connection errors
HilkopterBob Oct 4, 2024
9846d74
add: INFO
HilkopterBob Oct 7, 2024
a2973a8
fix: linting
HilkopterBob Oct 7, 2024
e22d4eb
ci: create docker container with right mounts, add surrealdb
HilkopterBob Oct 7, 2024
e756cce
Merge pull request #55 from HilkopterBob/db-integration
HilkopterBob Oct 7, 2024
6d14b4d
Merge pull request #57 from HilkopterBob/devel
Kartoffel096 Oct 7, 2024
5ca55b7
feat: logging
HilkopterBob Oct 7, 2024
326c97d
feat: logging
HilkopterBob Oct 8, 2024
83bb277
feat: logging
HilkopterBob Oct 8, 2024
cd13f0a
feat: logger & global var logger.Logger
HilkopterBob Oct 8, 2024
9b16074
feat: logging & error handling
HilkopterBob Oct 8, 2024
d93eb34
feat: logging
HilkopterBob Oct 8, 2024
9070460
feat: logging
HilkopterBob Oct 8, 2024
288ec5e
chore: rem old files
HilkopterBob Oct 8, 2024
c1b15af
feat: logging
HilkopterBob Oct 8, 2024
209148d
chore: fix naming
HilkopterBob Oct 8, 2024
4b592bc
chore: fix naming
HilkopterBob Oct 8, 2024
ea25449
Merge pull request #60 from HilkopterBob/logging
HilkopterBob Oct 8, 2024
1445407
Merge branch 'devel' into fix-naming
HilkopterBob Oct 8, 2024
54ede0b
Merge pull request #61 from HilkopterBob/fix-naming
HilkopterBob Oct 8, 2024
100b8e4
API: Switched to Fields and renamed routes
Kartoffel096 Oct 8, 2024
45ebcf6
refactor: changed id to suit namingscheme in structs
Kartoffel096 Oct 8, 2024
cb6a1f7
Merge pull request #62 from HilkopterBob/API-Fields
HilkopterBob Oct 8, 2024
2c13e1c
fix: create logs directory if non existent, close #63
HilkopterBob Oct 8, 2024
d50046b
fix: consistent error return for 'agent not found', close #64
HilkopterBob Oct 8, 2024
64bfa10
Merge pull request #65 from HilkopterBob/fix-#63
HilkopterBob Oct 8, 2024
b666056
Merge pull request #66 from HilkopterBob/fix-#64
HilkopterBob Oct 8, 2024
a344727
add: workflow for releasing on a new tag
Kartoffel096 Oct 8, 2024
751ac35
fix: missing folder path
Kartoffel096 Oct 9, 2024
70e4d83
fix: changed folder creation to happen earlier
Kartoffel096 Oct 9, 2024
20e1bfd
change: changed folder path
Kartoffel096 Oct 9, 2024
3c22f4a
change: changed folder to use github env
Kartoffel096 Oct 9, 2024
909e24b
fix: made copy recursive
Kartoffel096 Oct 9, 2024
b51f10f
change: changed upload of files
Kartoffel096 Oct 9, 2024
66ed301
add: testfile to test workflow on push
Kartoffel096 Oct 9, 2024
abf5a12
change: changed the release workflow
Kartoffel096 Oct 9, 2024
5550237
change: changed how the release upload url is read
Kartoffel096 Oct 9, 2024
9a44b0b
fix: changed pathing
Kartoffel096 Oct 9, 2024
e01253e
fix: fixed missing path
Kartoffel096 Oct 9, 2024
064be82
add: added debug lines
Kartoffel096 Oct 9, 2024
e6f40b3
change: changed debug lines
Kartoffel096 Oct 9, 2024
765b2b4
add: more debug lines
Kartoffel096 Oct 9, 2024
f5c3ba3
fix: permissions
Kartoffel096 Oct 9, 2024
70a698b
Change: Removed Debug Lines; Changed Tag Regex and added Checksum
Kartoffel096 Oct 9, 2024
fbb3085
Fix: Removed Filename from MD5 Sum
Kartoffel096 Oct 9, 2024
b8a0110
fix+feat: correct init chain + add setup.
HilkopterBob Oct 10, 2024
f432068
feat: unit file generation in setup
HilkopterBob Oct 10, 2024
ad08ed7
Merge pull request #71 from HilkopterBob/fix-init-chain
HilkopterBob Oct 10, 2024
1159b10
Merge pull request #72 from HilkopterBob/generate-systemd-unit-file
HilkopterBob Oct 10, 2024
f582cdc
Merge pull request #73 from HilkopterBob/GitHub-Actions
HilkopterBob Oct 10, 2024
934fdf5
REM: Removed old release workflow
Kartoffel096 Oct 10, 2024
1a47183
fix: run initServer before startServer, close #74
HilkopterBob Oct 10, 2024
ba40ea1
fix: wrong place for code
HilkopterBob Oct 10, 2024
14abd25
Merge pull request #75 from HilkopterBob/fix-#74
HilkopterBob Oct 10, 2024
d6a334d
Merge pull request #76 from HilkopterBob/GitHub-Actions
HilkopterBob Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
name: golangci-lint
on:
push:
branches:
- master
pull_request:
branches:
- master
- devel
- '*'

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
checks: write

jobs:
golangci:
Expand All @@ -25,4 +21,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
version: v1.60
21 changes: 0 additions & 21 deletions .github/workflows/release-binary.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/release_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Automatic Release Workflow

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.0.0)'
required: true

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v3


- name: Set APP_VERSION
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.version }}
else
VERSION=${{ github.ref }}
VERSION=${VERSION#refs/tags/}
fi
echo "APP_VERSION=$VERSION" >> $GITHUB_ENV

- name: Build Go Application
run: |
mkdir -p ${{ github.workspace }}/packagelock
APP_VERSION=${{ env.APP_VERSION }}
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.AppVersion=$APP_VERSION'" -o ${{ github.workspace }}/packagelock

- name: Create Release Archive
run: |
mkdir -p release
cp -r ${{ github.workspace }}/packagelock ./release/packagelock
tar -czvf release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz -C release packagelock

- name: Calculate Checksum
run: |
md5sum ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz | cut -f 1 -d " " > ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz.md5
- name: Get release URL
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload Release Tarball
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz
asset_name: packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz
asset_content_type: application/gzip

- name: Upload Checksum
id: upload-checksum-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./release/packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz.md5
asset_name: packagelock-${{ env.APP_VERSION }}-linux-amd64.tar.gz.md5
asset_content_type: text/plain
25 changes: 25 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Upload Go test results

on:
pull_request:
branches:
- '*'

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.23.x']

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Installing dependencies
run: go get .
- name: Building Package
run: go build -tags *
30 changes: 30 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload Go test results

on:
pull_request:
branches:
- '*'

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.23.x']

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Installing dependencies
run: go get .
- name: Run Unit Tests
run: go test -json > TestResults-${{ matrix.go-version }}.json
- name: Uploading Testresults
uses: actions/upload-artifact@v4
with:
name: Go-results-${{ matrix.go-version }}
path: tests/results/TestResults-${{ matrix.go-version }}.json
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ certs/**
config.yaml
config.yml
packagelock.pid
packagelock/**
logs/**
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN go mod download
# Build
ARG APP_VERSION="v0.1.0+hotfixes"
RUN \
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.AppVersion=$APP_VERSION'" -o /packagelock
CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.AppVersion=$APP_VERSION'" -o /app/packagelock

# Optional:
# To bind to a TCP port, runtime parameters must be supplied to the docker command.
Expand All @@ -28,5 +28,5 @@ RUN \
EXPOSE 8080

# Run
CMD ["/packagelock", "start"]
CMD ["/app/packagelock","start"]

47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/HilkopterBob/PackageLock/.github%2Fworkflows%2Frun-tests.yml)
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/test-build.yml/badge.svg)
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/golangci-lint.yml/badge.svg)
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/build-docker-container.yml/badge.svg)
![GitHub Actions Workflow Status](https://github.com/hilkopterbob/packagelock/actions/workflows/unstable-build-docker-container.yml/badge.svg)

![GitHub repo file or directory count](https://img.shields.io/github/directory-file-count/HilkopterBob/PackageLock)


Expand Down Expand Up @@ -110,11 +115,49 @@ Install docker. Thats it.

### Installation

Run the container:
#### Docker Run:
```bash
sudo docker run -p 8080:8080 hilkopterbob/packagelock
```

#### Docker Compose:

- download the docker-compose file:
`~/ $: wget https://github.com/HilkopterBob/PackageLock/blob/master/docker-compose.yml`

- get the default config & rename it to `config.yml`:
```bash
~/ $: wget https://github.com/HilkopterBob/PackageLock/blob/master/default-config.yml
~/ $: mv default-config.yml config.yml
```
- edit the config
- run docker compose:
`~/ $: docker-compose up -d`

The default-config:
```yaml
general:
debug: true
production: false
database:
address: 127.0.0.1
port: 8000
username: root
password: root
network:
fqdn: 0.0.0.0
port: 8080
ssl: true
ssl-config:
allowselfsigned: true
certificatepath: ./certs/testing.crt
privatekeypath: ./certs/testing.key
redirecthttp: true
```




<!-- USAGE EXAMPLES -->
## Usage

Expand All @@ -131,6 +174,8 @@ TODO: explain usage
- [ ] backend-api to manage Agents & Hosts
- [ ] frontend to visualize backend data
- [ ] installable agent as background daemon
- [ ] agent CLI:
- [ ] `packagelock id` -> returns agent id
- [ ] config management
- [ ] TLS Encryption
- [ ] Best Practice based Package Layout
Expand Down
Loading
Loading