cd contrib; make reinstall

This commit is contained in:
root 2026-06-13 20:57:30 +01:00
commit 198d5bc202
13 changed files with 61 additions and 23 deletions

View file

@ -4,3 +4,19 @@ MODERATION_AUTO_REJECT_THRESHOLD=0.9
MODERATION_AUTO_APPROVE_THRESHOLD=0.7
# Limite par appel
ANTHROPIC_MAX_TOKENS=256 # la modération n'a pas besoin de plus
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=db
POSTGRES_USER=pguser
POSTGRES_PASSWORD=pgpassword
ANTHROPIC_API_KEY=none
ANTHROPIC_MAX_TOKENS=0
ASPNETCORE_Smtp__Host="your.mail.host.name",
ASPNETCORE_Smtp__Port=465
ASPNETCORE_Smtp__SenderName"="You Name here"
ASPNETCORE_Smtp__SenderEmail"="your@email"
ASPNETCORE_Smtp__UserName"="your-smtp-user-name"
ASPNETCORE_Smtp__Password="Your pass"

View file

@ -1,7 +1,7 @@
APP_PROJECT_NAMES=Api Org Blogs
APP_PROJECTS=src/Yavsc.Org/Yavsc.Org.csproj src/Yavsc.Api/Yavsc.Api.csproj
SLNDIR=..
DESTDIR=/srv/www/yavsc/
DESTDIR=/srv/www/yavsc
USER_AND_GROUP=www-data:www-data
CONFIGURATION=Release
DOTNET_FRAMEWORK=net10.0
@ -35,7 +35,7 @@ copy-service-Org: /etc/systemd/system/yavscOrg.service
copy-service-Api: /etc/systemd/system/yavscApi.service
copy-service-Blogs: /etc/systemd/system/yavscBlogs.service
copy-binaries:
copy-binaries: build_publish_Org build_publish_Api build_publish_Blogs
for project in $(APP_PROJECT_NAMES); \
do \
sudo cp -a $(SLNDIR)/src/Yavsc.$${project}/bin/$(CONFIGURATION)/$(DOTNET_FRAMEWORK)/publish/* $(DESTDIR) ; \
@ -45,14 +45,12 @@ copy-binaries:
/etc/systemd/system/yavsc%.service: generated/yavsc%.service
sudo cp $^ $@
sudo chown root:root $@
sudo systemctl daemon-reload
build_publish:
for f in $(APP_PROJECTS); do \
ASPNETCORE_ENV=$(CONFIGURATION) dotnet publish $(SLNDIR)/$$f ; \
done
install: build_publish copy-services copy-binaries
build_publish_%:
ASPNETCORE_ENV=$(CONFIGURATION) dotnet publish $(SLNDIR)/src/Yavsc.$*/Yavsc.$*.csproj
install: build_publish copy-binaries copy-services
sudo systemctl daemon-reload
for project in $(APP_PROJECT_NAMES); \
do \
@ -61,6 +59,7 @@ install: build_publish copy-services copy-binaries
done
reinstall: build_publish copy-services copy-binaries
sudo systemctl daemon-reload
for project in $(APP_PROJECT_NAMES); \
do \
sudo systemctl stop yavsc$${project} ; \
@ -70,6 +69,12 @@ reinstall: build_publish copy-services copy-binaries
sudo systemctl start yavsc$${project} ; \
done
$(SLNDIR)/src/Yavsc.Org/bin/$(CONFIGURATION)/$(DOTNET_FRAMEWORK)/publish: build_publish
$(SLNDIR)/src/Yavsc.Blogs/bin/$(CONFIGURATION)/$(DOTNET_FRAMEWORK)/publish: build_publish
$(SLNDIR)/src/Yavsc.Api/bin/$(CONFIGURATION)/$(DOTNET_FRAMEWORK)/publish: build_publish
showConfig:
@echo CONFIGURATION: $(CONFIGURATION)
@echo DESTDIR: $(DESTDIR)

