<commit_before># 4Minitz Admin Guide

# Installation

## Whats wrong with the 'Quick Installation' (Option 2)?    

The [quick installation](../../README.md#quick-installation-of-4minitz) (Option 2)
has the advantage that you don't have to
install node and you don't have to mess with a MongoDB database, as 
both tools come with the meteor development tool as sub packages.

But while the quick installation mode is - well... - quick, it has some
drawbacks:

 1. It uses meteor's own MongoDB where it sets up collections that
   are accesible to everyone who has shell access to the PC the database is
   running on. So, no login is needed to access the DB.
   Nevertheless as of this writing the DB port is not opened to
   the outside world. So, if you are the only person that can login 
   to the machine - may be you are fine with this.
 1. The meteor tool is a development tool. Among many other things meteor
   watches the source files of 4Minitz and rebuilds on changes. This
   is great for developers. But it comes to the price of some extra need
   from RAM. Recent measurements showed, 4Minitz needs about 700 MB of RAM
   when launched via meteor vs. 90 MB of RAM when directly launched via node
   without meteor build support. So, if your (virtual?) machine has enough
   RAM - may be you are fine with this, too.

In all other cases - read on and chose the "Production Installation" way.

## Production Running - with Docker
The 4Minitz docker image includes the compiled 4Minitz app, a fitting 
node.js version and MongoDB and thus has no external dependencies.

### Setup on Linux and Mac

1. Install [docker](https://docs.docker.com/engine/installation/)
2. In a directory where you have write access run:
```
docker run -it --rm -v $(pwd)/4minitz_storage:/4minitz_storage -p 3100:3333 4minitz/4minitz
```

Omit the next section and continue with the section [Use your 4minitz container](#use-your-4minitz-container).

### Setup on Windows

The following snippets should be run inside a PowerShell (indicated by a `PS>` prompt)
or a bash shell inside a Docker container (indicated by a `root#` prompt).

1. Install [docker](https://docs.docker.com/engine/installation/)
2. Open up a powershell and pull the 4minitz image from the Docker hub
```
PS> docker pull 4minitz/4minitz
```
3. Create a container instance called `4minitz-storage`
```
PS> docker create -v /4minitz_storage --name 4minitz-storage 4minitz/4minitz
```
4. If you want to edit the configuration, especially after updating your 4minitz images, you should do so in an up-to-date 4minitz container by spawning a bash shell into it. For now it suffices to simply start the volume container and edit the config file `4minitz_settings.json`:
```
PS> $docker = docker ps -q -l
PS> docker start $docker
PS> docker exec -ti $docker /bin/bash
root# nano /4minitz_storage/4minitz_settings.json
root# exit
PS> docker stop $docker<commit_msg>Update adminguide.md<commit_after># 4Minitz Admin Guide

# Installation

## Whats wrong with the 'Quick Installation' (Option 2)?    

The [quick installation](../../README.md#quick-installation-of-4minitz) (Option 2)
has the advantage that you don't have to
install node and you don't have to mess with a MongoDB database, as 
both tools come with the meteor development tool as sub packages.

But while the quick installation mode is - well... - quick, it has some
drawbacks:

 1. It uses meteor's own MongoDB where it sets up collections that
   are accesible to everyone who has shell access to the PC the database is
   running on. So, no login is needed to access the DB.
   Nevertheless as of this writing the DB port is not opened to
   the outside world. So, if you are the only person that can login 
   to the machine - may be you are fine with this.
 1. The meteor tool is a development tool. Among many other things meteor
   watches the source files of 4Minitz and rebuilds on changes. This
   is great for developers. But it comes to the price of some extra need
   from RAM. Recent measurements showed, 4Minitz needs about 700 MB of RAM
   when launched via meteor vs. 90 MB of RAM when directly launched via node
   without meteor build support. So, if your (virtual?) machine has enough
   RAM - may be you are fine with this, too.

In all other cases - read on and chose the "Production Installation" way.

## Production Running - with Docker
The 4Minitz docker image includes the compiled 4Minitz app, a fitting 
node.js version and MongoDB and thus has no external dependencies.

### Setup on Linux and Mac

1. Install [docker](https://docs.docker.com/engine/installation/)
2. In a directory where you have write access run:
```
docker run -it --rm -v $(pwd)/4minitz_storage:/4minitz_storage -p 3100:3333 4minitz/4minitz
```

Omit the next section and continue with the section [Use your 4minitz container](#use-your-4minitz-container).

### Setup on Windows

On Microsoft Windows 10 Professional or Enterprise 64-bit you can run 4minitz inside a docker container. The following snippets should be run inside a PowerShell (indicated by a `PS>` prompt) or a bash shell inside a Docker container (indicated by a `root#` prompt).

1. Install [docker](https://docs.docker.com/engine/installation/)
2. Open up a powershell and pull the 4minitz image from the Docker hub
```
PS> docker pull 4minitz/4minitz
```
3. Create a container instance called `4minitz-storage`
```
PS> docker create -v /4minitz_storage --name 4minitz-storage 4minitz/4minitz
```
4. If you want to edit the configuration, especially after updating your 4minitz images, you should do so in an up-to-date 4minitz container by spawning a bash shell into it. For now it suffices to simply start the volume container and edit the config file `4minitz_settings.json`:
```
PS> $docker = docker ps -q -l
PS> docker start $docker
PS> docker exec -ti $docker /bin/bash
root# nano /4minitz_storage/4minitz_settings.json
root# exit
PS> docker stop $docker
{'fraction_non_alphanumeric': 0.06943510423671823, 'fraction_numerical': 0.016980497646267655, 'mean_word_length': 3.912469033856317, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7212714', 'n_tokens_mistral': 1803, 'n_tokens_neox': 1620, 'n_words': 882}