#!/usr/bin/env bash set -e # Changing user sudo -S su user # Create elasticsearch directory and change ownerships sudo mkdir -p /var/run/elasticsearch sudo chown -R elasticsearch:elasticsearch /var/run/elasticsearch sudo chown -R user:user /load_data.py # Start elasticsearch sudo systemctl daemon-reload sudo systemctl enable elasticsearch.service sudo systemctl start elasticsearch.service # Generate hashed passwords team_password=$(htpasswd -nbB "" "$TEAM_PASSWORD" | cut -d ":" -f 2 | tr -d "\n") argilla_password=$(htpasswd -nbB "" "$ARGILLA_PASSWORD" | cut -d ":" -f 2 | tr -d "\n") # Update API_KEY and PASSWORD from users.yml sudo sed -i 's,TEAM_API_KEY,'"$TEAM_API_KEY"',g' /packages/users.yml sudo sed -i 's,ARGILLA_API_KEY,'"$ARGILLA_API_KEY"',g' /packages/users.yml sudo sed -i 's,TEAM_PASSWORD,'"$team_password"',g' /packages/users.yml sudo sed -i 's,ARGILLA_PASSWORD,'"$argilla_password"',g' /packages/users.yml # Load data pip3 install datasets python3.9 /load_data.py "$API_KEY" & # Start argilla uvicorn argilla:app --host "0.0.0.0"