Running project locally - ita-social-projects/WhatBackend GitHub Wiki
Required steps:
- Install software
- Clone repository
- Run scripts to create and seed database
- Add .env files
- Start project
- Running admin panel
In order to run a project on your local machine, these software is required to be installed:
Clone this repository using your IDE or git clone
command. You need to clone branch dev
.
This Web API project uses MySQL database as a data storage. In order to create and seed database with initial data you are required to run SQL scripts in the following order: 1_[name_of_script]
, 2_[name_of_script]
, ...
, n_[name_of_script]
.
All scripts are located in the corresponding folder: <RepositoryRootFolder>\scripts\
NOTE: Before running the scripts, make sure there is no database named Soft
in your local instance of MySQL.
NOTE: To deal with MySQL use MySQL Workbench 8.0 CE
or later versions of this application.
This Web API application uses DotNetEnv library and reads environment variables from .env files.
In order to run the application you need to create and place .env files with the following contents into corresponding folders.
- Location:
<RepositoryRootFolder>\CharlieBackend.Api\
Contents:
# dev local mySql connection string
ConnectionStrings__DefaultConnection=server=localhost;port=3306;UserId=<YOUR_ID>;Password=<YOUR_PASSWORD>;database=soft;
ConnectionStrings__RabbitMQ=<RABBIT_MQ_CONNECTION_STRING>
ConnectionStrings__AzureBlobsAccessKey=<AZURE_BLOBS_ACCESS_KEY_CONNECTION_STRING>
# dev local token
AuthOptions__KEY=<JWT_SECRET_KEY>
# email notifier account credentials
CredentialsSendersSettings__email=<CRED_SENDER_EMAIL>
CredentialsSendersSettings__password=<CRED_SENDER_PASSWORD>
Replace <YOUR_ID>
and <YOUR_PASSWORD>
with your own MySQL credentials. Also, check if your local MySQL instance runs on port specified in the connection string.
Replace <JWT_SECRET_KEY>
with a valid secret key value that is used to sign JWT on creation.
Replace <CRED_SENDER_EMAIL>
and <CRED_SENDER_PASSWORD>
with valid credentials of email notification sender account.
Replace <RABBIT_MQ_CONNECTION_STRING>
and <AZURE_BLOBS_ACCESS_KEY_CONNECTION_STRING>
with valid connection strings.
NOTE: .env files contain no filename, only extension.
NOTE: You can find out the correct data to fill out from your teammates, mentor or technical expert.
- Location:
<RepositoryRootFolder>\CharlieBackend.AdminPanel\
Contents:
# devlocalhost cookies key
Cookies__SecureKey=<SECURE_KEY>
Replace <SECURE_KEY>
with a valid secure key value that is used for encryption/decryption of cookie data.
NOTE: .env files contain no filename, only extension.
NOTE: You can find out the correct data to fill out from your teammates, mentor or technical expert.
Make sure your local MySQL instnance is up and running.
In this step open CharlieBackend.sln
with your IDE and run the project.
Or if you're willing to use CLI, type dotnet run
console command inside <RepositoryRootFolder>\CharlieBackend.Api\
folder and navigate to http://localhost:5000 or https://localhost:5001.
In case of a successful application run you should receive Swagger (OpenAPI) page that represents UI for available Web API endpoints.
"Admin panel" is an additional web application project that is located inside <RepositoryRootFolder>\CharlieBackend.AdminPanel\
folder.
In order to run admin panel, it requires the main application (CharlieBackend.Api) that is already running.
Run CLI script run-localhost-what-api.cmd
that starts the main application. Then run admin panel project with your IDE, or run run-localhost-what-adminpanel.cmd
script and navigate to http://localhost:5002 or https://localhost:5003/.
Both CLI scripts are located inside <RepositoryRootFolder>\cli_scripts\
folder.
In case of a successful application run you should receive Login page of admin panel.
Azurite is an emulator for local Azure Storage development. You can find instructions how to deploy your application in Azurite at Azurite setup guide.