diff --git a/deployment.yaml b/deployment.yaml index b2855883af..62575309d2 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -22,7 +22,8 @@ metadata: labels: app: tts spec: - replicas: 2 + # NB: DigitalOcean PersistentVolumes can only be attached to one droplet at a time!? WTF! + replicas: 1 selector: matchLabels: app: tts @@ -39,12 +40,33 @@ spec: claimName: model-pvc containers: - name: tts - image: docker.pkg.github.com/echelon/voder/tts-service:a8858f2375a4 + # NB: Container builds are triggered by Github Actions + image: docker.pkg.github.com/echelon/voder/tts-service:374e1a477d90 + env: + - name: BIND_ADDRESS + value: "0.0.0.0:12345" + - name: TACOTRON_MODEL + value: "/store/models/tacotron2-nvidia/tacotron_container.pt" + - name: MELGAN_MODEL + value: "/store/models/melgan-swpark/shared_melgan_container.pt" command: ["/tts_service"] - args: ["0.0.0.0:12345"] ports: - containerPort: 12345 protocol: TCP volumeMounts: - mountPath: "/store" name: model-pv + readinessProbe: + httpGet: + path: /readiness + port: 12345 + initialDelaySeconds: 5 + periodSeconds: 5 + livenessProbe: + httpGet: + path: /liveness + port: 12345 + initialDelaySeconds: 20 + periodSeconds: 3 + timeoutSeconds: 3 + failureThreshold: 3 diff --git a/tts_service/src/main.rs b/tts_service/src/main.rs index 79804c26cc..4e9dd9cd23 100644 --- a/tts_service/src/main.rs +++ b/tts_service/src/main.rs @@ -76,6 +76,8 @@ const BIND_ADDRESS : &'static str = "BIND_ADDRESS"; #[actix_rt::main] async fn main() -> std::io::Result<()> { + println!("Starting service."); + let bind_address = env::var(BIND_ADDRESS) .expect(&format!("Must include {} env var, eg `0.0.0.0:8000`", BIND_ADDRESS)); @@ -85,6 +87,8 @@ async fn main() -> std::io::Result<()> { let melgan_filename = env::var(MELGAN_MODEL) .expect(&format!("Must include {} env var", MELGAN_MODEL)); + println!("Loading models..."); + let ttsEngine = TacoMelModel::create(&tacotron_filename, &melgan_filename); let arc = web::Data::new(Arc::new(ttsEngine));