Skip to content

Commit bbfbd1c

Browse files
authored
Tune logging, prepare infra for websocket (#88)
* fix nginx for websocket * some log mods
1 parent 4035eeb commit bbfbd1c

File tree

7 files changed

+62
-20
lines changed

7 files changed

+62
-20
lines changed

.github/workflows/ci.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,9 @@ jobs:
132132
- name: Create release artifacts
133133
if: github.ref == 'refs/heads/master'
134134
run: |
135-
echo "[build]" >> fly.toml
136-
echo " image = \"${{ steps.meta.outputs.tags }}\"" >> fly.toml
135+
sed -i 's/%DOCKER_IMAGE%/${{ steps.meta.outputs.tags }}/g' fly.json
137136
mkdir -p release
138-
cp fly.toml ./release/
137+
cp fly.json ./release/
139138
140139
- name: Publish release artifacts
141140
if: github.ref == 'refs/heads/master'

crates/shine-core/src/azure/azure_keyvault_config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl ConfigAsyncSource for AzureKeyvaultConfigSource {
7575
}
7676
}
7777

78-
log::info!("keyvault config: {:#?}", config);
78+
//log::info!("keyvault config: {:#?}", config);
7979
Ok(config)
8080
}
8181
}

crates/shine-core/src/web/web_app.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use axum::{
1212
};
1313
use axum_server::Handle;
1414
use serde::de::DeserializeOwned;
15-
use std::{env, fs, future::Future, net::SocketAddr, time::Duration as StdDuration};
15+
use std::{env, fmt::Debug, fs, future::Future, net::SocketAddr, time::Duration as StdDuration};
1616
use tokio::{
1717
net::TcpListener,
1818
runtime::{Handle as RtHandle, Runtime},
@@ -88,7 +88,7 @@ async fn graceful_shutdown(handle: Handle) {
8888
}
8989

9090
pub trait WebApplication {
91-
type AppConfig: DeserializeOwned + Send + Sync + 'static;
91+
type AppConfig: DeserializeOwned + Debug + Send + Sync + 'static;
9292
type AppState: Clone + Send + Sync + 'static;
9393

9494
fn feature_name(&self) -> &'static str;

crates/shine-core/src/web/web_config.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::telemetry::TelemetryConfig;
22
use anyhow::{anyhow, Error as AnyError};
33
use serde::{de::DeserializeOwned, Deserialize};
4+
use std::fmt::Debug;
45

56
use super::{CoreConfig, ServiceConfig};
67

@@ -18,14 +19,15 @@ pub struct WebAppConfig<F> {
1819

1920
impl<F> WebAppConfig<F>
2021
where
21-
F: DeserializeOwned,
22+
F: DeserializeOwned + Debug,
2223
{
2324
pub async fn load_config(stage: &str) -> Result<Self, AnyError> {
2425
let pre_init = CoreConfig::new(stage)?;
2526
let builder = pre_init.create_config_builder()?;
2627
let config = builder.build().await?;
2728

2829
let cfg: Self = config.try_deserialize()?;
30+
log::info!("Config loaded: {:#?}", cfg);
2931

3032
if pre_init != cfg.core {
3133
Err(anyhow!("Core config mismatch"))

fly.json

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"app": "shine-app",
3+
"primary_region": "cdg",
4+
5+
"build": {
6+
"image": "ghcr.io/gzp79/shine-services:sha-4035eeb"
7+
},
8+
9+
"services": [
10+
{
11+
"protocol": "tcp",
12+
"internal_port": 80,
13+
"auto_stop_machines": true,
14+
"auto_start_machines": true,
15+
"min_machines_running": 0,
16+
17+
"ports": [
18+
{
19+
"port": 80,
20+
"handlers": ["http"],
21+
"force_https": true
22+
},
23+
{
24+
"port": 443,
25+
"handlers": ["tls", "http"]
26+
}
27+
],
28+
29+
"concurrency": {
30+
"hard_limit": 25,
31+
"soft_limit": 20
32+
},
33+
34+
"tcp_checks": [
35+
{
36+
"interval": "10s",
37+
"timeout": "2s"
38+
}
39+
]
40+
}
41+
],
42+
43+
"metrics": [
44+
{
45+
"port": 80,
46+
"path": "identity/api/telemetry/metrics"
47+
},
48+
{
49+
"port": 80,
50+
"path": "builder/api/telemetry/metrics"
51+
}
52+
]
53+
}

fly.toml

-13
This file was deleted.

services/server_config.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"telemetry": {
1010
"allowReconfigure": true,
1111
"enableConsoleLog": true,
12+
"defaultLevel": "INFO,shine_builder=TRACE",
1213
"metrics": true,
1314
"tracing": {
1415
"type": "stdOut"

0 commit comments

Comments
 (0)