Create a folder, for example, AuCoreRepoAgent in any valid directory:
mkdir AuCoreRepoAgent
After you create the AuCoreRepoAgent, you must create the following script files to run the Repo Agent:
Create a file dockompose with the following content:
#!/bin/bash pushd config >/dev/null docker-compose $* popd >/dev/null
NOTE:If you create the files on Windows, ensure that you remove the Windows line ending symbol (^M) in the end of each line.
Create a file, for example, aurepa_docker_stats.sh with the following content:
#!/bin/bash TMP=/tmp/docker-stats docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" | grep aurepa | tail -n +2 >$TMP echo " SORT BY NAME" cat $TMP | sort -k 1 echo " SORT BY CPU" cat $TMP | sort -k 2 echo " SORT BY MEM" cat $TMP | sort -k 3 -h echo " if you want interactive montor, run 'docker stats'"
Create a file repo.sh with the following content:
This file helps to start, stop, or restart the services (db, sync, and http) of the Repo Agent.
#!/bin/bash CMD=$1 shift REPO_NAME=$1 shift [ -z $REPO_NAME ] && echo "Usage: repo.sh <start|stop|restart> REPO_NAME" && exit 2 ./dockompose $CMD $REPO_NAME-aurepa-sync ./dockompose $CMD $REPO_NAME-aurepa-http ./dockompose $CMD $REPO_NAME-aurepa-db
Create a file run_sync.sh with the following content:
This file helps to manually sync the data of the LDAP repositories. It can be a full sync or a fast sync.
#!/bin/bash # stop parallel sync, if any. run manual sync and start scheduler again cat <<EOT >/tmp/run_sync_usage Usage: run_sync.sh REPO_NANE [command] (command is aurepa.full sync by default) Examples: run_sync.sh MOON run_sync.sh MOON aurepa.fast_sync run_sync.sh EARTH aurepa.recreate_db (wipe all data) run_sync.sh EARTH aurepa.print_ldap_users (check LDAP connectivity) EOT REPO_NAME=$1 [ -z $REPO_NAME ] && cat /tmp/run_sync_usage && exit 2 COMMAND=$2 [ -z $COMMAND ] && COMMAND=aurepa.full_sync ./dockompose stop $REPO_NAME-aurepa-sync ./dockompose run --rm $REPO_NAME-aurepa-sync $COMMAND ./dockompose start $REPO_NAME-aurepa-sync
Create a file setup_config_production.sh with the following content:
This file generates the self-signed certificates, nginx.conf, and the docker-compose files.
#!/bin/bash export AUREPA_IMG="mfsecurity/aaf-aurepa:6.2.0.0" export DOCKER_CONTENT_TRUST=1 export SSL_HOSTNAME=$SSL_HOSTNAME # Generate docker-compose.yml, nginx and ini file. Generate SSL certificate, if not provided [ -z $SSL_HOSTNAME ] && [ ! -f config/etc.nginx/cert.pem ] && \ echo "Usage: SSL_HOSTNAME=your-server.com ./$(basename ${BASH_SOURCE[0]})" && \ exit 2 MYDIR=`cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd` CONF_DIR=$MYDIR/config docker run --rm \ -e PYTHONUNBUFFERED=1 \ -e SSL_HOSTNAME=$SSL_HOSTNAME \ -e AUREPA_IMG=$AUREPA_IMG \ -v $CONF_DIR:/mnt/config/ $AUREPA_IMG \ python /opt/AuRepa/auconfig/setup_config.pyc $CONF_DIR
NOTE:Run the command sudo chmod 755 to set permissions for the above files.
Create the following folders in the AuCoreRepoAgent folder:
mkdir -p config/etc.nginx
mkdir -p config/EXAMPLE1.repo