7 Commits

Author SHA1 Message Date
e0812f28aa Output json logs except when running through cargo
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 5m25s
2025-04-17 16:54:37 +02:00
62a85230a9 Fixed conflict with service links
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 5m31s
2025-04-17 15:59:03 +02:00
13f27ef878 Improved error message when failing to parse ports
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 5m28s
2025-04-17 15:04:53 +02:00
6d70187560 Manifests latest tag now tracks latest tagged release instead of latest build 2025-04-17 14:32:56 +02:00
ba3f891122 Added README
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 5m32s
2025-04-17 13:58:52 +02:00
56fdcdf465 Removed test file 2025-04-17 13:58:52 +02:00
ff19d6b23b Changed name to siranga 2025-04-17 13:58:52 +02:00
6 changed files with 23 additions and 16 deletions

View File

@@ -71,18 +71,16 @@ jobs:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }} SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
- name: Kustomize manifests - name: Kustomize manifests
if: gitea.ref_type == 'tag'
run: | run: |
./kustomize build ./manifests | sed "s/\${DIGEST}/${{ steps.build.outputs.digest }}/" > ./manifests.yaml ./kustomize build ./manifests | sed "s/\${DIGEST}/${{ steps.build.outputs.digest }}/" > ./manifests.yaml
- name: Push manifests - name: Push manifests
if: gitea.ref_type == 'tag'
run: | run: |
flux push artifact oci://$OCI_REPO/manifests:latest \ flux push artifact oci://$OCI_REPO/manifests:${{ gitea.head_ref || gitea.ref_name }} \
--path="./manifests.yaml" \ --path="./manifests.yaml" \
--source="$(git config --get remote.origin.url)" \ --source="$(git config --get remote.origin.url)" \
--revision="$(git rev-parse HEAD)" \ --revision="$(git rev-parse HEAD)" \
$(echo "${{ steps.meta.outputs.labels }}" | sed -e 's/^/-a /') $(echo "${{ steps.meta.outputs.labels }}" | sed -e 's/^/-a /')
flux tag artifact oci://$OCI_REPO/manifests:latest \ flux tag artifact oci://$OCI_REPO/manifests:${{ gitea.head_ref || gitea.ref_name }} \
$(echo "${{ steps.meta.outputs.tags }}" | sed -e 's/^.*:/--tag /') $(echo "${{ steps.meta.outputs.tags }}" | sed -e 's/^.*:/--tag /')

View File

@@ -17,6 +17,8 @@ spec:
annotations: annotations:
kubectl.kubernetes.io/default-container: siranga kubectl.kubernetes.io/default-container: siranga
spec: spec:
# Service links cause issues with the HTTP_PORT and SSH_PORT env variables
enableServiceLinks: false
containers: containers:
- name: siranga - name: siranga
image: git.huizinga.dev/dreaded_x/siranga@${DIGEST} image: git.huizinga.dev/dreaded_x/siranga@${DIGEST}

View File

@@ -10,6 +10,6 @@ spec:
kind: Rule kind: Rule
services: services:
- name: http - name: http
port: 3000 port: http
tls: tls:
secretName: tunnel-tls secretName: tunnel-tls

View File

@@ -4,7 +4,7 @@ namespace: siranga
resources: resources:
- ./namespace.yaml - ./namespace.yaml
- ./service-user.yaml - ./service-user.yaml
- ./secret-tunnel-key.yaml - ./secret-siranga-key.yaml
- ./deployment.yaml - ./deployment.yaml
- ./service.yaml - ./service.yaml
- ./certificate.yaml - ./certificate.yaml

View File

@@ -4,9 +4,8 @@ metadata:
name: http name: http
spec: spec:
ports: ports:
- name: "3000" - name: http
port: 3000 port: 3000
targetPort: 3000
selector: selector:
app: siranga app: siranga
--- ---
@@ -19,7 +18,7 @@ metadata:
spec: spec:
type: LoadBalancer type: LoadBalancer
ports: ports:
- name: "2222" - name: ssh
port: 22 port: 22
targetPort: 2222 targetPort: 2222
selector: selector:

View File

@@ -24,11 +24,19 @@ async fn main() -> color_eyre::Result<()> {
let env_filter = EnvFilter::try_from_default_env().or_else(|_| EnvFilter::try_new("info"))?; let env_filter = EnvFilter::try_from_default_env().or_else(|_| EnvFilter::try_new("info"))?;
let logger = tracing_subscriber::fmt::layer().compact(); if std::env::var("CARGO").is_ok() {
tracing_subscriber::Registry::default() let logger = tracing_subscriber::fmt::layer().compact();
.with(logger) tracing_subscriber::Registry::default()
.with(env_filter) .with(logger)
.init(); .with(env_filter)
.init();
} else {
let logger = tracing_subscriber::fmt::layer().json();
tracing_subscriber::Registry::default()
.with(logger)
.with(env_filter)
.init();
}
info!( info!(
"Starting {} ({})", "Starting {} ({})",
@@ -45,10 +53,10 @@ async fn main() -> color_eyre::Result<()> {
}; };
let http_port = std::env::var("HTTP_PORT") let http_port = std::env::var("HTTP_PORT")
.map(|port| port.parse()) .map(|port| port.parse().wrap_err_with(|| format!("HTTP_PORT={port}")))
.unwrap_or(Ok(3000))?; .unwrap_or(Ok(3000))?;
let ssh_port = std::env::var("SSH_PORT") let ssh_port = std::env::var("SSH_PORT")
.map(|port| port.parse()) .map(|port| port.parse().wrap_err_with(|| format!("SSH_PORT={port}")))
.unwrap_or(Ok(2222))?; .unwrap_or(Ok(2222))?;
let domain = let domain =