* Rage code * Hrrm * Fix windows newlines * Utter insanity * This won't work as a post compile step * Why didn't I do this before? * Shouldn't be necessary * This could be it * Just move it here * Fixes * Readme updates * Readme * REAAAAD * Use envars * More env vars * typo * Fixes * REAAAD * Fix script * The missing linkCyberboss-patch-1
@ -0,0 +1,74 @@ | |||
This is @Cyberboss rage code | |||
The goal is a one stop solution for hosting /tg/station on linux via Docker. Will not work with Docker on Windows. | |||
This requires Docker with the `docker-compose` command to be installed on your system. See ubuntu instructions [here](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository). If you fail to find the `docker-ce` package refer to [this StackOverflow answer](https://unix.stackexchange.com/a/363058). | |||
Some basic configuration options in `docker-compose.yml` before starting: | |||
- Change TGS_ADMIN_CKEY to your ckey so you may have initial control over the server. | |||
- Change TGS_SCHEMA_MAJOR_VERSION to your repo's latest schema major version. | |||
- Change TGS_SCHEMA_MINOR_VERSION to your repo's latest schema minor version. | |||
- If you want to change the MariaDB password, there are three locations in the file it must be changed from its default value of `ChangeThisInBothMariaDBAndTgsConnectionString`. | |||
- Change TGS_BYOND to set the initial BYOND version. | |||
- Ports are mapped in the form `<external>:<internal>` NEVER change the internal port. If you want to prevent a service from being exposed, delete/comment out the entire line. | |||
- The first (3306) is the exposed mariadb port. Do not expose this over the internet without changing the password. In general it's a bad idea. | |||
- The second (1337) is the exposed DreamDaemon port | |||
- The third (5000) is the exposed TGS API port. Do not expose this over the internet. Setup an HTTPS reverse proxy instead. | |||
- Change TGS_REPO to set the repository used. Note, this must be a /tg/ derivative from at least 2019 that implements the latest TGS [DreamMaker API](https://github.com/tgstation/tgstation-server#integrating). Repositories that follow tgstation/tgstation will have this automatically. It also must contain a prefixed SQL schema setup file. | |||
To launch, change to this directory and run `docker-compose up`. The initial setup will take a long time. If that fails, Ctrl+C out, run `docker-compose down`, remove `./TGS_Instances` and `./Database`, and try again. Once setup is complete, you can either leave the terminal running, or `Ctrl+C` out (this will stop DreamDaemon) and run `docker-compose -d` to run it in the background. | |||
What it does: | |||
- Starts mariadb with the data files in `./Database` on port 3306 | |||
- Installs and starts Tgs4 (using latest stable docker tag, no HTTPS) on port 5000. Configuration in `./TGS_Config`, logs in `./TGS_Logs`. | |||
- Configures a TGS instance for tgstation in `./TGS_Instances` (SetupProgram) | |||
- The instance is configured to autostart | |||
- Repo is cloned from the origin specified in the `docker-compose.yml` | |||
- BYOND version is set to the latest one specified in the `docker-compose.yml` | |||
- A script will be run to setup dependencies. This does the following every time the game is built: | |||
- Reads dependency information from `dependencies.sh` in the root of the repository | |||
- Installs the following necessary packages into the TGS image | |||
- Rust/cargo | |||
- git | |||
- cmake | |||
- grep | |||
- g++-6 | |||
- g++-6-multilib | |||
- mysql-client | |||
- libmariadb-dev:i386 | |||
- libssl-dev:i386 | |||
- Builds rust-g in `./TGS_Instances/main/Configuration/EventScripts/rust-g` and copies the artifact to the game directory. | |||
- Builds BSQL in `./TGS_Instances/main/Configuration/EventScripts/BSQL` and copies the artifact to the game directory. | |||
- Sets up `./TGS_Instances/main/Configuration/GameStaticFiles/config` with the initial repository config. | |||
- Sets up `./TGS_Instances/main/Configuration/GameStaticFiles/data`. | |||
- If it doesn't exist, create the `ss13_db` database on the mariadb server and populate it with the repository's. | |||
- Start DreamDaemon and configure it to autostart and keep it running via TGS. | |||
- Updates will be pulled from the default repository branch and deployed every hour | |||
What it DOESN'T do: | |||
- Configure sane MariaDB security | |||
- TGS Test merging | |||
- TGS Chat bots | |||
- Handle updating BYOND versions | |||
- Handle updating the database schema | |||
- Manage TGS users, permissions, or change the default admin password | |||
- Provide HTTPS for TGS | |||
- Expose the DB to the internet UNLESS you have port 3306 forwarded for some ungodly reason | |||
- Port forward or setup firewall rules for DreamDaemon or TGS | |||
- Notify you of TGS errors past initial setup | |||
- Keep MariaDB logs | |||
- Backup ANYTHING | |||
- Pretend like it's a long term solution | |||
This is enough to host a production level server !!!IN THEORY!!! This script guarantees nothing and comes with no warranty | |||
You can change the TGS_BYOND and TGS_REPO variables when setting up the first time. But further configuration must be done with TGS itself. | |||
You can connect to TGS with [Tgstation.Server.ControlPanel](https://github.com/tgstation/Tgstation.Server.ControlPanel/releases) (Binaries provided for windows, must be compiled manually on Linux). | |||
- Connect to `http://localhost:5000`. Be sure to `Use Plain HTTP` and `Default Credentials` | |||
You should learn how to manually setup TGS if you truly want control over what your server does. | |||
You have been warned. |
@ -0,0 +1,8 @@ | |||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | |||
# THIS SHOULD NOT BE USED TO CREATE THE PRODUCTION BUILD IT'S FOR DEBUGGING ONLY | |||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 | |||
WORKDIR /app | |||
COPY . . | |||
ENTRYPOINT ["dotnet", "run"] |
@ -0,0 +1,106 @@ | |||
#!/bin/bash | |||
set -e | |||
set -x | |||
#load dep exports | |||
#need to switch to game dir for Dockerfile weirdness | |||
original_dir=$PWD | |||
cd "$1" | |||
. dependencies.sh | |||
cd "$original_dir" | |||
#find out what we have (+e is important for this) | |||
set +e | |||
has_git="$(command -v git)" | |||
has_cargo="$(command -v ~/.cargo/bin/cargo)" | |||
has_sudo="$(command -v sudo)" | |||
has_cmake="$(command -v cmake)" | |||
has_gpp="$(command -v g++-6)" | |||
has_grep="$(command -v grep)" | |||
DATABASE_EXISTS="$(mysqlshow --host mariadb --port 3306 --user=root --password=$MYSQL_ROOT_PASSWORD ss13_db| grep -v Wildcard | grep -o ss13_db)" | |||
set -e | |||
# install cargo if needful | |||
if ! [ -x "$has_cargo" ]; then | |||
echo "Installing rust..." | |||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-host i686-unknown-linux-gnu | |||
. ~/.profile | |||
fi | |||
# apt packages | |||
if ! { [ -x "$has_git" ] && [ -x "$has_cmake" ] && [ -x "$has_gpp" ] && [ -x "$has_grep" ] && [ -f "/usr/lib/i386-linux-gnu/libmariadb.so.3" ] && [ -f "/usr/lib/i386-linux-gnu/libssl.so" ] && [ -d "/usr/share/doc/g++-6-multilib" ] && [ -f "/usr/bin/mysql" ] && [ -d "/usr/include/mysql" ]; }; then | |||
echo "Installing apt dependencies..." | |||
if ! [ -x "$has_sudo" ]; then | |||
dpkg --add-architecture i386 | |||
apt-get update | |||
apt-get install -y git cmake libmariadb-dev:i386 libssl-dev:i386 grep g++-6 g++-6-multilib mysql-client | |||
ln -s /usr/include/mariadb /usr/include/mysql | |||
rm -rf /var/lib/apt/lists/* | |||
else | |||
sudo dpkg --add-architecture i386 | |||
sudo apt-get update | |||
sudo apt-get install -y git cmake libmariadb-dev:i386 libssl-dev:i386 grep g++-6 g++-6-multilib mysql-client | |||
sudo ln -s /usr/include/mariadb /usr/include/mysql | |||
sudo rm -rf /var/lib/apt/lists/* | |||
fi | |||
fi | |||
#update rust-g | |||
if [ ! -d "rust-g" ]; then | |||
echo "Cloning rust-g..." | |||
git clone https://github.com/tgstation/rust-g | |||
else | |||
echo "Fetching rust-g..." | |||
cd rust-g | |||
git fetch | |||
cd .. | |||
fi | |||
#update BSQL | |||
if [ ! -d "BSQL" ]; then | |||
echo "Cloning BSQL..." | |||
git clone https://github.com/tgstation/BSQL | |||
else | |||
echo "Fetching BSQL..." | |||
cd BSQL | |||
git fetch | |||
cd .. | |||
fi | |||
echo "Deploying rust-g..." | |||
cd rust-g | |||
git checkout "$RUST_G_VERSION" | |||
~/.cargo/bin/cargo build --release | |||
mv target/release/librust_g.so "$1/rust_g" | |||
cd .. | |||
echo "Deploying BSQL..." | |||
cd BSQL | |||
git checkout "$BSQL_VERSION" | |||
mkdir -p mysql | |||
mkdir -p artifacts | |||
cd artifacts | |||
cmake .. -DCMAKE_CXX_COMPILER=g++-6 -DMARIA_LIBRARY=/usr/lib/i386-linux-gnu/libmariadb.so.3 | |||
make | |||
mv src/BSQL/libBSQL.so "$1/" | |||
cp /usr/lib/i386-linux-gnu/libmariadb.so.3 "$1/" | |||
cd ../.. | |||
if [ ! -d "../GameStaticFiles/config" ]; then | |||
echo "Creating initial config..." | |||
cp -r "$1/config" "../GameStaticFiles/config" | |||
echo -e "SQL_ENABLED\nFEEDBACK_TABLEPREFIX SS13_\nADDRESS mariadb\nPORT 3306\nFEEDBACK_DATABASE ss13_db\nFEEDBACK_LOGIN root\nFEEDBACK_PASSWORD $MYSQL_ROOT_PASSWORD\nASYNC_QUERY_TIMEOUT 10\nBLOCKING_QUERY_TIMEOUT 5\nBSQL_THREAD_LIMIT 50" > "../GameStaticFiles/config/dbconfig.txt" | |||
echo "$TGS_ADMIN_CKEY = Host" > "../GameStaticFiles/config/admins.txt" | |||
fi | |||
if [ "$DATABASE_EXISTS" != "ss13_db" ]; then | |||
echo "Creating initial SS13 database..." | |||
mysql -u root --password=$MYSQL_ROOT_PASSWORD -h mariadb -P 3306 -e 'CREATE DATABASE IF NOT EXISTS ss13_db;' | |||
cat "$1/$TGS_PREFIXED_SCHEMA_FILE" | |||
mysql -u root --password=$MYSQL_ROOT_PASSWORD -h mariadb -P 3306 ss13_db < "$1/$TGS_PREFIXED_SCHEMA_FILE" | |||
mysql -u root --password=$MYSQL_ROOT_PASSWORD -h mariadb -P 3306 ss13_db -e "INSERT INTO \`SS13_schema_revision\` (\`major\`, \`minor\`) VALUES ($TGS_SCHEMA_MAJOR_VERSION, $TGS_SCHEMA_MINOR_VERSION)" | |||
fi | |||
#just trust me, i nearly lost my shit | |||
rm -rf "$1/byond-extools.dll" |
@ -0,0 +1,208 @@ | |||
using System; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Net.Http; | |||
using System.Net.Http.Headers; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using Tgstation.Server.Api.Models; | |||
using Tgstation.Server.Client; | |||
using Tgstation.Server.Client.Components; | |||
namespace SetupProgram | |||
{ | |||
class Program | |||
{ | |||
public static async Task<int> Main() | |||
{ | |||
var repo = Environment.GetEnvironmentVariable("TGS_REPO")?.Trim(); | |||
if (String.IsNullOrWhiteSpace(repo)) | |||
{ | |||
Console.WriteLine("ERROR: Environment variable TGS_REPO not set to a git url!"); | |||
return 1; | |||
} | |||
var byondStr = Environment.GetEnvironmentVariable("TGS_BYOND")?.Trim(); | |||
if (String.IsNullOrWhiteSpace(byondStr) || !Version.TryParse(byondStr, out Version byond) || byond.Build != -1) | |||
{ | |||
Console.WriteLine("ERROR: Environment variable TGS_BYOND not set to a valid BYOND version!"); | |||
return 2; | |||
} | |||
var clientFactory = new ServerClientFactory(new ProductHeaderValue("LinuxOneShot", "1.0.0")); | |||
IServerClient serverClient = null; | |||
Instance instance = null; | |||
IInstanceClient instanceClient; | |||
void CreateInstanceClient() => instanceClient = serverClient.Instances.CreateClient(instance); | |||
async Task CreateAdminClient() | |||
{ | |||
Console.WriteLine("Attempting to reestablish connection to TGS (120s max wait)..."); | |||
var giveUpAt = DateTimeOffset.Now.AddSeconds(60); | |||
do | |||
{ | |||
try | |||
{ | |||
serverClient = await clientFactory.CreateServerClient(new Uri("http://tgs:80"), User.AdminName, User.DefaultAdminPassword, default, default); | |||
if (instance != null) | |||
CreateInstanceClient(); | |||
break; | |||
} | |||
catch (HttpRequestException) | |||
{ | |||
//migrating, to be expected | |||
if (DateTimeOffset.Now > giveUpAt) | |||
throw; | |||
await Task.Delay(TimeSpan.FromSeconds(1)); | |||
} | |||
catch (ServiceUnavailableException) | |||
{ | |||
// migrating, to be expected | |||
if (DateTimeOffset.Now > giveUpAt) | |||
throw; | |||
await Task.Delay(TimeSpan.FromSeconds(1)); | |||
} | |||
} while (true); | |||
} | |||
async Task WaitForJob(Job originalJob, CancellationToken cancellationToken) | |||
{ | |||
var job = originalJob; | |||
int? lastProgress = null; | |||
do | |||
{ | |||
try | |||
{ | |||
await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken).ConfigureAwait(false); | |||
job = await instanceClient.Jobs.GetId(job, cancellationToken).ConfigureAwait(false); | |||
if (job.Progress != lastProgress) | |||
{ | |||
Console.WriteLine($"Progress: {job.Progress}"); | |||
lastProgress = job.Progress; | |||
} | |||
} | |||
catch (UnauthorizedException) | |||
{ | |||
await CreateAdminClient(); | |||
} | |||
} | |||
while (!job.StoppedAt.HasValue); | |||
if (job.ExceptionDetails != null) | |||
{ | |||
Console.WriteLine(job.ExceptionDetails); | |||
Environment.Exit(3); | |||
} | |||
} | |||
await CreateAdminClient(); | |||
Console.WriteLine("Listing instances..."); | |||
var instances = await serverClient.Instances.List(default); | |||
if (instances.Any()) | |||
{ | |||
Console.WriteLine("One or more instances already exist, aborting!"); | |||
return 3; | |||
} | |||
Console.WriteLine("Creating instance..."); | |||
instance = await serverClient.Instances.CreateOrAttach(new Instance | |||
{ | |||
ConfigurationType = ConfigurationType.HostWrite, | |||
Name = "AutoInstance", | |||
Path = "/tgs4_instances/main" | |||
}, default); | |||
Console.WriteLine("Onlining instance..."); | |||
instance.Online = true; | |||
instance = await serverClient.Instances.Update(instance, default); | |||
CreateInstanceClient(); | |||
Console.WriteLine("Starting repo clone..."); | |||
var cloneJobTask = instanceClient.Repository.Clone(new Repository | |||
{ | |||
Origin = repo | |||
}, default); | |||
Console.WriteLine($"Starting BYOND install {byond}..."); | |||
var byondInstallTask = instanceClient.Byond.SetActiveVersion(new Byond | |||
{ | |||
Version = byond | |||
}, default); | |||
Console.WriteLine("Setting DD Settings to Ultrasafe|Startup Timeout=120|AutoStart=true|HeartbeatSeconds=120..."); | |||
var ddUpdateTask = instanceClient.DreamDaemon.Update(new DreamDaemon | |||
{ | |||
AutoStart = true, | |||
SecurityLevel = DreamDaemonSecurity.Ultrasafe, | |||
HeartbeatSeconds = 120, | |||
StartupTimeout = 120 | |||
}, default); | |||
Console.WriteLine("Setting API validation security level to trusted..."); | |||
var dmUpdateTask = instanceClient.DreamMaker.Update(new DreamMaker | |||
{ | |||
ApiValidationSecurityLevel = DreamDaemonSecurity.Trusted | |||
}, default); | |||
Console.WriteLine("Uploading EventScripts/PreCompile.sh..."); | |||
var configurationTask = instanceClient.Configuration.Write(new ConfigurationFile | |||
{ | |||
Path = "/EventScripts/PreCompile.sh", | |||
Content = File.ReadAllBytes("PreCompile.sh") | |||
}, default); | |||
Console.WriteLine("Creating GameStaticFiles/data..."); | |||
var configTask2 = instanceClient.Configuration.CreateDirectory(new ConfigurationFile | |||
{ | |||
IsDirectory = true, | |||
Path = "/GameStaticFiles/data" | |||
}, default); | |||
Console.WriteLine("Waiting for previous requests..."); | |||
await Task.WhenAll( | |||
cloneJobTask, | |||
byondInstallTask, | |||
ddUpdateTask, | |||
dmUpdateTask, | |||
configurationTask, | |||
configTask2); | |||
Console.WriteLine("Waiting for BYOND install..."); | |||
var installJob = await byondInstallTask; | |||
await WaitForJob(installJob.InstallJob, default); | |||
Console.WriteLine("Waiting for Repo clone..."); | |||
var cloneJob = await cloneJobTask; | |||
await WaitForJob(cloneJob.ActiveJob, default); | |||
await CreateAdminClient(); | |||
Console.WriteLine("Starting deployment..."); | |||
var deployJobTask = instanceClient.DreamMaker.Compile(default); | |||
Console.WriteLine("Enabling auto updates every hour..."); | |||
instance.AutoUpdateInterval = 60; | |||
await serverClient.Instances.Update(instance, default); | |||
Console.WriteLine("Waiting for deployment job..."); | |||
var deployJob = await deployJobTask; | |||
await WaitForJob(deployJob, default); | |||
await CreateAdminClient(); | |||
Console.WriteLine("Launching watchdog..."); | |||
var launchJob = await instanceClient.DreamDaemon.Start(default); | |||
await WaitForJob(launchJob, default); | |||
Console.WriteLine("Complete!"); | |||
return 0; | |||
} | |||
} | |||
} |
@ -0,0 +1,12 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>Exe</OutputType> | |||
<TargetFramework>netcoreapp3.1</TargetFramework> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Tgstation.Server.Client" Version="6.1.0" /> | |||
</ItemGroup> | |||
</Project> |
@ -0,0 +1,29 @@ | |||
{ | |||
"Database": { | |||
"DatabaseType": "MariaDB", | |||
"ResetAdminPassword": false | |||
}, | |||
"General": { | |||
"MinimumPasswordLength": 15, | |||
"GitHubAccessToken": "", | |||
"ByondTopicTimeout": 5000, | |||
"RestartTimeout": 10000, | |||
"UseExperimentalWatchdog": false | |||
}, | |||
"FileLogging": { | |||
"Directory": "/tgs_logs", | |||
"LogLevel": "Debug" | |||
}, | |||
"ControlPanel": { | |||
"Enable": true, | |||
"AllowAnyOrigin": false, | |||
"AllowedOrigins": null | |||
}, | |||
"Kestrel": { | |||
"EndPoints": { | |||
"Http": { | |||
"Url": "http://0.0.0.0:80" | |||
} | |||
} | |||
} | |||
} |
@ -0,0 +1,49 @@ | |||
version: '3.7' | |||
services: | |||
mariadb: | |||
image: mariadb | |||
restart: always | |||
ports: | |||
- "3306:3306" | |||
volumes: | |||
- "./Database:/var/lib/mysql" | |||
logging: | |||
driver: none | |||
environment: | |||
MYSQL_INITDB_SKIP_TZINFO: 1 | |||
MYSQL_ROOT_PASSWORD: ChangeThisInBothMariaDBAndTgsConnectionString | |||
tgs: | |||
environment: | |||
MYSQL_ROOT_PASSWORD: ChangeThisInBothMariaDBAndTgsConnectionString | |||
Database__ConnectionString: "Password=ChangeThisInBothMariaDBAndTgsConnectionString;Server=mariadb;User Id=root;Database=tgs4" | |||
TGS_ADMIN_CKEY: <YOUR BYOND USERNAME HERE> | |||
TGS_PREFIXED_SCHEMA_FILE: SQL/tgstation_schema_prefixed.sql | |||
TGS_SCHEMA_MAJOR_VERSION: 5 | |||
TGS_SCHEMA_MINOR_VERSION: 9 | |||
cap_add: | |||
- SYS_NICE | |||
image: "tgstation/server:latest" | |||
depends_on: | |||
- mariadb | |||
ports: | |||
- "1337:1337" | |||
- "5000:80" | |||
restart: always | |||
init: true | |||
volumes: | |||
- "./TGS_Logs:/tgs_logs" | |||
- "./TGS_Config:/config_data" | |||
- "./TGS_Instances:/tgs4_instances" | |||
logging: | |||
driver: none | |||
setup: | |||
environment: | |||
TGS_BYOND: 513.1514 | |||
TGS_REPO: https://github.com/tgstation/tgstation | |||
build: | |||
context: ./SetupProgram | |||
dockerfile: Dockerfile | |||
depends_on: | |||
- tgs | |||
- mariadb | |||
restart: "no" |
@ -1,100 +0,0 @@ | |||
#!/bin/bash | |||
set -e | |||
#load dep exports | |||
#need to switch to game dir for Dockerfile weirdness | |||
original_dir=$PWD | |||
cd $1 | |||
. dependencies.sh | |||
cd $original_dir | |||
#find out what we have (+e is important for this) | |||
set +e | |||
has_git="$(command -v git)" | |||
has_cargo="$(command -v ~/.cargo/bin/cargo)" | |||
has_sudo="$(command -v sudo)" | |||
has_cmake="$(command -v cmake)" | |||
has_gpp="$(command -v g++-6)" | |||
has_grep="$(command -v grep)" | |||
set -e | |||
#install cargo if needful | |||
if ! [ -x "$has_cargo" ]; then | |||
echo "Installing rust..." | |||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-host i686-unknown-linux-gnu | |||
. ~/.profile | |||
fi | |||
#apt packages | |||
if ! { [ -x "$has_git" ] && [ -x "$has_cmake" ] && [ -x "$has_gpp" ] && [ -f "/usr/lib/i386-linux-gnu/libmariadb.so.2" ] && [ -f "/usr/lib/i386-linux-gnu/libssl.so" ] && [ -d "/usr/share/doc/g++-6-multilib" ] && [ -d "/usr/include/mysql" ]; }; then | |||
echo "Installing apt dependencies..." | |||
if ! [ -x "$has_sudo" ]; then | |||
dpkg --add-architecture i386 | |||
apt-get update | |||
apt-get install -y git cmake libmariadb-dev:i386 libssl-dev:i386 grep g++-6 g++-6-multilib | |||
ln -s /usr/include/mariadb /usr/include/mysql | |||
rm -rf /var/lib/apt/lists/* | |||
else | |||
sudo dpkg --add-architecture i386 | |||
sudo apt-get update | |||
sudo apt-get install -y git cmake libmariadb-dev:i386 libssl-dev:i386 grep g++-6 g++-6-multilib | |||
sudo ln -s /usr/include/mariadb /usr/include/mysql | |||
sudo rm -rf /var/lib/apt/lists/* | |||
fi | |||
fi | |||
#update rust-g | |||
if [ ! -d "rust-g" ]; then | |||
echo "Cloning rust-g..." | |||
git clone https://github.com/tgstation/rust-g | |||
else | |||
echo "Fetching rust-g..." | |||
cd rust-g | |||
git fetch | |||
cd .. | |||
fi | |||
#update BSQL | |||
if [ ! -d "BSQL" ]; then | |||
echo "Cloning BSQL..." | |||
git clone https://github.com/tgstation/BSQL | |||
else | |||
echo "Fetching BSQL..." | |||
cd BSQL | |||
git fetch | |||
cd .. | |||
fi | |||
echo "Deploying rust-g..." | |||
cd rust-g | |||
git checkout $RUST_G_VERSION | |||
~/.cargo/bin/cargo build --release | |||
mv target/release/librust_g.so $1/rust_g | |||
cd .. | |||
echo "Deploying BSQL..." | |||
cd BSQL | |||
git checkout $BSQL_VERSION | |||
mkdir -p mysql | |||
mkdir -p artifacts | |||
cd artifacts | |||
cmake .. -DCMAKE_CXX_COMPILER=g++-6 -DMARIA_LIBRARY=/usr/lib/i386-linux-gnu/libmariadb.so.2 | |||
make | |||
mv src/BSQL/libBSQL.so $1/ | |||
#run deploy.sh | |||
echo 'Deploying tgstation compilation...' | |||
cd $1 | |||
mkdir build | |||
shopt -s extglob dotglob | |||
mv !(build) build | |||
shopt -u dotglob | |||
chmod +x build/tools/deploy.sh | |||
build/tools/deploy.sh $1 $1/build | |||
rm -rf build |