<commit_before>This is a docker image for the Zanata server. This image runs a wildfly server with Zanata running on top of it. It does not run a database server for the Zanata application

```
This image has been tested with Docker 1.9
```

## Building

To build this docker image as "latest", simply type the following command:

```sh
$ docker build -t zanata/server .
```

If you want to build with a different tag, eg 3.8.4, use a command like this:

```sh
$ docker build -t zanata/server:3.8.4 .
```

Be careful about overwriting existing versions.

The `-t` parameter indicates the name and/or tag for the image.

## Running a Zanata server with Docker

### Run a database server container

Simply run

```sh
$ ./rundb.sh
```

This script will start a docker container with the database. You can inspect the script file to learn the exact docker command it's running.

The container will map the mysql data directory to `$HOME/docker-volumes/zanata-mariadb`. This can be changed from the script file.

The database can be accessed via tcp via the `mysql` command or by using any database administration tool. You need to get the actual mapped port on the host by typing `docker ps`. After you have the port, you can connect locally to the database. The following is an example to accomplish this using a locally installed mysql client:

```sh<commit_msg>docs(docker): add docker setup instructions ZNTA-1462 (#50)<commit_after>This is a docker image for the Zanata server. This image runs a wildfly server with Zanata running on top of it. It does not run a database server for the Zanata application

```
This image has been tested with Docker 1.9
```

## Building

To build this docker image as "latest", simply type the following command:

```sh
$ docker build -t zanata/server .
```

If you want to build with a different tag, eg 3.8.4, use a command like this:

```sh
$ docker build -t zanata/server:3.8.4 .
```

Be careful about overwriting existing versions.

The `-t` parameter indicates the name and/or tag for the image.

## Running a Zanata server with Docker

The steps to get a Zanata development server running are:

 1. Ensure that docker is properly set up.
 2. Run a database server container.
 3. Run the Zanata development server container.
 4. Create an admin user.

When you have performed all these steps, you can sign in with the admin account
to configure the server and set up any other users and data you need.

If you build a new zanata war, kill the docker server (Ctrl+C) then re-run it
in the same way you first started it.


### Docker setup

The following instructions are to set up docker on a Fedora system after it has
been installed with `dnf install docker`. For docker setup on other operating
systems, see [Install Docker Engine - Docker](https://docs.docker.com/engine/installation/)

To set up docker you need to:

 - ensure docker service is running
 - create a docker group and add yourself to it (otherwise you will have to
   use `sudo` for all your docker commands)

To check if the docker service is running, run the following command and look
for `Active: active`:

```
systemctl status docker
```

If it is not active, start it with:

```
systemctl start docker
```


Once the service is active, it may still be disabled. You can enable it with:

```
systemctl enable docker.service
```


To create a docker group, follow these
[instructions to create a docker group on Fedora](https://docs.docker.com/engine/installation/linux/fedora/#/create-a-docker-group)


### Run a database server container

Simply run

```sh
$ ./rundb.sh
```

This script will start a docker container with the database. You can inspect the script file to learn the exact docker command it's running.

The container will map the mysql data directory to `$HOME/docker-volumes/zanata-mariadb`. This can be changed from the script file.

The database can be accessed via tcp via the `mysql` command or by using any database administration tool. You need to get the actual mapped port on the host by typing `docker ps`. After you have the port, you can connect locally to the database. The following is an example to accomplish this using a locally installed mysql client:

```sh
{'fraction_non_alphanumeric': 0.06706302021403092, 'fraction_numerical': 0.006183115338882283, 'mean_word_length': 3.954063604240283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4857414', 'n_tokens_mistral': 1201, 'n_tokens_neox': 1108, 'n_words': 653}