tweet-provider

command module
v0.0.0-...-cc29106 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 11 Imported by: 0

README

Tweet Provider Demo

Setup

To run these demos locally, you will have first create a secret file (pipeline/secrets.json). These will be used by Dapr components at runtime. To get the Twitter API secretes you will need to register your app here.

{
    "Twitter": {
        "ConsumerKey": "",
        "ConsumerSecret": "",
        "AccessToken": "",
        "AccessSecret": ""
    }
}

Run it

Standalone Mode

Navigate to the tweet-provider directory and run:

cd tweet-provider
dapr run \
    --app-id tweet-provider \
    --app-port 8080 \
    --app-protocol http \
    --components-path ./config \
    go run main.go

The last line from the above command should be

✅  You're up and running! Both Dapr and your app logs will appear here.

Your tweets should appear in the logs now

Kubernetes

Create secret for tweet-provider to connect to Twitter API

kubectl create secret generic twitter-secret \
  --from-literal=consumerKey="" \
  --from-literal=consumerSecret="" \
  --from-literal=accessToken="" \
  --from-literal=accessSecret=""

Deploy the tweet-provider service and its components

kubectl apply -f tweet-provider/k8s/state.yaml
kubectl apply -f tweet-provider/k8s/pubsub.yaml
kubectl apply -f tweet-provider/k8s/twitter.yaml
kubectl apply -f tweet-provider/k8s/deployment.yaml
kubectl rollout status deployment/tweet-provider

If you have changed an existing component, make sure to reload the deployment and wait until the new version is ready

kubectl rollout restart deployment/tweet-provider
kubectl rollout status deployment/tweet-provider

Check Dapr to make sure components were registered correctly

kubectl logs -l app=tweet-provider -c daprd --tail 200

Disclaimer

This is my personal project and it does not represent my employer. While I do my best to ensure that everything works, I take no responsibility for issues caused by this code.

License

This software is released under the MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL