Skip to content

Commit 7651b45

Browse files
committed
test docs
1 parent a71f477 commit 7651b45

File tree

78 files changed

+28463
-8
lines changed

Some content is hidden

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

78 files changed

+28463
-8
lines changed

.github/workflows/docs.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy Docusaurus to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'docs/**'
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
deploy:
16+
environment:
17+
name: github-pages
18+
url: ${{ steps.deployment.outputs.page_url }}
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20.x # Docusaurus works well with Node 18/20
28+
cache: yarn
29+
30+
- name: Install dependencies
31+
working-directory: docs
32+
run: yarn install --frozen-lockfile
33+
34+
- name: Build Docusaurus
35+
working-directory: docs
36+
run: yarn build
37+
38+
- name: Setup Pages
39+
uses: actions/configure-pages@v3
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: docs/build
45+
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v2

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ _NCrunch_*
105105
_TeamCity*
106106

107107
# Sonarr
108-
config.xml
109108
nzbdrone.log*txt
110109
UpdateLogs/
111110
*workspace.xml
@@ -165,3 +164,10 @@ src/.idea/
165164

166165
# Ignore Jetbrains IntelliJ Workspace Directories
167166
.idea/
167+
168+
**/logs/
169+
**/MediaCover/
170+
**/archive/
171+
**/Backups/
172+
*.fastresume
173+
*.bak

code/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
2+
ARG TARGETARCH
3+
WORKDIR /app
4+
EXPOSE 8080
5+
COPY . ./
6+
7+
RUN dotnet publish ./Executable/Executable.csproj \
8+
-a $TARGETARCH \
9+
-c Release \
10+
-o /app/publish \
11+
/p:Version=1.5.18 \
12+
--self-contained \
13+
--use-current-runtime \
14+
/p:StripSymbols=true \
15+
/p:PublishSingleFile=true
16+
17+
FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine
18+
19+
RUN apk add --no-cache tzdata
20+
ENV TZ=Etc/UTC
21+
ENV DOTNET_USE_POLLING_FILE_WATCHER=true
22+
WORKDIR /app
23+
COPY --from=build /app/publish .
24+
ENTRYPOINT ["./testing"]

code/Executable/Config.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Executable;
2+
3+
public class Config
4+
{
5+
public string Variable { get; init; }
6+
}

code/Executable/Program.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
using Executable;
22

33
var builder = Host.CreateApplicationBuilder(args);
4+
5+
// builder.Configuration.Sources.Clear();
6+
// builder.Configuration.AddJsonFile("/config/appsettings.json", optional: false, reloadOnChange: true);
7+
builder.Configuration.AddEnvironmentVariables();
8+
9+
var isContainer = bool.Parse(builder.Configuration["DOTNET_RUNNING_IN_CONTAINER"] ?? "false");
10+
string settingsFilePath = isContainer is true
11+
? "/config/appsettings.json"
12+
: "config/appsettings.json";
13+
14+
builder.Configuration
15+
.AddJsonFile(settingsFilePath, optional: false, reloadOnChange: true);
16+
17+
builder.Services.Configure<Config>(builder.Configuration);
18+
419
builder.Services.AddHostedService<Worker>();
520

621
var host = builder.Build();

code/Executable/Worker.cs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
1+
using Microsoft.Extensions.Options;
2+
13
namespace Executable;
24

35
public class Worker : BackgroundService
46
{
57
private readonly ILogger<Worker> _logger;
8+
private readonly IServiceScopeFactory _serviceScopeFactory;
9+
private readonly IOptionsMonitor<Config> _config;
10+
611

7-
public Worker(ILogger<Worker> logger)
12+
public Worker(ILogger<Worker> logger, IServiceScopeFactory serviceScopeFactory, IOptionsMonitor<Config> config)
813
{
914
_logger = logger;
15+
_serviceScopeFactory = serviceScopeFactory;
16+
_config = config;
17+
18+
_config.OnChange(OnConfigChanged);
19+
}
20+
21+
private void OnConfigChanged(Config arg1, string? arg2)
22+
{
23+
_logger.LogInformation("!! Value changed !!: {Variable}", arg1.Variable);
1024
}
1125

1226
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
1327
{
1428
while (!stoppingToken.IsCancellationRequested)
1529
{
16-
if (_logger.IsEnabled(LogLevel.Information))
17-
{
18-
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
19-
}
20-
await Task.Delay(1000, stoppingToken);
30+
using var scope = _serviceScopeFactory.CreateScope();
31+
var config = scope.ServiceProvider.GetRequiredService<IOptionsSnapshot<Config>>();
32+
33+
_logger.LogInformation("Snapshot variable: {Variable}", config.Value.Variable);
34+
_logger.LogInformation("Monitor variable: {Variable}", _config.CurrentValue.Variable);
35+
36+
await Task.Delay(5000, stoppingToken);
2137
}
2238
}
2339
}

code/Executable/appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"Default": "Information",
55
"Microsoft.Hosting.Lifetime": "Information"
66
}
7-
}
7+
},
8+
"Variable": "ceva1"
89
}

code/appsettings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.Hosting.Lifetime": "Information"
6+
}
7+
},
8+
"Variable": "ceva7"
9+
}

docs/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

docs/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

0 commit comments

Comments
 (0)