Skip to content

Commit

Permalink
Update generator code, to output tile json
Browse files Browse the repository at this point in the history
  • Loading branch information
rikkit committed Jul 2, 2020
1 parent 36e4b2c commit 67d83eb
Show file tree
Hide file tree
Showing 22 changed files with 167 additions and 481 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,7 @@ data/certbot/conf/*
!data/certbot/conf/letsencrypt-recommended-ssl.conf
!data/certbot/conf/letsencrypt-dhparams.pem
data/certbot/www/*

# Generator data
data/tiles/config.json
data/tiles/tiles.json
4 changes: 4 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ services:
- ./node_modules:/usr/src/backend/node_modules
ports:
- "1337:1337"
generator:
volumes:
- ./data/tiles/:/usr/src/data/
- ./src/generator/bin/Release/netcoreapp3.1/publish/:/usr/src/app
proxy:
volumes:
- ./src/proxy/nginx.dev.conf:/etc/nginx/conf.d/nginx.conf
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ services:
build:
context: .
dockerfile: src/backend/Dockerfile
generator:
build:
context: src/generator/
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do dotnet generator.dll /usr/src/data/config.json /usr/src/data/tiles.json; sleep 12h & wait $${!}; done;'"
proxy:
image: nginx:1.19-alpine
ports:
Expand Down
27 changes: 27 additions & 0 deletions src/generator/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/generator.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
42 changes: 42 additions & 0 deletions src/generator/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/generator.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/generator.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/generator.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
10 changes: 5 additions & 5 deletions src/generator/ApiConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ public class LastfmApiConfig
[JsonProperty("username")]
public string Username { get; set; }

[JsonProperty("albumChartPeriod")]
public LastStatsTimeSpan AlbumChartPeriod { get; set; } = LastStatsTimeSpan.Month;
[JsonProperty("period")]
public LastStatsTimeSpan Period { get; set; } = LastStatsTimeSpan.Month;

[JsonProperty("albumChartCount")]
public int AlbumChartCount { get; set; }
[JsonProperty("count")]
public int Count { get; set; } = 5;
}

public class ApiConfig
{
[JsonProperty("github")]
public GitHubApiConfig GitHub { get; set; }

[JsonProperty("lastfm")]
public LastfmApiConfig Lastfm { get; set; }

Expand Down
13 changes: 13 additions & 0 deletions src/generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1

COPY . usr/src/app/
WORKDIR usr/src/app/
# https://github.com/NuGet/Home/issues/9020
RUN dotnet restore --disable-parallel
RUN dotnet publish -c Release

FROM mcr.microsoft.com/dotnet/core/runtime:3.1
COPY --from=0 usr/src/app/bin/Release/netcoreapp3.1/publish/ /usr/src/app

WORKDIR /usr/src/app
ENTRYPOINT ["dotnet", "generator.dll"]
237 changes: 0 additions & 237 deletions src/generator/PageBuilder.cs

This file was deleted.

Loading

0 comments on commit 67d83eb

Please sign in to comment.