#!/bin/bash

if [ "$#" -eq 1 ]; 
   then
    export HOST_ADDR=$1
    export PROTOCOL="http"
    cd chrome-extension/ 
    npm run production 
    zip -r dist.zip ./dist
    mv dist.zip ../dashboard/public
    cd ..

    docker-compose -f docker-compose.production-ovh.yml down -v
    docker-compose -f docker-compose.production-ovh.yml up --build --no-start
    docker-compose -f docker-compose.production-ovh.yml start mongo zookeeper kafka website session model dashboard account reverseproxy

   else
    export HOST_ADDR="www.researchexperimentation.fr"
    export PROTOCOL="https"

    cd chrome-extension/ 
    npm run production 
    zip -r dist.zip ./dist
    mv dist.zip ../dashboard/public
    cd ..
    docker-compose -f docker-compose.production-ovh.yml down -v
    docker-compose -f docker-compose.production-ovh.yml up --build --no-start
    docker-compose -f docker-compose.production-ovh.yml start mongo zookeeper kafka website session model dashboard account reverseproxy
    docker-compose -f docker-compose.production-ovh.yml start initialization
fi





docker-compose -f docker-compose.development.yml start initialization