...
1# Audio in containers on IEN
2
3## Requires:
4
5- Retail Device Manager
6- Audio
7
8## Usage Instructions:
9
10### Audio Client
11Create the following Dockerfile:
12
13```Dockerfile
14FROM alpine:latest
15
16RUN apk update && apk add --no-cache \
17 alsa-lib \
18 alsa-utils \
19 pulseaudio \
20 pulseaudio-alsa \
21 pulseaudio-utils
22
23COPY [AUDIO_FILE] /[AUDIO_FILE]
24```
25
26Build this image locally and upload the image to the IEN
27
28### IEN:
29
30Import client images into local container registry
31
32Label nodes you want Audio enabled on:
33
34- `kubectl label nodes <nodename> node.ncr.com/class=touchpoint`
35
36Apply the following manifest for an audio client pod.
37
38```yaml
39apiVersion: v1
40kind: Pod
41metadata:
42 name: audio-client
43spec:
44 containers:
45 -
46 command: ["paplay", "-p", "/[AUDIO_FILE]"] # This is a pulseaudio playback test
47 env:
48 - name: XDG_RUNTIME_DIR
49 value: /tmp/xdg_runtime
50 - name: PULSE_SERVER
51 value: /tmp/xdg_runtime/pa.socket
52 image: audio-client:latest
53 imagePullPolicy: IfNotPresent
54 name: audio-client
55 volumeMounts:
56 - mountPath: /tmp/xdg_runtime
57 name: xdg-runtime
58 readOnly: false
59 nodeSelector:
60 node.ncr.com/class: touchpoint
61 volumes:
62 - hostPath:
63 path: /tmp/xdg_runtime
64 type: Directory
65 name: xdg-runtime
66```
67
68# Environment Setup
69Create an `.env` file with the following variables:
70
71```dotenv
72# gke, sds, or generic. use "generic" for any K8s cluster that isn't GKE or
73# SDS.
74export CLUSTER_PROVIDER=generic
75# uuid is necessary for generating a cluster_hash, existing resources should
76# have this in their annotations already but one can be created by using
77# uuidgen
78export CLUSTER_UUID=
79# google cloud project id
80export GCP_PROJECT_ID=
81# defaults to us and east1-b, otherwise needs to be valid GCP value
82export GCP_REGION=
83export GCP_ZONE=
84# set to same value as gcp project ID when developing within a single
85# project.
86export FOREMAN_GCP_PROJECT_ID=
87# enables split scheduling
88export INFRA=true
89# name of the kubeconfig context to use to schedule infra objects;
90# default behavior is to apply all objects to the same K8s context
91# To deploy to local IEN clusters, set the INFRA_CONTEXT to the context name specified in local kubeconfig
92export INFRA_CONTEXT=
93# target namespace for all applied infrastructure resources, including
94# dependencies; the namespace is created if it does not already exist.
95export INFRA_NAMESPACE=
96```
97
98# Applying the Pallet
99
100The following is the example applying audio to an sds cluster
101
102```shell
103source ~/.env
104
105lift pack config/pallets/sds/audio
106lift apply config/pallets/sds/audio
107```
108
109NOTE: For pushing to local registry, add the flag -registry localhost:21700 to the pack and apply commands.
View as plain text