Closed gregology closed 2 years ago
please add an environment variable to /etc/environment with the name of: $ASPNETCORE_ENVIRONMENT and a value of: Production
I added ASPNETCORE_ENVIRONMENT=Production
to /etc/environment
and also the docker-compose.yaml
but I'm still having the same issue. I also tried to mounting - /etc/environment:/etc/environment
with no luck. Is there some other troubleshooting you suggest?
Cheers
$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
ASPNETCORE_ENVIRONMENT="Production"
$ cat docker-compose.yml
version: "3.3"
services:
PavlovRconWebserver:
container_name: PavlovRconWebserver
ports:
- 5001:5001
restart: always
image: mcr.microsoft.com/dotnet/sdk:5.0
volumes:
- /opt/PavlovRconWebserver/Database/:/build/Database/
- /opt/PavlovRconWebserver/appsettings.Production.json:/build/appsettings.Production.json
environment:
- ASPNETCORE_ENVIRONMENT=Production
command:
- bash
- -c
- >
git clone https://github.com/devinSpitz/PavlovRconWebserver.git;
cd /PavlovRconWebserver/PavlovRconWebserver/;
dotnet publish -c release -o /build --runtime linux-x64 --self-contained true --framework net5.0;
cd /build/;
[ ! -f build/Database/Database.db ] && cp /PavlovRconWebserver/PavlovRconWebserver/DefaultDB/Database.db /build/Database/Database.db;
[ ! -f build/appsettings.Production.json ] && cp /PavlovRconWebserver/PavlovRconWebserver/appsettings.Development.json /build/appsettings.Production.json;
/build/PavlovRconWebserver --urls=http://*:5001/;
$ docker-compose up
Creating PavlovRconWebserver ... done
Attaching to PavlovRconWebserver
PavlovRconWebserver | Cloning into 'PavlovRconWebserver'...
PavlovRconWebserver | Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET
PavlovRconWebserver | Copyright (C) Microsoft Corporation. All rights reserved.
PavlovRconWebserver |
PavlovRconWebserver | Determining projects to restore...
PavlovRconWebserver | Restored /PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj (in 10.08 sec).
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/LeaderBoardController.cs(87,42): warning CS0108: 'LeaderBoardController.User(string)' hides inherited member 'ControllerBase.User'. Use the new keyword if hiding was intended. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/AccountController.cs(210,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/RoleController.cs(56,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/TeamController.cs(140,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Extensions/RconStatic.cs(214,52): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/RconController.cs(326,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Services/ServerSelectedModsService.cs(86,34): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/RconController.cs(581,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/RconController.cs(587,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Services/SteamService.cs(306,33): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Extensions/RconStatic.cs(991,17): warning CS0219: The variable 'success' is assigned but its value is never used [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Views/JsonToHtmlPartialView.cshtml(8,11): warning CS8669: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Views/PublicViewLists/PlayersFromServers.cshtml(75,17): warning CS0472: The result of the expression is always 'true' since a value of type 'int' is never equal to 'null' of type 'int?' [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | PavlovRconWebserver -> /PavlovRconWebserver/PavlovRconWebserver/bin/release/net5.0/linux-x64/PavlovRconWebserver.dll
PavlovRconWebserver | PavlovRconWebserver -> /PavlovRconWebserver/PavlovRconWebserver/bin/release/net5.0/linux-x64/PavlovRconWebserver.Views.dll
PavlovRconWebserver | PavlovRconWebserver -> /build/
PavlovRconWebserver | Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.Production.json' was not found and is not optional. The physical path is '/build/appsettings.Production.json'.
PavlovRconWebserver | at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)
PavlovRconWebserver | at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
PavlovRconWebserver | at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
PavlovRconWebserver | at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
PavlovRconWebserver | at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
PavlovRconWebserver | at PavlovRconWebserver.Program.Main(String[] args) in /PavlovRconWebserver/PavlovRconWebserver/Program.cs:line 23
PavlovRconWebserver | bash: line 1: 200 Aborted (core dumped) /build/PavlovRconWebserver --urls=http://*:5001/
I tried running this on a fresh docker host on a new VM with the same results
$ wget https://raw.githubusercontent.com/devinSpitz/PavlovRconWebserver/master/PavlovRconWebserver/docker-compose.yml
--2022-07-17 19:38:27-- https://raw.githubusercontent.com/devinSpitz/PavlovRconWebserver/master/PavlovRconWebserver/docker-compose.yml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1021 [text/plain]
Saving to: ‘docker-compose.yml’
docker-compose.yml 100%[====================================================================================================================>] 1021 --.-KB/s in 0s
2022-07-17 19:38:27 (67.8 MB/s) - ‘docker-compose.yml’ saved [1021/1021]
$ docker-compose up
Creating network "pavlov_default" with the default driver
Pulling PavlovRconWebserver (mcr.microsoft.com/dotnet/sdk:5.0)...
5.0: Pulling from dotnet/sdk
c1ad9731b2c7: Pull complete
169ba0027942: Pull complete
c4c86b92f556: Pull complete
e76245086e24: Pull complete
0bf07af7e5b6: Pull complete
85081c9db788: Pull complete
5fdeb3a38fe8: Pull complete
d395fb0767b4: Pull complete
Digest: sha256:3ff465d940de3e2c727794d92fd7bb649c498d4abd91bc9213ea7831ebf01f1e
Status: Downloaded newer image for mcr.microsoft.com/dotnet/sdk:5.0
Creating PavlovRconWebserver ... done
Attaching to PavlovRconWebserver
PavlovRconWebserver | Cloning into 'PavlovRconWebserver'...
PavlovRconWebserver | Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET
PavlovRconWebserver | Copyright (C) Microsoft Corporation. All rights reserved.
PavlovRconWebserver |
PavlovRconWebserver | Determining projects to restore...
PavlovRconWebserver | Restored /PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj (in 47.5 sec).
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/LeaderBoardController.cs(87,42): warning CS0108: 'LeaderBoardController.User(string)' hides inherited member 'ControllerBase.User'. Use the new keyword if hiding was intended. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/TeamController.cs(140,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/RoleController.cs(56,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Services/SteamService.cs(306,33): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Extensions/RconStatic.cs(214,52): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/RconController.cs(326,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Extensions/RconStatic.cs(991,17): warning CS0219: The variable 'success' is assigned but its value is never used [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/RconController.cs(581,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/RconController.cs(587,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Controllers/AccountController.cs(210,42): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Services/ServerSelectedModsService.cs(86,34): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Views/JsonToHtmlPartialView.cshtml(8,11): warning CS8669: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source. [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | /PavlovRconWebserver/PavlovRconWebserver/Views/PublicViewLists/PlayersFromServers.cshtml(75,17): warning CS0472: The result of the expression is always 'true' since a value of type 'int' is never equal to 'null' of type 'int?' [/PavlovRconWebserver/PavlovRconWebserver/PavlovRconWebserver.csproj]
PavlovRconWebserver | PavlovRconWebserver -> /PavlovRconWebserver/PavlovRconWebserver/bin/release/net5.0/linux-x64/PavlovRconWebserver.dll
PavlovRconWebserver | PavlovRconWebserver -> /PavlovRconWebserver/PavlovRconWebserver/bin/release/net5.0/linux-x64/PavlovRconWebserver.Views.dll
PavlovRconWebserver | PavlovRconWebserver -> /build/
PavlovRconWebserver | Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings..json' was not found and is not optional. The physical path is '/build/appsettings..json'.
PavlovRconWebserver | at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)
PavlovRconWebserver | at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
PavlovRconWebserver | at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
PavlovRconWebserver | at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
PavlovRconWebserver | at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
PavlovRconWebserver | at PavlovRconWebserver.Program.Main(String[] args) in /PavlovRconWebserver/PavlovRconWebserver/Program.cs:line 23
PavlovRconWebserver | bash: line 1: 197 Aborted (core dumped) /build/PavlovRconWebserver --urls=http://*:5001/
Okay, will check the docker procedural as soon as possible maybe next weekend :)
Cheers mate, let me know how I can help
The update should fix your problem but please also make sure:
Can confirm, this works. Cheers!
Hello Team, I'm running the example
docker-compose.yml
but I'm getting aSystem.IO.FileNotFoundException
errorThe configuration file 'appsettings..json' was not found and is not optional
. Note the two..
in the filename. My C# is rubbish but maybe it is related to RconStatic.cs ¯\_(ツ)_/¯Here is the full log, am I doing something wrong?