Skip to content

Instantly share code, notes, and snippets.

@smoogipoo
Created October 19, 2018 02:15
Show Gist options
  • Save smoogipoo/86978ba93e55e636bb0c325b283c25a0 to your computer and use it in GitHub Desktop.
Save smoogipoo/86978ba93e55e636bb0c325b283c25a0 to your computer and use it in GitHub Desktop.
osu-server + osu-performance on Ubuntu 16.04
#!/bin/bash
# Set these!
# Files
BEATMAPS_FILE='2018_05_28_all_ranked_osu_files'
PERFORMANCE_FILE='2018_09_19_performance_osu_top' # Important!
# Get the data
mkdir -p ~/data
cd ~/data
LOCAL_BEATMAPS_FILE=${BEATMAPS_FILE}.tar.bz2
LOCAL_PERFORMANCE_FILE=${PERFORMANCE_FILE}.tar.bz2
if [ ! -f ~/data/${LOCAL_BEATMAPS_FILE} ]; then
curl https://data.ppy.sh/${LOCAL_BEATMAPS_FILE} -o ${LOCAL_BEATMAPS_FILE}
tar -xf ${LOCAL_BEATMAPS_FILE}
fi
if [ ! -f ~/data/${LOCAL_PERFORMANCE_FILE} ]; then
curl https://data.ppy.sh/${LOCAL_PERFORMANCE_FILE} -o ${LOCAL_PERFORMANCE_FILE}
tar -xf ${LOCAL_PERFORMANCE_FILE}
fi
# Apply SQL files
cd ~/data/${PERFORMANCE_FILE}
mysql -uroot -proot --execute="DROP DATABASE IF EXISTS osu; CREATE DATABASE osu;"
cat *.sql | mysql -uroot -proot --database="osu"
# Build
cd ~/osu-server
dotnet build -c:Release
cd ~/osu-performance
mkdir -p Build
cd Build
cmake ..
make -j
# Run
cd ~/osu-server/osu.Server.DifficultyCalculator/bin/Release/netcoreapp2.1
echo "{
\"ConnectionStrings\": {
\"osu\": \"Server=localhost;Database=osu;Uid=root;Pwd=root;SslMode=None;\"
},
\"beatmaps_path\": \"/root/data/beatmaps\"
}" > appsettings.json
dotnet osu.Server.DifficultyCalculator.dll -c 8
cd ~/osu-performance/bin
echo "{
\"mysql.master.host\" : \"127.0.0.1\",
\"mysql.master.port\" : 3306,
\"mysql.master.username\" : \"root\",
\"mysql.master.password\" : \"root\",
\"mysql.master.database\" : \"osu\"
}" > config.json
./osu-performance all -t 8
#!/bin/bash
# Set these!
# Repos
SERVER_REPO='smoogipoo/osu-server'
PPCALC_REPO='ppy/osu-performance'
# Commits
SERVER_SHA='c02ab4205f81e525fcdeb3c92793c16246b1ac74'
PPCALC_SHA='ce6f9113394e621bb887ad578e44c2aec20df804'
function app_exists() {
if hash $1 2>/dev/null; then
return 0
else
return 1
fi
}
# Get the apps
cd ~/
git clone --recurse-submodules https://github.com/${SERVER_REPO} osu-server
git clone --recurse-submodules https://github.com/${PPCALC_REPO} osu-performance
# Checkout repos
cd ~/osu-server
git checkout ${SERVER_SHA}
cd ~/osu-performance
git checkout ${PPCALC_SHA}
# Install/setup MYSQL
if ! $(app_exists mysql); then
export DEBIAN_FRONTEND="noninteractive"
sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password root"
sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password root"
sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)"
wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
sudo dpkg -i mysql-apt-config*
sudo rm mysql-apt-config*
sudo apt-get update
apt install -y mysql-server
echo "!includedir /etc/mysql/conf.d/
[mysqld]
innodb_dedicated_server = 1
innodb_flush_log_at_trx_commit = 0
disable_log_bin" > /etc/mysql/my.cnf
service mysql restart
fi
# Install dotnet
if ! $(app_exists dotnet); then
wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-2.1
fi
# Install cmake
if ! $(app_exists cmake); then
apt install -y cmake
fi
# Install build tools
if ! $(app_exists clang); then
apt install -y build-essential
fi
# Extra build tools
apt install -y libcurl4-openssl-dev
apt install -y libmysqlclient-dev
# Build
cd ~/osu-server
dotnet build -c:Release
cd ~/osu-performance
mkdir -p Build
cd Build
cmake ..
make -j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment