Add install script.

This commit is contained in:
xuef
2023-12-30 14:59:42 +00:00
parent c3f2863c10
commit 2c49af46b1
2 changed files with 38 additions and 0 deletions
+10
View File
@@ -7,6 +7,16 @@
ChessServer is just a simple chess server for [Aiursoft](https://www.aiursoft.com) to test our new features.
## Run in Ubuntu
First, specify a domain name for your Ubuntu 18.04+, brand-new server.
And execute the following command in the server:
```bash
curl -sL https://gitlab.aiursoft.cn/aiursoft/chessserver/-/raw/master/install.sh | sudo bash
```
## Run locally
Requirements about how to run
+28
View File
@@ -0,0 +1,28 @@
aiur() { arg="$( cut -d ' ' -f 2- <<< "$@" )" && curl -sL https://gitlab.aiursoft.cn/aiursoft/aiurscript/-/raw/master/$1.sh | sudo bash -s $arg; }
app_name="chessserver"
repo_path="https://gitlab.aiursoft.cn/aiursoft/chessserver"
proj_path="src/Aiursoft.ChessServer/Aiursoft.ChessServer.csproj"
dll_name="Aiursoft.ChessServer.dll"
install()
{
port=$1
if [ -z "$port" ]; then
port=$(aiur network/get_port)
fi
echo "Installing $app_name... to port $port"
aiur install/dotnet
aiur git/clone_to $repo_path /tmp/repo
aiur dotnet/publish "/tmp/repo/$proj_path" "/opt/apps/$app_name"
aiur services/register_aspnet_service $app_name $port "/opt/apps/$app_name" $dll_name
echo "Install $app_name finished! Please open http://$(hostname):$port to try!"
rm /tmp/repo -rf
}
# This will install this app under /opt/apps and register a new service with systemd.
# Example: install 5000
install "$@"