Downloading and Starting Necesarry Docker Containers
We will be using docker-compose to get the required contianers up and running on your pi.
At this point, we recommend creating a sub-directory for your demo files in the pi user’s home directory. Unless otherwise specified, this directory is a good location to create, or download files, for this tutorial. |
Please follow the steps below:
-
Login to the Pi (through the local console or through ssh -
ssh pi@[ip-address-of-pi]
)-
Default username is "pi" and the password is "raspberry"
-
-
Using the text editor of your choice, create a file named
docker-compose.yml
and add the following text (if you don’t have a favorite, trynano docker-compose.yml
to create and edit the file).version: '3' services: couch-db: image: treehouses/rpi-couchdb:2.1.1 ports: - "5984:5984" network_mode: "host" restart: always tty: true av-api: image: byuoitav/rpi-av-api:latest ports: - "8000:8000" environment: - BYPASS_AUTH=true - SYSTEM_ID=DEMO-123-CP1 - ROOM_SYSTEM=true - DB_ADDRESS=http://localhost:5984 - HUB_ADDRESS=localhost:7100 - STOP_REPLICATION=true - COUCHDB_USER=admin - COUCHDB_PASSWORD=AVAPIPASSWORD network_mode: "host" restart: always tty: true sony-control-microservice: image: byuoitav/rpi-sony-control-microservice:latest ports: - "8012:8012" environment: - SYSTEM_ID=BLDG-ROOM-CP1 - BYPASS_AUTH=true - ROOM_SYSTEM=true - SONY_TV_PSK=AVAPI network_mode: "host" restart: always tty: true demoUI: image: byuoitav/demoui-arm:latest ports: - "8081:8081" network_mode: "host" restart: always tty: true
-
After saving the file, run
docker-compose up -d
.-
This command downloads the docker containers specified in the compose file and starts them up.
-
The
-d
attribute will run the docker-compose command in the background (detached mode). -
Once this command runs succesfully, you can simply use
docker-compose start
when you need to start them up again (runs the already downloaded docker images).
-
-
The docker containers are now running. You can verify that the containers are up and running by using
docker ps
For those that may not be very familiar with docker-compose there are a few commands that you should be aware of:
-
docker-compose up
: Builds, (re)creates, starts, and attaches to containers for a service. Unless they are already running, this command also starts any linked services -
docker-compose start
: Starts existing containers for a service. -
docker-compose stop
: Stops running containers without removing them. -
docker-compose down
: Stops containers and removes containers, networks, volumes, and images created byup
Please be careful when you use docker-compose down . Any changes you’ve made to the database will be lost with this command.
|
Remember that the code is running inside the docker containers as a compiled binary. If you are interested in looking at the code found in each of these containers, the repositories are found below.:
Once you have the containers up and runnng, you should be able to access the Couch DB by going to http://[pi-ip-addr]:5984/_utils
in a web browser.
At this point your Pi should have all the code it needs in order to control your TV. The next step is to create the database entries that configure how the room works and what’s in it. These database entries are also used by the demo UI to build the interface for controlling the room.
You will need to create several databases and documents for a base configuration. These documents will be detailed in the next section: Complete Database Guide