Skip to content

Commit 72f8aff

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/ip-enrichment-geo-vpn
# Conflicts: # Common/OpenShockControllerBase.cs # Common/OpenShockServiceHelper.cs # Common/Services/Session/ISessionService.cs # Common/Services/Session/SessionService.cs
2 parents b24627d + 09451b0 commit 72f8aff

317 files changed

Lines changed: 7018 additions & 4479 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.env‎

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,59 @@
1-
# Required variables (uncomment and set values!)
2-
#PG_PASS=someSecurePassword
3-
4-
# Compose variables
5-
OPENSHOCK_DOMAIN=openshock.local # your public base domain
6-
OPENSHOCK_GATEWAY_SUBDOMAIN=gateway # subdomain for the included gateway
7-
OPENSHOCK_API_SUBDOMAIN=api # subdomain for the api
8-
9-
#global email config
10-
OPENSHOCK__MAIL__SENDER__NAME=OpenShock System
11-
OPENSHOCK__MAIL__SENDER__EMAIL=system@openshock.app
12-
13-
#mail configs. uncomment one of the 2 sections below and make your config changes
14-
15-
#MailJet
16-
#OPENSHOCK__MAIL__TYPE: MAILJET # MAILJET or SMTP, check Documentation
17-
#OPENSHOCK__MAIL__MAILJET__KEY: mailjetkey
18-
#OPENSHOCK__MAIL__MAILJET__SECRET: mailjetsecret
19-
#OPENSHOCK__MAIL__MAILJET__TEMPLATE__PASSWORDRESET: 9999999
20-
21-
#SMTP
22-
OPENSHOCK__MAIL__TYPE=SMTP # MAILJET or SMTP, check Documentation
23-
OPENSHOCK__MAIL__SMTP__HOST=mail.domain.zap
24-
OPENSHOCK__MAIL__SMTP__USERNAME=open@shock.zap
25-
OPENSHOCK__MAIL__SMTP__PASSWORD=SMTPPASSWORD
26-
OPENSHOCK__MAIL__SMTP__ENABLESSL=true
27-
OPENSHOCK__MAIL__SMTP__VERIFYCERTIFICATE=true
1+
# OpenShock configuration. These are simple knobs; docker-compose.yml maps them
2+
# onto the OPENSHOCK__* variables the containers read and shares them across every
3+
# service. Anything left unset falls back to the defaults defined in the compose file.
4+
5+
# --- Required ---
6+
# Database password (no default, must be set).
7+
PG_PASS=someSecurePassword
8+
9+
# --- Images ---
10+
# Tag for the backend images (api, gateway, cron) — they share the backend repo's
11+
# versioning. The frontend is a separate repo with its own versions, so it has its
12+
# own tag. Pin to a release for reproducible deploys; both default to `latest`.
13+
#OPENSHOCK_TAG=latest
14+
#OPENSHOCK_FRONTEND_TAG=latest
15+
16+
# --- Host / port / paths ---
17+
# The whole stack runs on one host and one port; services are told apart by path.
18+
# The host clients use to reach the stack.
19+
OPENSHOCK_HOST=openshock.local
20+
# External port for the stack. Leave blank for 443 (standard https). Set e.g. 8080
21+
# to serve on https://host:8080. Traefik publishes this onto its https entrypoint.
22+
#OPENSHOCK_PORT=8080
23+
# Path prefix per service. Frontend sits at the root; api and gateway on sub-paths.
24+
# Leave OPENSHOCK_FRONTEND_PATH blank to keep the web UI at the root (recommended).
25+
#OPENSHOCK_FRONTEND_PATH=
26+
OPENSHOCK_API_PATH=/api
27+
OPENSHOCK_GATEWAY_PATH=/gateway
28+
29+
# --- Database (optional, defaults shown) ---
30+
#PG_USER=openshock
31+
#PG_DB=openshock
32+
33+
# --- Feature flags (optional, defaults shown) ---
34+
#OPENSHOCK_TURNSTILE_ENABLE=false
35+
#OPENSHOCK_REGISTRATION_ENABLED=true
36+
37+
# --- TLS (optional, defaults shown) ---
38+
# Set this to true to disable TLS certificate verification for the frontend. This is useful
39+
# for testing with self-signed certs, but should not be used in production.
40+
#OPENSHOCK_FRONTEND_TLS_INSECURE=false
41+
42+
# --- E-mail ---
43+
# MAIL_TYPE is required by the app. Leave it as None to run without outbound mail,
44+
# or set it to Smtp / Mailjet and fill in the matching block below.
45+
MAIL_TYPE=None
46+
MAIL_SENDER_NAME=OpenShock System
47+
MAIL_SENDER_EMAIL=system@openshock.app
48+
49+
# SMTP (used when MAIL_TYPE=Smtp)
50+
#SMTP_HOST=mail.domain.zap
51+
#SMTP_PORT=587
52+
#SMTP_USERNAME=open@shock.zap
53+
#SMTP_PASSWORD=SMTPPASSWORD
54+
#SMTP_ENABLESSL=true
55+
#SMTP_VERIFYCERTIFICATE=true
56+
57+
# Mailjet (used when MAIL_TYPE=Mailjet)
58+
#MAILJET_KEY=mailjetkey
59+
#MAILJET_SECRET=mailjetsecret

