improved deployment w liveness + readiness probes

This commit is contained in:
Brandon Thomas committed 2020-01-06 19:33:12 -05:00
1 parent 374e1a477d
commit ea761a76b9
2 files changed
+29 -3

No files matched your search

+25 -3
View File
@@ -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
+4
View File
@@ -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));