View file

@ -2,20 +2,18 @@
Description=yavsc-$APP_NAME
After=syslog.target
After=network.target
Wants=postgresql.service
After=postgresql.service
[Service]
RestartSec=5s
Type=simple
User=www-data
Group=www-data
User=yavsc
Group=yavsc
WorkingDirectory=$DESTDIR
ExecStart=$DESTDIR/Yavsc.$APP_NAME
Restart=always
Environment="HOME=$DESTDIR"
Environment="ASPNETCORE_ENVIRONMENT=Production"
Environment="ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY"
Environment="ANTHROPIC_MAX_TOKENS=$ANTHROPIC_MAX_TOKENS"
Environment="ASPNETCORE_ConnectionStrings__YavscConnection=Server=$POSTGRES_HOST;Port=$POSTGRES_PORT;Database=$POSTGRES_DB;Username=$POSTGRES_USER;Password=$POSTGRES_PASSWORD;"

View file

@ -29,6 +29,10 @@ internal class Program
var builder = WebApplication.CreateBuilder(args);
builder.Configuration
.AddJsonFile("appsettings-api.json", optional: false, reloadOnChange: false)
.AddJsonFile($"appsettings-api.{builder.Environment.EnvironmentName}.json", optional: false, reloadOnChange: false)
.AddEnvironmentVariables();
var services = builder.Services;
// Anthropic client

View file

@ -29,6 +29,10 @@ internal class Program
Console.Title = "Yavsc.Blogs";
var builder = WebApplication.CreateBuilder(args);
builder.Configuration
.AddJsonFile("appsettings-blogs.json", optional: false, reloadOnChange: false)
.AddJsonFile($"appsettings-blogs.{builder.Environment.EnvironmentName}.json", optional: false, reloadOnChange: false)
.AddEnvironmentVariables();
var services = builder.Services;
@ -106,6 +110,7 @@ internal class Program
using (var app = builder.Build())
{
if (app.Environment.IsDevelopment())
app.UseDeveloperExceptionPage();

View file

@ -9,7 +9,10 @@ namespace Yavsc
public static async Task Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Configuration
.AddJsonFile("appsettings-org.json", optional: false, reloadOnChange: false)
.AddJsonFile($"appsettings-org.{builder.Environment.EnvironmentName}.json", optional: false, reloadOnChange: false)
.AddEnvironmentVariables();
var app = await builder
.ConfigureWebAppServices()
.ConfigurePipeline();

View file

@ -35,8 +35,7 @@
},
"Smtp": {
"Host": "[YOURSMTPHOST]",
"Port": 25,
"EnableSSL": false
"Port": 465
},
"DataProtection": {
"Keys": {

View file

@ -16,10 +16,13 @@ using Microsoft.AspNetCore.Authentication;
JwtSecurityTokenHandler.DefaultMapInboundClaims = true;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration
.AddJsonFile("appsettings-web.json", optional: false, reloadOnChange: false)
.AddJsonFile($"appsettings-blogs.{builder.Environment.EnvironmentName}.json", optional: false, reloadOnChange: false)
.AddEnvironmentVariables();
var authSection = builder.Configuration.GetSection("Authentication");
var issuer = authSection.GetValue<String>("Issuer");
var issuer = authSection.GetValue<String>("Issuer");
var clientSection = authSection.GetSection("Client");
var clientId = clientSection.GetValue<String>("Id");
var clientSecret = clientSection.GetValue<String>("Secret");

View file

@ -12,6 +12,11 @@ internal class Program
private static void Main(string[] args)
{
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Configuration
.AddJsonFile("appsettings-cli.json", optional: false, reloadOnChange: false)
.AddJsonFile($"appsettings-cli.{builder.Environment.EnvironmentName}.json", optional: false, reloadOnChange: false)
.AddEnvironmentVariables();
AppHost = builder.Build();
AppConfiguration = builder.Configuration;
AppHost.Start();