You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recodex-wiki/System-configuration.md

112 lines
6.0 KiB
Markdown

# System configuration
This page contains steps to set up a server to successfully run **ReCodEx**. Before final release most of them will be included in instalation script or listed as dependecies to binary package (`rpm` or `deb`). This page is mostly oriented to Red Hat based Linux distros (like RHEL, Centos or Fedora), but I'll try to keep updated information about Debian too. Before starting, make sure you have completed basic OS installation and set up, including users and logins, SSH, Git, firewall, etc.
## Menu
* [Common](#common)
* [Worker](#worker)
* [Windows Worker](#windows-worker)
* [WebApp](#webapp)
## Common
**Add _testing_ repositories to Debian OS**
- Create file `/etc/apt/apt.conf` with content
```
APT::Default-Release "stable";
```
- Add testing repos to `/etc/apt/sources.list`
```
deb http://ftp.cz.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.cz.debian.org/debian/ testing contrib non-free
```
- Install packages with `-t testing` option. For example
```
$ sudo apt-get -t testing install gcc
```
**Add EPEL repository to RHEL**
- See [this](https://fedoraproject.org/wiki/EPEL) for instructions.
**Install ZeroMQ** in version at least 4.0
- For Debian, run
```
$ sudo apt-get install libzmq3-dev
```
- For Fedora (Red Hat), install `zeromq` and `zeromq-devel` (on RHEL from EPEL repository).
**Install YAML-CPP library**
- For Debian:
```
$ sudo apt-get install libyaml-cpp0.5v5 libyaml-cpp-dev
```
- For Fedora (Red Hat), install `yaml-cpp` and `yaml-cpp-devel` packages (on RHEL from EPEL repository).
**Install libcurl library**
- For Debian:
```
$ sudo apt-get install libcurl4-gnutls-dev
```
- For Fedora (Red Hat), install `libcurl-devel` package.
## Worker
Worker requirements are written in this section. Some parts of this guide may be different for each type of worker, for example Compiler principles worker is not fully covered here.
### Isolate
First, we need to compile sandbox Isolate from source and install. Assume that we keep source code in `/opt/src` dir. For building man page you need to have package `asciidoc` installed (`yum install asciidoc`).
```
# cd /opt/src
# git clone https://github.com/ioi/isolate.git
# cd isolate
# make
# make install && make install-doc
```
For proper work Isolate depends on several advanced features of the Linux kernel. Make sure that your kernel is compiled with `CONFIG_PID_NS`, `CONFIG_IPC_NS`, `CONFIG_NET_NS`, `CONFIG_CPUSETS`, `CONFIG_CGROUP_CPUACCT`, `CONFIG_MEMCG`. If your machine has swap enabled, also check `CONFIG_MEMCG_SWAP`. Which flags was your kernel compiled with can be found in `/boot` directory, for example in `/boot/config-4.2.6-301.fc23.x86_64` file for kernel version 4.2.6-301. Red Hat distros should have these enabled by default, for Debian you you may want to add the parameters `cgroup_enable=memory swapaccount=1` to the kernel command-line, which can be set using `GRUB_CMDLINE_LINUX_DEFAULT` in `/etc/default/grub`.
For better reproducibility of results, some kernel parameters can be tweaked:
- Disable address space randomization. Create file `/etc/sysctl.d/10-recodex.conf` with content `kernel.randomize_va_space=0`. Changes will take effect after restart or run `sysctl kernel.randomize_va_space=0` command.
- Disable dynamic CPU frequency scaling. This requires setting the cpufreq scaling governor to _performance_.
_**TODO** - do we really need it and is it worth higher power consumption? [Red Hat setup](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Power_Management_Guide/cpufreq_governors.html), [Debian setup](https://wiki.debian.org/HowTo/CpuFrequencyScaling)_
### Compilers
**C/C++**
For compiling C and C++ programs is used `GCC` compiler. Maybe you could install install most of the staff by executing following command, but it's not needed.
```
# yum group install "Development Tools"
```
To install the compiler separately, you could install it from the distribution's repositories.
```
# yum install gcc gcc-c++ make
```
To get reasonably new version, you may consider installing [Red Hat Developer Toolset 4](https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/4/html-single/4.0_Release_Notes/index.html), or install these from Fedora repo. In Debian, _testing_ repo can be used.
**C\#**
For new versions of **Mono**, we'll use [Xamarin repositories](http://www.mono-project.com/download/#download-lin). For Red Hat based OS:
```
# rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
# yum-config-manager --add-repo http://download.mono-project.com/repo/centos/
# yum upgrade
# yum install mono-complete
```
For Debian based OS:
```
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
$ echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
$ sudo apt-get update
$ sudo apt-get install mono-complete
```
**Free Pascal**
Free Pascal compiler 3.0.0 can be downloaded as `rpm` packages from [official website](http://www.freepascal.org/down/x86_64/linux-austria.var). In Debian, this version is [expetimental](https://packages.debian.org/experimental/fpc-3.0.0), but seems to be stable enough.
**Java**
_**TODO**_
## Windows Worker
From beginning we are determined to support Windows operating system on which some of the workers may run (especially for projects in C# programming language). Support for Windows is quite hard and time consuming and there were several problems during this. To ensure capability of compilation on Windows we set up CI for Windows named [Appveyor](http://www.appveyor.com/). However installation should be easy due to Visual Studio NuGet package manager.
There are only two dependencies needed. **Windows 7 and higher** and **Visual Studio 2014**. Visual Studio itself contains all features needed for compilation. All dependencies as libraries and such are either installed through NuGet package manager or are managed as submodules in git repository.
## WebApp