This project is a web application for sentiment analysis of user input sentences. It is part of the Fundamentals of Cloud Technologies course assignment, where the task was to deploy a local web application in Docker, consisting of at least two services (containers). These services must run on separate ports, be deployed in different containers, and exchange data between them. The backend service performs sentiment analysis on user-submitted sentences, while the frontend provides a user interface to interact with the web application.
sentiment-analysis-web-app/
│── backend/
│ ├── main.py # Code for the web application (Backend)
│ ├── requirements.txt # Required dependencies
│ ├── Dockerfile # Docker image for the backend service
│ ├── .dockerignore # Specifies ignored files for the backend
│── frontend/
│ ├── favicon/ # Favicon images for the frontend
│ ├── index.html # HTML file for the user interface
│ ├── style.css # CSS file for styling the frontend
│ ├── script.js # JavaScript to handle frontend logic
│ ├── Dockerfile # Docker image for Nginx (Frontend)
│ ├── .dockerignore # Specifies ignored files for the frontend
│── docker-compose.yml # Docker Compose file for orchestrating containers
│── .env # File with environment variables
│── start-app.sh # Script to start the application
│── end-app.sh # Script to stop the application
│── README.md # Project documentation
- Frontend:
HTML
,CSS
,JavaScript
. - Backend:
Python
,FastAPI
,NLTK
,Uvicorn
. - Deployment:
Docker
,Docker Compose
.
demo-video.mp4
-
Navigate to the project's root directory using the command:
cd sentiment-analysis-web-app
-
To start the backend and frontend containers, run the startup script:
./start-app.sh
-
Verify that both containers are running by executing:
docker container ls
You should see two containers — one for the backend and one for the frontend:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 956badf9265f sentiment-analysis-web-app-frontend "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:8080->80/tcp sentiment-analysis-web-app-frontend-1 a7dc3ea44d15 sentiment-analysis-web-app-backend "uvicorn main:app --…" About a minute ago Up About a minute 0.0.0.0:8000->8000/tcp sentiment-analysis-web-app-backend-1
-
Access the application in a web browser:
- Frontend: http://localhost:8080.
- Backend API: http://localhost:8000/analyze.
You can modify the
FRONTEND_URL
andBACKEND_URL
environment variables in the.env
file to change the addresses for the frontend and backend, respectively. -
To enter a running container, use:
docker exec -it <container-name> /bin/sh
-
To stop and remove the containers, run:
./end-app.sh
For demonstration purposes, the web application has been deployed for free on the Railway server, without the need to run the project locally or use Docker Compose. You can access it at the following URL: https://sentiment-analysis-web-app-production.up.railway.app/. Please note that this deployment will be available for an indefinite period, subject to Railway's free-tier limits.
Dmytro Varich is the creator of this application. You can learn more about his projects on his personal Telegram channel, as well as connect with him via LinkedIn (dmytro-varich) and email ([email protected]).