Prerequisites
Before starting the deployment process, ensure that you have the following set up:
- The Balena CLI installed.
- Logged into your Balena account using
balena login
. - Cloned the Anthias repository from GitHub.
Step 1: Clone the Repository
Open your terminal and run:
cd $WORKSPACE_DIRECTORY
git clone https://github.com/screenly/anthias.git
cd anthias/
Step 2: Modify Environment Settings
Edit the anthias_django/settings.py
file to ensure that DEBUG
is appropriately set for production:
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = getenv('ENVIRONMENT', 'production') in ['development', 'test']
Step 3: Prepare Deployment Configuration
Execute the following commands to prepare your Balena configuration. This involves creating a deployment directory and generating a Docker Compose file.
mkdir -p balena-deploy
cp balena.yml balena-deploy/
cat docker-compose.balena.yml.tmpl | envsubst > balena-deploy/docker-compose.yml
Step 4: Deploy to Balena Fleet
Run the deployment script with the appropriate parameters for your board and fleet. Replace $BOARD_TYPE
and $FLEET_NAME
with your actual board type (e.g., pi3
, pi4
) and fleet name:
./bin/deploy_to_balena.sh \
--board $BOARD_TYPE \
--fleet $FLEET_NAME
If you wish to deploy local changes, add the --dev
flag:
./bin/deploy_to_balena.sh \
--board $BOARD_TYPE \
--fleet $FLEET_NAME \
--dev
You can specify the shared memory size with the --shm-size
option:
./bin/deploy_to_balena.sh \
--board $BOARD_TYPE \
--fleet $FLEET_NAME \
--shm-size 512mb
Step 5: Monitor the Deployment
After running the deployment command, monitor the output for progress. Once the deployment is complete, verify your fleet’s summary page on the Balena dashboard. New devices added to the fleet should be able to download the most recent release.
Step 6: Clean Up (If Necessary)
If you wish to clean up or reset your environment, you can remove the generated balena-deploy
directory:
rm -rf balena-deploy
Final Note
For additional options, you can check the help command integrated into the deployment script:
./bin/deploy_to_balena.sh --help
These steps outline how to deploy Screenly/Anthias in a production environment using Balena. Reference the original source for further details and context.
Sources: docker-compose.yml, Dockerfile, docs/balena-fleet-deployment.md, README.md, bin/deploy_to_balena.sh