Skip to content

carverauto/basic-twitter-server

Repository files navigation

basic-twitter-server

Connects to the twitter stream API and based on the rules we've defined, listens for our tweets and writes them to a pusher channel

DOCKER

Example Dockerfile

FROM node:16

ENV BEARER_TOKEN twitterBearerTokenGoesHere
ENV API_KEY moreKeyz
ENV API_SECRET seCretz
ENV PUSHER_API_APPID apIdznstuff
ENV PUSHER_API_KEY moarApiKeyz
ENV PUSHER_API_SECRET moarSekreetz
ENV PUSHER_API_CLUSTER us2
EXPOSE 8080

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

CMD [ "node", "server.js" ]

Building with Docker

Make sure you insert the twitter BEARER_TOKEN below

npm install
 docker build . --build-arg BEARER_TOKEN=TOKEN -t nodejs-twitter

Running docker

docker run --restart always -d --name nodejs-twitter -p 8080:8080 nodejs-twitter

Container management

It seems this nodejs stuff likes to crash after a while so, we'll help it out:

Crontab:

*/30 * * * *	docker restart nodejs-twitter

Logs

docker logs nodejs-twitter

API

Coming soon..

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published