Skip to content

Commit 99f2009

Browse files
committed
cleaned signal > tsignal, refactor docker file to binary only
1 parent fb6f861 commit 99f2009

File tree

6 files changed

+40
-32
lines changed

6 files changed

+40
-32
lines changed

Dockerfile

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
FROM golang
2-
COPY ./ /go/src/github.com/mchmarny/tsignal
3-
WORKDIR /go/src/github.com/mchmarny/tsignal
4-
RUN go get ./
5-
RUN go build
6-
CMD ./tsignal
2+
MAINTAINER Mark Chmarny <[email protected]>
3+
4+
RUN mkdir /app
5+
COPY ./tsignal /app/tsignal
6+
7+
RUN mkdir /app/scripts
8+
COPY ./scripts/stocks.csv /app/scripts/stocks.csv
9+
10+
WORKDIR /app
11+
CMD /app/tsignal

build-publish

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bash ./build
2+
gcloud container builds submit --tag gcr.io/cpe-data/tsignal:0.2.5 .
3+
rm ./tsignal

container-publish

-1
This file was deleted.

deployments/signal.yaml renamed to deployments/tsignal.yaml

+14-14
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,55 @@ apiVersion: extensions/v1beta1
22
kind: Deployment
33
metadata:
44
labels:
5-
app: signal
6-
name: signal
5+
app: tsignal
6+
name: tsignal
77
spec:
88
replicas: 1
99
template:
1010
metadata:
1111
labels:
12-
app: signal
13-
name: signal
12+
app: tsignal
13+
name: tsignal
1414
spec:
1515
containers:
16-
- name: signal
17-
image: gcr.io/cpe-data/tsignal:latest
16+
- name: tsignal
17+
image: gcr.io/cpe-data/tsignal:0.2.5
1818
imagePullPolicy: Always
1919
env:
2020
- name: T_CONSUMER_KEY
2121
valueFrom:
2222
secretKeyRef:
23-
name: signal-tw-key
23+
name: tsignal-tw-key
2424
key: T_CONSUMER_KEY
2525
- name: T_CONSUMER_SECRET
2626
valueFrom:
2727
secretKeyRef:
28-
name: signal-tw-secret
28+
name: tsignal-tw-secret
2929
key: T_CONSUMER_SECRET
3030
- name: T_ACCESS_TOKEN
3131
valueFrom:
3232
secretKeyRef:
33-
name: signal-tw-token
33+
name: tsignal-tw-token
3434
key: T_ACCESS_TOKEN
3535
- name: T_ACCESS_SECRET
3636
valueFrom:
3737
secretKeyRef:
38-
name: signal-tw-access
38+
name: tsignal-tw-access
3939
key: T_ACCESS_SECRET
4040
- name: GCLOUD_PROJECT
4141
valueFrom:
4242
secretKeyRef:
43-
name: signal-gcloud-project
43+
name: tsignal-gcloud-project
4444
key: GCLOUD_PROJECT
4545
- name: GCLOUD_INSTANCE
4646
valueFrom:
4747
secretKeyRef:
48-
name: signal-spanner-instance
48+
name: tsignal-spanner-instance
4949
key: GCLOUD_INSTANCE
5050
- name: GCLOUD_DB
5151
valueFrom:
5252
secretKeyRef:
53-
name: signal-spanner-db
53+
name: tsignal-spanner-db
5454
key: GCLOUD_DB
5555
volumeMounts:
5656
- name: "service-account"
@@ -60,7 +60,7 @@ spec:
6060
volumes:
6161
- name: "service-account"
6262
secret:
63-
secretName: "signal-sa"
63+
secretName: "tsignal-sa"
6464
- name: "certs"
6565
hostPath:
6666
path: "/etc/ssl/certs"

provider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func subscribeToStream(stock Stock, ch chan<- Content) {
6666
UpdatedOn: aquiredOn,
6767
},
6868
}
69-
logInfo.Printf("Post [%v:%d]", stock.Symbol, msg.Post.PostID)
69+
logDebug.Printf("Post [%v:%d]", stock.Symbol, msg.Post.PostID)
7070
ch <- msg
7171
}
7272
}

scripts/cluster.sh

+12-11
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@ gcloud container clusters get-credentials "${APP_NAME}-cluster" \
2121
--zone $GCLOUD_ZONE --project $GCLOUD_PROJECT
2222

2323
# configs
24-
kubectl create configmap signal-config --from-file configmaps/us-west1.yaml
24+
kubectl create configmap tsignal-config --from-file configmaps/us-west1.yaml
2525

2626

27-
# populate secrets
28-
kubectl create secret generic signal-tw-key --from-literal=T_CONSUMER_KEY=$T_CONSUMER_KEY
29-
kubectl create secret generic signal-tw-secret --from-literal=T_CONSUMER_SECRET=$T_CONSUMER_SECRET
30-
kubectl create secret generic signal-tw-token --from-literal=T_ACCESS_TOKEN=$T_ACCESS_TOKEN
31-
kubectl create secret generic signal-tw-access --from-literal=T_ACCESS_SECRET=$T_ACCESS_SECRET
27+
# populate twitter secrets
28+
kubectl create secret generic tsignal-tw-key --from-literal=T_CONSUMER_KEY=$T_CONSUMER_KEY
29+
kubectl create secret generic tsignal-tw-secret --from-literal=T_CONSUMER_SECRET=$T_CONSUMER_SECRET
30+
kubectl create secret generic tsignal-tw-token --from-literal=T_ACCESS_TOKEN=$T_ACCESS_TOKEN
31+
kubectl create secret generic tsignal-tw-access --from-literal=T_ACCESS_SECRET=$T_ACCESS_SECRET
3232

33-
kubectl create secret generic signal-gcloud-project --from-literal=GCLOUD_PROJECT=$GCLOUD_PROJECT
34-
kubectl create secret generic signal-spanner-instance --from-literal=GCLOUD_INSTANCE=$GCLOUD_INSTANCE
35-
kubectl create secret generic signal-spanner-db --from-literal=GCLOUD_DB=$GCLOUD_DB
36-
kubectl create secret generic signal-sa --from-file auth.json
33+
# populate app secrets
34+
kubectl create secret generic tsignal-gcloud-project --from-literal=GCLOUD_PROJECT=$GCLOUD_PROJECT
35+
kubectl create secret generic tsignal-spanner-instance --from-literal=GCLOUD_INSTANCE=$GCLOUD_INSTANCE
36+
kubectl create secret generic tsignal-spanner-db --from-literal=GCLOUD_DB=$GCLOUD_DB
37+
kubectl create secret generic tsignal-sa --from-file auth.json
3738

3839
# deploy
39-
# kubectl create -f deployments/signal.yaml
40+
# kubectl create -f deployments/tsignal.yaml

0 commit comments

Comments
 (0)