Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
93fd4e61ad |
|||
|
d5f11e83a4 |
7 changed files with 37 additions and 116 deletions
|
|
@ -15,7 +15,7 @@ POSTGRES_HOST=localhost
|
|||
POSTGRES_PORT=5432
|
||||
POSTGRES_DB=db
|
||||
POSTGRES_USER=pguser
|
||||
POSTGRES_PASSWORD=pgpassword
|
||||
POSTGRES_PASSWORD=<your pg password>
|
||||
|
||||
ANTHROPIC_API_KEY=none
|
||||
ANTHROPIC_MAX_TOKENS=0
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ make test
|
|||
|
||||
### La Prod
|
||||
|
||||
`cd srv/Yavsc` : `make pushInProd CONFIGURATION=Release`.
|
||||
`cd srv/Yavsc/contrib` : `make reinstall CONFIGURATION=Release APP_INSTALL_ENV=production`.
|
||||
|
||||
puis, pour une première installation
|
||||
`make install_service`.
|
||||
|
|
|
|||
|
|
@ -1,23 +1,25 @@
|
|||
DESTDIR=
|
||||
DOTNET_FRAMEWORK=net10.0
|
||||
APP_PROJECT_NAMES=Org Blogs Api
|
||||
SLNDIR=..
|
||||
|
||||
include $(SLNDIR)/.env
|
||||
include .env
|
||||
APP_INSTALL_ENV=preprod
|
||||
APP_INSTALL_PREFIX=$(APP_INSTALL_ENV)-
|
||||
include .$(APP_INSTALL_ENV).env
|
||||
|
||||
generated/:
|
||||
@mkdir -p $@
|
||||
|
||||
generated/yavscOrg.service:
|
||||
generated/yavscBlogs.service:
|
||||
generated/yavscApi.service:
|
||||
generated/$(APP_INSTALL_PREFIX)yavscOrg.service:
|
||||
generated/$(APP_INSTALL_PREFIX)yavscBlogs.service:
|
||||
generated/$(APP_INSTALL_PREFIX)yavscApi.service:
|
||||
|
||||
generated/yavsc%.service: generated/ template.service $(SLNDIR)/.env
|
||||
generated/$(APP_INSTALL_PREFIX)yavsc%.service: generated/ template.service $(SLNDIR)/.env
|
||||
@cat template.service | APP_NAME="$*" \
|
||||
DESTDIR="$(DESTDIR)" \
|
||||
HTTP_HOST="$(HTTP_HOST)" \
|
||||
HTTP_PORT="$*_$(HTTP_PORT)" \
|
||||
BASEAPPDIR="$(BASEAPPDIR)" \
|
||||
APP_SYSLOG_ID="yavsc$*" \
|
||||
APPDIR="$(APPDIR)" \
|
||||
APP_SYSLOG_ID="$(APP_INSTALL_PREFIX)yavsc$*" \
|
||||
POSTGRES_HOST="$(POSTGRES_HOST)" \
|
||||
POSTGRES_PORT="$(POSTGRES_PORT)" \
|
||||
POSTGRES_DB="$(POSTGRES_DB)" \
|
||||
|
|
@ -34,11 +36,13 @@ generated/yavsc%.service: generated/ template.service $(SLNDIR)/.env
|
|||
envsubst > $@
|
||||
@echo Created service file: $@
|
||||
|
||||
generate-service-units: generated/$(APP_INSTALL_PREFIX)yavscOrg.service generated/$(APP_INSTALL_PREFIX)yavscBlogs.service generated/$(APP_INSTALL_PREFIX)yavscApi.service
|
||||
|
||||
copy-services: copy-service-Org copy-service-Blogs copy-service-Api
|
||||
copy-service-Org: /etc/systemd/system/yavscOrg.service
|
||||
copy-service-Blogs: /etc/systemd/system/yavscBlogs.service
|
||||
copy-service-Api: /etc/systemd/system/yavscApi.service
|
||||
install-service-%: /etc/systemd/system/$(APP_INSTALL_PREFIX)yavsc%.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable $(APP_INSTALL_PREFIX)yavsc$*
|
||||
|
||||
install-services: install-service-Org install-service-Blogs install-service-Api
|
||||
|
||||
copy-binaries: build_publish_Org build_publish_Blogs build_publish_Api stop-services
|
||||
@for project in $(APP_PROJECT_NAMES); \
|
||||
|
|
@ -52,23 +56,23 @@ copy-binaries: build_publish_Org build_publish_Blogs build_publish_Api stop-serv
|
|||
rm -f $${BINDIR}/appsettings-$${LCAPI}.json ; \
|
||||
sync ; \
|
||||
ls $${BINDIR}/appsettings* 2>&1 ; \
|
||||
sudo cp -a $${BINDIR}/* $(BASEAPPDIR) ; \
|
||||
sudo cp -a $${BINDIR}/* $(DESTDIR)$(APPDIR) ; \
|
||||
done
|
||||
@sudo chown -R $(USER_AND_GROUP) $(BASEAPPDIR)
|
||||
@sudo chown -R $(USER_AND_GROUP) $(DESTDIR)$(APPDIR)
|
||||
@sync
|
||||
|
||||
/etc/systemd/system/yavsc%.service: generated/yavsc%.service
|
||||
|
||||
$(DESTDIR)/etc/systemd/system/$(APP_INSTALL_PREFIX)yavsc%.service: generated/$(APP_INSTALL_PREFIX)yavsc%.service
|
||||
sudo cp $^ $@
|
||||
sudo chown root:root $@
|
||||
|
||||
build_publish_%: clean_publish_dir_%
|
||||
@ASPNETCORE_ENV=$(CONFIGURATION) dotnet publish $(SLNDIR)/src/Yavsc.$*/Yavsc.$*.csproj
|
||||
|
||||
build_publish: build_publish_Org build_publish_Blogs build_publish_Api
|
||||
|
||||
clean_publish_dir_%:
|
||||
@rm -rf $(SLNDIR)/src/Yavsc.$*/bin/$(CONFIGURATION)/$(DOTNET_FRAMEWORK)/publish
|
||||
|
||||
install: build_publish copy-binaries copy-services
|
||||
install: copy-binaries copy-services
|
||||
@sudo systemctl daemon-reload
|
||||
@for project in $(APP_PROJECT_NAMES); \
|
||||
do \
|
||||
|
|
@ -77,10 +81,13 @@ install: build_publish copy-binaries copy-services
|
|||
done
|
||||
|
||||
reinstall: copy-binaries
|
||||
@sync
|
||||
@for project in $(APP_PROJECT_NAMES); do \
|
||||
sudo systemctl start yavsc$${project} ; done
|
||||
|
||||
reinstall-pre: copy-binaries
|
||||
@for project in $(APP_PROJECT_NAMES); do \
|
||||
sudo systemctl start yavscPre$${project} ; done
|
||||
|
||||
stop-services:
|
||||
@for project in $(APP_PROJECT_NAMES); \
|
||||
do \
|
||||
|
|
@ -93,7 +100,7 @@ $(SLNDIR)/src/Yavsc.Api/bin/$(CONFIGURATION)/$(DOTNET_FRAMEWORK)/publish: build_
|
|||
|
||||
showConfig:
|
||||
@echo CONFIGURATION: $(CONFIGURATION)
|
||||
@echo BASEAPPDIR: $(BASEAPPDIR)
|
||||
@echo APPDIR: $(APPDIR)
|
||||
|
||||
showApiLogs:
|
||||
@sudo journalctl -u yavscApi.service -S "2 min ago" | tee yavscApi.log
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ RestartSec=5s
|
|||
Type=simple
|
||||
User=yavsc
|
||||
Group=yavsc
|
||||
WorkingDirectory=$DESTDIR
|
||||
ExecStart=$DESTDIR/Yavsc.$APP_NAME
|
||||
WorkingDirectory=$APPDIR
|
||||
ExecStart=$APPDIR/Yavsc.$APP_NAME
|
||||
Restart=always
|
||||
Environment="HOME=$DESTDIR"
|
||||
Environment="HOME=$APPDIR"
|
||||
Environment="ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY"
|
||||
Environment="ANTHROPIC_MAX_TOKENS=$ANTHROPIC_MAX_TOKENS"
|
||||
Environment="ASPNETCORE_Environment=$ENV"
|
||||
|
|
@ -29,8 +29,6 @@ Environment="ASPNETCORE_Smtp__Password=\"$ASPNETCORE_Smtp__Password\""
|
|||
|
||||
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=$APP_SYSLOG_ID
|
||||
|
||||
[Install]
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
|
||||
server {
|
||||
if ($host = yavsc.pschneider.fr) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
|
||||
|
||||
|
||||
listen 80;
|
||||
server_name yavsc.pschneider.fr;
|
||||
location / {
|
||||
root /srv/www/yavsc/wwwroot;
|
||||
dav_methods PUT;
|
||||
|
||||
proxy_pass http://127.0.0.1:3003;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection keep-alive;
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name yavsc.pschneider.fr;
|
||||
ssl_certificate /etc/letsencrypt/live/yavsc.pschneider.fr-0001/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/yavsc.pschneider.fr-0001/privkey.pem; # managed by Certbot
|
||||
# Configure the SignalR Endpoint
|
||||
location / {
|
||||
# App server url
|
||||
proxy_pass http://localhost:3003;
|
||||
|
||||
proxy_cache off;
|
||||
# WebSockets were implemented after http/1.0
|
||||
proxy_http_version 1.1;
|
||||
|
||||
# Configuration for ServerSentEvents
|
||||
proxy_buffering off;
|
||||
|
||||
# Configuration for LongPolling or if your KeepAliveInterval is longer than 60 seconds
|
||||
proxy_read_timeout 100s;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
using DotMarkdown.Linq;
|
||||
using Markdig;
|
||||
using Xunit;
|
||||
using static DotMarkdown.Linq.MFactory;
|
||||
|
||||
|
||||
public class MarkdownTests
|
||||
{
|
||||
[Fact]
|
||||
public void TestMarkdownRendering()
|
||||
{
|
||||
MDocument document = Document(
|
||||
Heading1("Markdown Sample"),
|
||||
Heading2("Bullet List"),
|
||||
BulletList(
|
||||
"text",
|
||||
Bold("bold text")),
|
||||
HorizontalRule(),
|
||||
Heading2("IndentedCodeBlock"),
|
||||
IndentedCodeBlock("string s = null;"));
|
||||
|
||||
Console.WriteLine(document.ToString());
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestAnotherMarkdownRendering()
|
||||
{
|
||||
var result = Markdown.ToHtml("This is a text with some *emphasis*");
|
||||
|
||||
|
||||
Console.WriteLine(result);
|
||||
}
|
||||
}
|
||||
|
|
@ -140,6 +140,10 @@ namespace Yavsc.Services
|
|||
catch (FormatException ex)
|
||||
{
|
||||
logger.LogError(ex, "Refusing to send email because the recipient or sender address is malformed. To={To}, From={From}", email, siteSettings.Owner.EMail);
|
||||
logger.LogError(ex.Message);
|
||||
if (ex.InnerException!=null)
|
||||
logger.LogError(ex.InnerException.Message);
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
catch (SmtpCommandException ex)
|
||||
|
|
|
|||
Loading…
Reference in a new issue