Here's the revised version of your document with corrected English:
This backend service is designed for Twitter Sentiment Analysis, providing a robust and scalable solution for processing and analyzing tweets. Built using Golang, Kafka, gRPC, and Go-Fiber, it combines the efficiency of Go with the power of Kafka messaging and the flexibility of gRPC for seamless communication.
Language: GoLang
Library: GORM
Framework: gRPC, Apache Kafka
Tools: Docker
GET /
GET /tweets
Returns a JSON object containing the sentiment analysis results for the 10 most recent tweets. A score of 1 indicates a positive sentiment, while a null score indicates a negative sentiment.
- Clone the project
git clone https://github.com/samarthasthan/twitter-sentiments
-
Download the dataset CSV file from Kaggle, rename it to
tweets.csv
, and copy it totwitter-sentiments/twitter-api
.Copy the
tweets.csv
file from your local machine to the VPS.scp -i "secret.pem" path/tweets.csv ubuntu@publicip:github/twitter-sentiments/twitter-api
If you encounter a permission denied error, use the following command on the VPS:
sudo chmod 777 (remote folder)
-
Navigate to the project directory
cd twitter-sentiments
- Start Docker
docker compose up -d
- Set up Nginx
apt update
apt install nginx
vim /etc/nginx/conf.d/samarthasthan.conf
Then copy your Nginx config to {domain}.conf
server {
listen 80;
listen [::]:80;
server_name twitter-go.samarthasthan.com;
location / {
proxy_pass http://localhost:9058;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
- Install SSL certificate using Certbot
sudo apt update
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d twitter-go.samarthasthan.com
- Automate SSL renewal with crontab
crontab -e
And paste the crontab job
0 6 * * 0 certbot renew -n -q --pre-hook "service nginx stop" --post-hook "service nginx start"
- Finally, restart Nginx
nginx -t
sudo systemctl restart nginx
- Clone the project
git clone https://github.com/samarthasthan/twitter-sentiments
-
Download the dataset CSV file from Kaggle, rename it to
tweets.csv
, and copy it totwitter-sentiments/twitter-api
. -
Navigate to the project directory
cd twitter-sentiments
- Start Docker
docker compose up -d
Note: Now, you can access it using localhost:9058/tweets
.