Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tine devops variables #16

Open
wants to merge 2 commits into
base: feature/tine-devops
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions get_secrets.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
#!/bin/bash
# we are using parameters prefixed by tine_ for multiple
## TURN OFF LOGGING
echo using "${AGENT_NAME}" as agent name base for keys
set +x

#fixme move to environment
export AGENT_NAME="tine_agent"
#this script expects AGENT_NAME to be set to something like "tine_agent"

echo "" > "/var/run/agent/secrets/env" # blank the file

declare -A params=(
# b ["OPENAI_KEY"]="${AGENT_NAME}_openai_key"
# ["XAI_MODEL"]="${AGENT_NAME}_openai_model"
# ["XAI_L_MODEL"]="${AGENT_NAME}_large_openai_model"
# ["XAI_M_MODEL"]="${AGENT_NAME}_medium_openai_model"
# ["OPENAI_API_URL"]="${AGENT_NAME}_openai_endpoint"
["GROQ_API_KEY"]="${AGENT_NAME}_groq_key"
["TWITTER_PASSWORD"]="${AGENT_NAME}_twitter_password"
["TWITTER_EMAIL"]="${AGENT_NAME}_twitter_email"
["TWITTER_USERNAME"]="${AGENT_NAME}_twitter_username"
["AGENT_IMAGE"]="${AGENT_NAME}_agent_image"
["TOKENIZER_IMAGE"]="${AGENT_NAME}_tokenizer_image"
)

declare -A params=(["GROQ_API_KEY"]="${AGENT_NAME}_groq_key"
["TWITTER_PASSWORD"]="${AGENT_NAME}_twitter_password"
["TWITTER_EMAIL"]="${AGENT_NAME}_twitter_email"
["TWITTER_USERNAME"]="${AGENT_NAME}_twitter_username"
["AGENT_IMAGE"]="${AGENT_NAME}_agent_image"
["TOKENIZER_IMAGE"]="${AGENT_NAME}_tokenizer_image"
)

#systemctl set-environment enterUser=my-username
for key in "${!params[@]}"; do
Expand Down
20 changes: 13 additions & 7 deletions rundocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@
# this is the install script
# install_script = "/opt/agent/rundocker.sh"
# called on boot.
pwd
ls -latr
. ./.env # for secrets
echo using "${AGENT_NAME}" as agent name base for keys
export AGENT_NAME
#pwd
#ls -latr
#. ./.env # for secrets
set -e # stop on any error
export WORKSOURCE="/opt/agent"

echo for now install helper tools
snap install aws-cli --classic
apt install -y jq
echo for now install helper tools
apt install -y lsof strace nmap
#apt install -y emacs-nox
# FIXME another account hardcoded
#aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 767503528736.dkr.ecr.us-east-2.amazonaws.com

adduser --disabled-password --gecos "" agent --home "/home/agent" || echo ignore
if ! id -u agent > /dev/null 2>&1; then
adduser --disabled-password --gecos "" agent --home "/home/agent" || echo ignore
else
echo "User agent already exists, ignoring..."
fi

git config --global --add safe.directory "/opt/agent"
cd "/opt/agent/" || exit 1 # "we need agent"
#git log -1
Expand Down
Loading