-
Clone the repository
git clone https://github.com/erhanalankus/chat-app.git
cd chat-app
-
Enter SendGrid information into the Dockerfile. You should have received the information in an email, sent to you from me.
Replace
{REDACTED-USERNAME}
with the username value in the email(in double quotes).Replace
{REDACTED-APIKEY}
with the API key in the email(in double quotes).Replace
{REDACTED-SENDER-EMAIL}
with the sender email in the email(in double quotes).For example, if the username is "Brad Pitt",the API key is "SG.12345", and the sender email is "[email protected]", this is what the lines in your Dockerfile should look like:
ENV SendGridUser="Brad Pitt" ENV SendGridKey="SG.12345" ENV SenderEmail="[email protected]"
-
Build Docker image
docker build -t erhanalankus/chatapp .
-
Run Docker container
docker run -p 8080:80 -v chatAppVolume:/app/Database erhanalankus/chatapp
This command will create a volume folder(named chatAppVolume) on your filesystem outside the container. The folder will be used to persist the SQLite database file. If you want, you can inspect the folder created in your machine at this path:
Windows:
\\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\
Linux:
/var/lib/docker/volumes
-
Visit localhost:8080 on your browser and use the application.
You can just hit F5
and start the application. However, you need to enter the SendGrid credentials into the secrets.json file of ChatApp.Presentation.
Right click ChatApp.Presentation on the solution explorer and click "Manage User Secrets" to open the secrets.json file. Enter the SendGrid information into that file.
For example, if the username is "Brad Pitt", the API key is "SG.12345", and the email sender is "[email protected]", this is what the lines in your secrets.json file should look like:
"SendGridUser": "Brad Pitt",
"SendGridKey": "SG.12345",
"SenderEmail": "[email protected]",
The solution consists of six projects. The architecture is inspired by the Onion Architecture.
ChatApp.Core: This project has the core entities(Message, Room, ApplicationUser), ViewModels and the custom exception for invalid SendGrid credentials.
ChatApp.Data: This project has the database context class, configurations and the migrations.
ChatApp.Service: This project has the email sending implementation.
ChatApp.Communication: This project has the SignalR Hub class and the Entity-ViewModel mapping profiles.
ChatApp.Presentation: This Razor Pages project is responsible for registering and logging in the user, membership operations, and presenting the chat application.
ChatApp.Tests: This MSTest project tests the email sending implementation against invalid SendGrid API keys.