Newer
Older
[](https://git-r3lab.uni.lu/NCER-PD/scheduling-system/commits/master)
[](https://www.gnu.org/licenses/agpl-3.0)
## Docker version
If you'd like to try out the application without preparing the environment, you can use Docker (you must have _Docker_ and _docker-compose_ installed):
```
# Navigate to the project's directory
docker-compose build && docker-compose up
# To add a new user, type in the new terminal:
docker-compose exec web sh
- install required dependencies on ubuntu
```bash
sudo apt-get install python3, virtualenv, libcurl4-gnutls-dev, libpng-dev, libfreetype6-dev, libpq-dev, gcc, g++, python3-dev, libgnutls28-dev, libjpeg-dev, libfreetype6-dev, git
curl -sL https://deb.nodesource.com/setup_14.x | bash -
apt-get install nodejs
git clone ssh://git@git-r3lab-server.uni.lu:8022/NCER-PD/scheduling-system.git
- setup virtualenv with clean python3 working environment and start using it. Important python3.6 or higher is required
cd scheduling-system
virtualenv env -p python3
. env/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
npm install
- Create `local_settings.py` file in `smash/smash` directory by copying the template in `smash/smash/local_settings.template` and edit your local_setttings.py file to change your database connection data.
### Database configuration
There are two databases supported: `sqlite3` or `postgresql`. You can configure database connection in `smash/smash/local_settings.py`.
```python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
}
- postgresql database configuration looks like:
```python3
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'smaschdb',
'USER': 'smaschuser',
'PASSWORD': 'smaschpassword',
'HOST': 'localhost',
'PORT': '',
'TEST': {
'NAME': 'dbtest',
},
}
After database connection is configured setup a database by applying migration scripts and create admin user
```bash
./manage.py migrate
./manage.py superworker -u admin -e test@test.lu -f John -l Doe
```
## Development
Remember, that before working you have to activate _virtualenv_, by:
```
devel@host ~/home/smash/scheduling-system $ . env/bin/activate
```
In order to run development server, run:
```
devel@host ~/home/smash/scheduling-system/smash $ ./manage.py runserver
```
and go to `127.0.0.1:8000` in browser
In case of problems with the openssl version installed on the system:
export PYCURL_SSL_LIBRARY=openssl
pip install pycurl --global-option=build_ext --global-option="-I/usr/local/Cellar/openssl/1.0.2k/include" --global-option="-L/usr/local/Cellar/openssl/1.0.2k/lib" --upgrade
pip install psycopg2 --global-option=build_ext --global-option="-I/usr/local/Cellar/openssl/1.0.2k/include" --global-option="-L/usr/local/Cellar/openssl/1.0.2k/lib" --upgrade
```
## Production deployment
Smasch can be deployed using debian package provided in lcsb repository:
```
echo "deb http://repo-r3lab.uni.lu/debian/ stable main" | tee /etc/apt/sources.list.d/repo-r3lab.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xcb185f4e31872412
apt-get update
apt-get install -y smasch
```
After smasch is installed you can start/stop it using systemd:
Configuration of smasch (`local_settings.py`) is in `/etc/smasch/smasch.py`.
### Disable two steps authentication for a specific user
```
./manage.py two_factor_disable ${USERNAME}
```
### Public holidays
to import public holidays run:
```
./manage.py holidays ${YEARS}
```
where ${YEARS} should be a space separated list of years for which the holidays will be imported.
example:
```
./manage.py holidays 2017 2018 2019