‎.github/actions/build-app/action.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ runs:
2323
steps:
2424
- name: Extract metadata (tags, labels) for Docker
2525
id: meta
26-
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
26+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
2727
with:
2828
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ inputs.image }}
2929
flavor: |
@@ -32,7 +32,7 @@ runs:
3232
type=raw,value=${{ inputs.tag-prefix }}-${{ github.run_number }}-a${{ github.run_attempt }}
3333
3434
- name: Build and push
35-
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
35+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
3636
with:
3737
context: .
3838
file: ${{ inputs.dockerfile }}

‎.github/actions/promote-image/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runs:
1717

1818
- name: Extract metadata (tags, labels) for Promotion
1919
id: remeta
20-
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
20+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
2121
with:
2222
images: ${{ inputs.image }}
2323
flavor: |

‎.github/dependabot.yml‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ updates:
1212
schedule:
1313
interval: weekly
1414
day: monday
15-
time: '06:00'
15+
time: '08:00'
1616
groups:
17-
nuget-dependencies:
17+
nuget:
1818
patterns:
1919
- '*' # Group all updates together
2020

@@ -24,8 +24,20 @@ updates:
2424
schedule:
2525
interval: weekly
2626
day: monday
27-
time: '06:00'
27+
time: '08:00'
2828
groups:
2929
github-actions:
3030
patterns:
3131
- '*' # Group all updates together
32+
33+
# Check for Docker base image updates
34+
- package-ecosystem: docker
35+
directory: /docker
36+
schedule:
37+
interval: weekly
38+
day: monday
39+
time: '08:00'
40+
groups:
41+
docker:
42+
patterns:
43+
- '*' # Group all updates together

‎.github/workflows/ci-build.yml‎

Lines changed: 17 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ name: ci-build
3333
env:
3434
REGISTRY: ghcr.io
3535
DOTNET_VERSION: 10.0.x
36-
COVERAGE_MIN_PERCENT: '85'
3736

3837
jobs:
3938

@@ -43,9 +42,9 @@ jobs:
4342

4443
steps:
4544
- name: Checkout
46-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
45+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4746

48-
- uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
47+
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
4948
with:
5049
dotnet-version: '${{ env.DOTNET_VERSION }}'
5150

@@ -55,9 +54,6 @@ jobs:
5554
dotnet test -c Release --solution OpenShockBackend.slnx \
5655
--results-directory "artifacts/test-results" \
5756
-- \
58-
--coverage \
59-
--coverage-output coverage.cobertura.xml \
60-
--coverage-output-format cobertura \
6157
--report-trx \
6258
--report-trx-filename test-results.trx
6359
@@ -69,111 +65,6 @@ jobs:
6965
path: artifacts/test-results
7066
if-no-files-found: warn
7167

72-
coverage:
73-
name: Coverage
74-
runs-on: ubuntu-latest
75-
needs: [tests]
76-
outputs:
77-
linecoverage: ${{ steps.enforce.outputs.linecoverage }}
78-
79-
steps:
80-
- name: Checkout
81-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
82-
83-
- uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
84-
with:
85-
dotnet-version: '${{ env.DOTNET_VERSION }}'
86-
87-
- name: Download test artifacts
88-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
89-
with:
90-
name: test-results
91-
path: artifacts/test-results
92-
93-
- name: Install ReportGenerator
94-
run: dotnet tool install --tool-path ./.tools dotnet-reportgenerator-globaltool
95-
96-
- name: Generate merged coverage report
97-
run: |
98-
set -euo pipefail
99-
reports="$(find artifacts/test-results -name coverage.cobertura.xml -print | paste -sd ';' -)"
100-
if [ -z "$reports" ]; then
101-
echo "No coverage reports found" >&2
102-
exit 1
103-
fi
104-
105-
./.tools/reportgenerator \
106-
"-reports:${reports}" \
107-
"-targetdir:artifacts/coverage" \
108-
"-reporttypes:Html;MarkdownSummaryGithub;JsonSummary;Badges"
109-
110-
- name: Add coverage summary
111-
run: cat artifacts/coverage/SummaryGithub.md >> "$GITHUB_STEP_SUMMARY"
112-
113-
- name: Enforce minimum coverage
114-
id: enforce
115-
env:
116-
COVERAGE_MIN_PERCENT: ${{ env.COVERAGE_MIN_PERCENT }}
117-
run: |
118-
python - <<'PY'
119-
import json
120-
import os
121-
122-
threshold = float(os.environ["COVERAGE_MIN_PERCENT"])
123-
with open("artifacts/coverage/Summary.json", "r", encoding="utf-8") as handle:
124-
summary = json.load(handle)["summary"]
125-
126-
line_coverage = float(summary["linecoverage"])
127-
print(f"Line coverage: {line_coverage:.1f}%")
128-
129-
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
130-
output.write(f"linecoverage={line_coverage:.1f}\n")
131-
132-
if line_coverage < threshold:
133-
raise SystemExit(
134-
f"Coverage threshold not met: {line_coverage:.1f}% < {threshold:.1f}%"
135-
)
136-
PY
137-
138-
- name: Upload merged coverage report
139-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
140-
with:
141-
name: coverage-report
142-
path: artifacts/coverage
143-
if-no-files-found: error
144-
145-
publish-coverage:
146-
name: Publish coverage
147-
runs-on: ubuntu-latest
148-
needs: coverage
149-
if: ${{ github.ref_type == 'branch' && github.event_name != 'pull_request' && github.ref_name == 'master' }}
150-
permissions:
151-
contents: read
152-
pages: write
153-
id-token: write
154-
environment:
155-
name: github-pages
156-
url: ${{ steps.deployment.outputs.page_url }}
157-
158-
steps:
159-
- name: Configure Pages
160-
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
161-
162-
- name: Download merged coverage report
163-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
164-
with:
165-
name: coverage-report
166-
path: _site/coverage
167-
168-
- name: Upload Pages artifact
169-
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
170-
with:
171-
path: _site
172-
173-
- name: Deploy Pages site
174-
id: deployment
175-
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
176-
17768
build:
17869
name: Build (${{ matrix.image }})
17970
runs-on: ubuntu-latest
@@ -190,13 +81,13 @@ jobs:
19081

19182
steps:
19283
- name: Checkout
193-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
84+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19485

19586
- name: Set up Docker Buildx
196-
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
87+
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
19788

19889
- name: Log in to Container Registry
199-
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
90+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
20091
with:
20192
registry: ${{ env.REGISTRY }}
20293
username: ${{ github.actor }}
@@ -213,7 +104,7 @@ jobs:
213104

214105
promote-image:
215106
name: Promote Image (${{ matrix.image }})
216-
needs: [build, coverage]
107+
needs: [build]
217108
runs-on: ubuntu-latest
218109
if: ${{ inputs.push || (github.ref_protected && github.event_name != 'pull_request') }}
219110
strategy:
@@ -226,10 +117,10 @@ jobs:
226117

227118
steps:
228119
- name: Checkout
229-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
120+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
230121

231122
- name: Log in to Container Registry
232-
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
123+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
233124
with:
234125
registry: ${{ env.REGISTRY }}
235126
username: ${{ github.actor }}
@@ -249,15 +140,13 @@ jobs:
249140
environment: production
250141
steps:
251142
- name: Send repository dispatch
252-
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
143+
uses: OpenShock/actions/repository-dispatch@21ca2d511bca92cf24fb502fa302f82700822584 # v1.1.1
253144
with:
254-
token: ${{ secrets.GITOPS_PAT }}
255-
repository: openshock/kubernetes-cluster-gitops
145+
repo: openshock/kubernetes-cluster-gitops
256146
event-type: update-backend-prod
257147
client-payload: |
258-
{
259-
"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"
260-
}
148+
{"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"}
149+
token: ${{ secrets.GITOPS_PAT }}
261150

262151
deploy-staging:
263152
runs-on: ubuntu-latest
@@ -267,15 +156,13 @@ jobs:
267156

268157
steps:
269158
- name: Send repository dispatch
270-
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
159+
uses: OpenShock/actions/repository-dispatch@21ca2d511bca92cf24fb502fa302f82700822584 # v1.1.1
271160
with:
272-
token: ${{ secrets.GITOPS_PAT }}
273-
repository: openshock/kubernetes-cluster-gitops
161+
repo: openshock/kubernetes-cluster-gitops
274162
event-type: update-backend-staging
275163
client-payload: |
276-
{
277-
"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"
278-
}
164+
{"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"}
165+
token: ${{ secrets.GITOPS_PAT }}
279166

280167
deploy-dev:
281168
runs-on: ubuntu-latest
@@ -284,7 +171,7 @@ jobs:
284171
environment: development
285172

286173
steps:
287-
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
174+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
288175
with:
289176
sparse-checkout: |
290177
.github

‎.github/workflows/ci-tag.yml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ jobs:
2121
steps:
2222
- name: Find latest tag
2323
id: latest-tag
24-
uses: oprypin/find-latest-tag@6957ac556fa6d349727ecabfcaaf9f8e5ee37124 # v1.1.3
24+
uses: OpenShock/actions/find-latest-tag@21ca2d511bca92cf24fb502fa302f82700822584 # v1.1.1
2525
with:
26-
repository: ${{ github.repository }}
27-
regex: '^\d+\.\d+\.\d+$'
28-
releases-only: false
26+
regex: '^[0-9]+\.[0-9]+\.[0-9]+$'
2927

3028
# Delegate building and containerizing to a single workflow.
3129
build-and-containerize:

0 commit comments

Comments
 (0)