Configure Docbox
Environment variables
You will need to create a .env.docbox file it should contain the following:
# Logging configuration
RUST_LOG=debug,docbox_core::notifications::sqs=info
# URL for the office converter server (This should be running on the same server)
CONVERT_SERVER_ADDRESS=http://127.0.0.1:8081
# URL for the SQS queue for notifications of when a new file is created
DOCBOX_SQS_URL={SQS QUEUE ARN}
# Database host and port
POSTGRES_HOST={DATABASE HOST}
POSTGRES_PORT={DATABASE PORT}
# AWS secrets manager key for the root database username and password
DOCBOX_DB_CREDENTIAL_NAME=postgres/docbox/config
# Use the typesense search index
DOCBOX_SEARCH_INDEX_FACTORY=typesense
TYPESENSE_URL={TYPESENSE URL}
TYPESENSE_API_KEY={TYPESENSE API KEY}
# URL for the HTTP proxy server to use for scraping
HTTP_PROXY=http://{PROXY SERVER IP}:3128/
HTTPS_PROXY=http://{PROXY SERVER IP}:3128/
# AWS region for AWS services to use
AWS_REGION=ap-southeast-2
Deploy environment variables
Store this .env.docbox file in AWS secrets manager so that docbox can retrieve it ensure the secret name is docbox-env-file
The following command will upload the .env file to the secret automatically:
aws secretsmanager put-secret-value --secret-id docbox-env-file --secret-string file://.env.docbox
First obtain the instance ID of the docbox server using the following command:
terraform output api_instance_id
Use SSM to send the sudo sh /docbox/update_env.sh and sudo systemctl restart docbox.service commands to the
docbox API server, replace <YOUR INSTANCE ID> with the ID from the above command:
aws ssm send-command --targets "Key=instanceIds,Values=<YOUR INSTANCE ID>" --document-name "AWS-RunShellScript" --comment "Pull the latest docbox .env file" --parameters 'commands=["sudo sh /docbox/update_env.sh", "sudo systemctl restart docbox.service"]'
info
Alternatively you can manually run the following command on the server after connecting to it using AWS SSM.
sudo sh /docbox/update_env.sh
sudo systemctl restart docbox.service