Initial JARVIS API codebase

This commit is contained in:
zsolt 2026-08-13 00:14:13 +02:00
commit eee1d5945c
14 changed files with 1223 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
**/bin/
**/obj/
*.tgz
.vs/

6
OtthonApi/.dockerignore Normal file
View File

@ -0,0 +1,6 @@
bin/
obj/
.vs/
.vscode/
*.user
*.suo

12
OtthonApi/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY OtthonApi.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /app/publish --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
WORKDIR /app
COPY --from=build /app/publish .
EXPOSE 8080
ENTRYPOINT ["dotnet", "OtthonApi.dll"]

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.7" />
</ItemGroup>
</Project>

6
OtthonApi/OtthonApi.http Normal file
View File

@ -0,0 +1,6 @@
@OtthonApi_HostAddress = http://localhost:5278
GET {{OtthonApi_HostAddress}}/weatherforecast/
Accept: application/json
###

1009
OtthonApi/Program.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5278",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

34
OtthonBackend.sln Normal file
View File

@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OtthonApi", "OtthonApi\OtthonApi.csproj", "{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Debug|x64.ActiveCfg = Debug|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Debug|x64.Build.0 = Debug|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Debug|x86.ActiveCfg = Debug|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Debug|x86.Build.0 = Debug|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Release|Any CPU.Build.0 = Release|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Release|x64.ActiveCfg = Release|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Release|x64.Build.0 = Release|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Release|x86.ActiveCfg = Release|Any CPU
{CE492B1E-8A9C-40F9-B329-0AF9EA8AB87C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

23
README.md Normal file
View File

@ -0,0 +1,23 @@
# JARVIS API
Inditas Docker Desktopon:
```powershell
docker compose -f api\docker-compose.yml up -d --build
```
Helyi cimek:
- API: `http://localhost:5088`
- Admin felulet: `http://localhost:5088/devices`
- Admin jelszo: `change-me-admin`
- API token: `change-me-local-token`
Elesebb hasznalathoz a `docker-compose.yml` fajlban csereld le az
`OTTHON_API_TOKEN`, `OTTHON_ADMIN_PASSWORD` es `MSSQL_SA_PASSWORD` ertekeket.
Pelda termekkeresesre:
```powershell
curl -H "X-Otthon-Token: change-me-local-token" http://localhost:5088/api/products/5449000000996
```

22
deploy-server.sh Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -euo pipefail
mkdir -p /root/docker/jarvis-api
cd /root/docker/jarvis-api
tar xzf jarvis-api-deploy.tgz
random_text() {
tr -dc 'A-Za-z0-9' </dev/urandom | head -c "${1:-32}"
}
if [ ! -f .env ]; then
{
printf 'JARVIS_API_TOKEN=%s\n' "$(random_text 64)"
printf 'JARVIS_ADMIN_PASSWORD=%s\n' "$(random_text 28)"
printf 'JARVIS_SA_PASSWORD=Jarvis%s!A1\n' "$(random_text 16)"
} > .env
chmod 600 .env
fi
docker compose -f docker-compose.server.yml --env-file .env up -d --build
docker compose -f docker-compose.server.yml --env-file .env ps

28
docker-compose.server.yml Normal file
View File

@ -0,0 +1,28 @@
services:
jarvis-api:
build:
context: ./OtthonApi
container_name: jarvis-api
restart: unless-stopped
depends_on:
- mssql
environment:
ASPNETCORE_URLS: http://+:8080
OTTHON_API_TOKEN: ${JARVIS_API_TOKEN}
OTTHON_ADMIN_PASSWORD: ${JARVIS_ADMIN_PASSWORD}
ConnectionStrings__Default: Server=mssql,1433;Database=JarvisHome;User Id=sa;Password=${JARVIS_SA_PASSWORD};TrustServerCertificate=True;Encrypt=False
ports:
- "127.0.0.1:5088:8080"
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: jarvis-mssql
restart: unless-stopped
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: ${JARVIS_SA_PASSWORD}
volumes:
- jarvis-mssql-data:/var/opt/mssql
volumes:
jarvis-mssql-data:

30
docker-compose.yml Normal file
View File

@ -0,0 +1,30 @@
services:
jarvis-api:
build:
context: ./OtthonApi
container_name: jarvis-api
restart: unless-stopped
depends_on:
- mssql
environment:
ASPNETCORE_URLS: http://+:8080
OTTHON_API_TOKEN: change-me-local-token
OTTHON_ADMIN_PASSWORD: change-me-admin
ConnectionStrings__Default: Server=mssql,1433;Database=JarvisHome;User Id=sa;Password=Jarvis!2026Api;TrustServerCertificate=True;Encrypt=False
ports:
- "5088:8080"
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: jarvis-mssql
restart: unless-stopped
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: Jarvis!2026Api
ports:
- "14333:1433"
volumes:
- jarvis-mssql-data:/var/opt/mssql
volumes:
jarvis-mssql-data: