Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

479 WIP - refactor net 8.0 #489

Draft
wants to merge 5 commits into
base: Development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Database settings
POSTGRES_USER="openperpetuum"
POSTGRES_PASSWORD="openperpetuum"
POSTGRES_DB="openperpetuum"
PGDATA="/var/lib/postgres/data"

# Port mapping setting
# Here you can modify the default values
# Only the SERVER and the ASSET ports are required
# The SERVER port is used to allow access to the server when you connect your client
# The ASSET port is used by the client to fetch assets when connecting to the server
# The DB port is optional, used for debugging

SERVER_PORT=17700
ASSET_PORT=17701
DB_PORT=17702
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,5 @@ paket-files/
__pycache__/
*.pyc
/PerpetuumTests
/src/Perpetuum.ServerService/Properties/Resources.Designer.cs
/src/Perpetuum.ServerService/Properties/Settings.Designer.cs
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "db"]
path = db
url = [email protected]:OpenPerpetuum/OPDB.git
[submodule "asset"]
path = asset
url = [email protected]:OpenPerpetuum/OPResource.git
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

local_dockerfile="docker-compose-local.yml"
compose="docker compose -f '$(local_dockerfile)'" "$@"


help:
echo Commands to compile, deploy, log services used to run an OpenPerpetuum server (used for local development)

compose-up:
./script/compose.sh up -d --build --remove-orphans --wait

compose-down:
./script/compose.sh down --volumes

compose-restart: compose-down compose-up

log-asset:
./script/compose.sh logs asset -f

log-db:
./script/compose.sh logs db -f

log-server:
./script/compose.sh logs server -f

phonyx: help compose-start compose-stop compose-down log-asset log-db log-server
50 changes: 21 additions & 29 deletions Perpetuum.sln
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
# Visual Studio Version 17
VisualStudioVersion = 17.9.34607.119
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum", "src\Perpetuum\Perpetuum.csproj", "{8587A597-848E-497F-8036-3B6F8047EC45}"
ProjectSection(ProjectDependencies) = postProject
{E322BF83-76B8-4395-9FF2-26DF13F6816C} = {E322BF83-76B8-4395-9FF2-26DF13F6816C}
EndProjectSection
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Perpetuum", "src\Perpetuum\Perpetuum.csproj", "{8587A597-848E-497F-8036-3B6F8047EC45}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum.ExportedTypes", "src\Perpetuum.ExportedTypes\Perpetuum.ExportedTypes.csproj", "{E322BF83-76B8-4395-9FF2-26DF13F6816C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Perpetuum.ExportedTypes", "src\Perpetuum.ExportedTypes\Perpetuum.ExportedTypes.csproj", "{E322BF83-76B8-4395-9FF2-26DF13F6816C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum.Server", "src\Perpetuum.Server\Perpetuum.Server.csproj", "{8A6EF898-EF64-4159-96D1-6C742122342F}"
ProjectSection(ProjectDependencies) = postProject
{E322BF83-76B8-4395-9FF2-26DF13F6816C} = {E322BF83-76B8-4395-9FF2-26DF13F6816C}
{8587A597-848E-497F-8036-3B6F8047EC45} = {8587A597-848E-497F-8036-3B6F8047EC45}
EndProjectSection
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Perpetuum.Server", "src\Perpetuum.Server\Perpetuum.Server.csproj", "{8A6EF898-EF64-4159-96D1-6C742122342F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{F39303D9-9F20-4463-AF88-C70D0DA29E07}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum.RequestHandlers", "src\Perpetuum.RequestHandlers\Perpetuum.RequestHandlers.csproj", "{F69F19CA-DF42-420E-BC21-2ADD28C50A0C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Perpetuum.RequestHandlers", "src\Perpetuum.RequestHandlers\Perpetuum.RequestHandlers.csproj", "{F69F19CA-DF42-420E-BC21-2ADD28C50A0C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{7DE0E6B2-17B2-4988-9A45-BC3FA49AB223}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum.AdminTool", "src\Perpetuum.AdminTool\Perpetuum.AdminTool.csproj", "{4736AD6B-6565-4EEF-ABCB-19454342A986}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Perpetuum.AdminTool", "src\Perpetuum.AdminTool\Perpetuum.AdminTool.csproj", "{4736AD6B-6565-4EEF-ABCB-19454342A986}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum.Bootstrapper", "src\Perpetuum.Bootstrapper\Perpetuum.Bootstrapper.csproj", "{E113962C-AD5D-4F17-8D08-656221CBD2D4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Perpetuum.Bootstrapper", "src\Perpetuum.Bootstrapper\Perpetuum.Bootstrapper.csproj", "{E113962C-AD5D-4F17-8D08-656221CBD2D4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum.ServerService", "src\Perpetuum.ServerService\Perpetuum.ServerService.csproj", "{9C77CE95-825E-4BB1-9129-66835BDB8C96}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Perpetuum.ServerService", "src\Perpetuum.ServerService\Perpetuum.ServerService.csproj", "{9C77CE95-825E-4BB1-9129-66835BDB8C96}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -62,18 +54,18 @@ Global
{E322BF83-76B8-4395-9FF2-26DF13F6816C}.Release|x64.Build.0 = Release|Any CPU
{E322BF83-76B8-4395-9FF2-26DF13F6816C}.Release|x86.ActiveCfg = Release|Any CPU
{E322BF83-76B8-4395-9FF2-26DF13F6816C}.Release|x86.Build.0 = Release|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|Any CPU.ActiveCfg = Debug|x64
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|Any CPU.Build.0 = Debug|x64
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|x64.ActiveCfg = Debug|x64
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|x64.Build.0 = Debug|x64
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|x86.ActiveCfg = Debug|x86
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|x86.Build.0 = Debug|x86
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|Any CPU.ActiveCfg = Release|x64
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|Any CPU.Build.0 = Release|x64
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|x64.ActiveCfg = Release|x64
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|x64.Build.0 = Release|x64
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|x86.ActiveCfg = Release|x86
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|x86.Build.0 = Release|x86
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|x64.ActiveCfg = Debug|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|x64.Build.0 = Debug|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|x86.ActiveCfg = Debug|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Debug|x86.Build.0 = Debug|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|Any CPU.Build.0 = Release|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|x64.ActiveCfg = Release|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|x64.Build.0 = Release|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|x86.ActiveCfg = Release|Any CPU
{8A6EF898-EF64-4159-96D1-6C742122342F}.Release|x86.Build.0 = Release|Any CPU
{F69F19CA-DF42-420E-BC21-2ADD28C50A0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F69F19CA-DF42-420E-BC21-2ADD28C50A0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F69F19CA-DF42-420E-BC21-2ADD28C50A0C}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down
57 changes: 57 additions & 0 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
networks:
dev_env:
driver: bridge

volumes:
asset:
db:
server:

services:
asset:
build:
context: ./asset
dockerfile: ../docker/Dockerfile.asset.dev
restart: unless-stopped
networks:
- dev_env
volumes:
- .:/asset
env_file:
- .env.local
ports:
- ${ASSET_PORT}:80

# TODO switch back to use mssql to keep refactor small
# db:
# image: postgres:15.2-alpine
# restart: unless-stopped
# networks:
# - dev_env
# command: postgres -c 'max_connections=1000'
# volumes:
# - db:/var/lib/postgresql/data
# ports:
# - ${DB_PORT}:5432
# env_file:
# - .env.local
# environment:
# PGDATA: /var/lib/postgresql/data

## TODO: plan for migration service

server:
build:
context: .
dockerfile: ./docker/Dockerfile.server.dev
restart: unless-stopped
volumes:
- .:/server
- ./data:/data
ports:
- ${SERVER_PORT}:17700
env_file:
- .env.local
depends_on:
- asset
# - db
11 changes: 11 additions & 0 deletions docker/Dockerfile.asset.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Development dockerfile for the asset

FROM node:10-alpine

WORKDIR /var/www/OPResource

COPY . .

RUN npm install .

CMD ["node", "index.js"]
33 changes: 33 additions & 0 deletions docker/Dockerfile.server.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Development dockerfile for PerpetuumServer

FROM mcr.microsoft.com/dotnet/sdk:8.0

WORKDIR /server

# RUN apt-get update && apt-get install -y gnupg

# RUN gpg --homedir /tmp --no-default-keyring \
# --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg \
# --keyserver hkp://keyserver.ubuntu.com:80 \
# --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

# RUN apt-get update

# RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates wget mono-complete dotnet-sdk-8.0

# RUN wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -O nuget.exe

# TODO, use different FROM starting next line

COPY . .

# RUN mono nuget.exe restore
RUN dotnet restore


# RUN msbuild -m -v:quiet Perpetuum.sln -p:Configuration=Release

RUN dotnet build Perpetuum.sln -p:Configuration=Release

RUN echo 1 | dotnet ./bin/x64/Release/Perpetuum.Server/Perpetuum.Server.exe /data

4 changes: 4 additions & 0 deletions script/compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -eux

docker compose -f "docker-compose-local.yml" --env-file ".env.local" "$@"
6 changes: 3 additions & 3 deletions src/Perpetuum.AdminTool/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
</configuration>
Loading