Skip to content
Snippets Groups Projects
README.md 3.24 KiB
Newer Older
# FTS3-CNAF

Project to launch an FTS3 instance with Docker and K8S at CNAF

This module lanches 5 separated containers, FTS3 server, FTS3 Rest API, FTS3 Monitoring, MySQL database and a generic WLCG client container with WLCG client tools (voms, oidc-agent, davix, gfal, FTS3 rest client)

# First Actions

Before start, some actions need to be taken.

This package comes with some preset files and configurations that need to be replaced/changed accordingly followinf the steps:

1. Replace `hostcert.pem` and `hostkey.pem` found at `./assets/certs`

```
 $ cp <your_hostcert.pem> ./assets/certs/hostcert.pem && cp <your_hostkey.pem> ./assets/certs/hostkey.pem 
```

2. Change FTS3 configuration file found at `./assets/fts3/fts3config` with your server and database information:

```
  6 Alias=<Change_Me>
  7 SiteName=<Change_Me>
  8 
  9 MonitoringMessaging=true
 10 Profiling=0
 11 
 12 AuthorizedVO=*
 13 
 14 DbType=mysql
 15 DbUserName=<Change_Me>
 16 DbPassword=<Change_Me>
 17 
 18 DbConnectString=ftsdb/fts    <Change_Me>

```
3. Change FTS3 Rest API initialization file found at `./assets/fts3/fts3rest.ini` with your database information:

```
 37 sqlalchemy.url = mysql://fts:fts@ftsdb/fts     # change this with sqlalchemy sintax like mysql://user:passwd@host/db
```

4. Change environment file found at `./assets/.env` with the proper configurations for your docker compose launch.

```
  1 FTS_HOSTNAME=                 #change me 
  2 FTS_SITE_NAME=                #change me
  3 FTS_IP=                       #change me
  4 FTS_SERVER_VERSION=           #change me for stable production version (v3.10.0) or (latest) for test
  5 FTS_REST_VERSION=             #change me for stable production version (v3.10.1) or (latest) for test
  6 FTS_MONITORING_VERSION=       #change me for stable production version (v3.10.0) or (latest) for test
  7 FTS_MYSQL_IMAGE=mysql:5       #maybe don't change me unless reconmended by FTS documentation
  8 FTS_MYSQL_HOST=ftsdb          #change me if you have an external db or leave it to use contenerized db on package
  9 FTS_DATABASE=fts              #you can keep this as the database name or change it 
 10 FTS_DB_USER=                  #change me
 11 FTS_DB_PASSWD=                #change me
 12 FTS_DB_ROOT_PASSWD=           #change me

```

5. Observation on VOMS 

Notice that this package already delivery "most common" WLCG VO's configuration files, please check if your VO configuration files are present at `./assets/vomsdir` and `./assets/vomses`

# Initialize MySQL database

On first time launching, mysql image should be empty, hence needs to be initialized, so it is recomended to run `docker-compose` in detached mode and only `ftsdb` container

```
$ docker-compose up -d ftsdb
```

Than initializing the database by running the script:

```
$ ./initialize_mysql.sh
```

This script will create the database and grant privileges for FTS3 user as defined in `./assets/.env`.

This script can also be used to clean the database if necessary.


# Launching FTS3 containers

Once MySQL database is initialized, to start up FTS containers simply run the command:

```
$ docker-compose up -d
```

After first time, even if mysql is killed or exit for some reason, it is not needed to re-initialize nor start it detached from the rest of the container.