Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set mysql image version #69

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions FIAP.TechChallenge.ByteMeBurger.sln
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "kubernetes", "kubernetes",
kubernetes\stress.sh = kubernetes\stress.sh
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "database", "database", "{23D2EC49-62CF-46E2-A975-1951BB0493C6}"
ProjectSection(SolutionItems) = preProject
database\Dockerfile = database\Dockerfile
database\init.sql = database\init.sql
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -75,6 +81,7 @@ Global
{09D890C7-7AA0-40E2-8AA6-6DD47462548D} = {A33B3721-3873-4E78-A3AE-666951CE87ED}
{68F424FA-F00C-4179-A9D5-5026D5C4930C} = {C244E1D6-E1EB-4314-9F39-BB59FA1F7C71}
{5858E02C-014F-4A1C-8A4A-2DFAF0D33BAB} = {2F192BA8-59FC-4B0C-B59D-511EFA89F428}
{23D2EC49-62CF-46E2-A975-1951BB0493C6} = {2F192BA8-59FC-4B0C-B59D-511EFA89F428}
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B8F244B5-F703-441C-8A8A-C720F605709C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ You can find all Phase 1 deliverables on the [Wiki page](https://github.com/soat
```bash
docker-compose up -d
```

4. Testing


4. Service health (check if the service is healthy before testing)
> [http://localhost:8080/healthz](http://localhost:8080/healthz)

5. Testing
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comma for clarity in the testing section.

- To verify the existing endpoints go to
+ To verify the existing endpoints, go to

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
5. Testing
5. Testing
To verify the existing endpoints, go to

To verify the existing endpoints go to

> [http://localhost:8080/swagger/index.html](http://localhost:8080/swagger/index.html)
5. Service health
> [http://localhost:8080/health](http://localhost:8080/health)
6. If you want to quickly seed the database with fake data and test some of the endpoints use the [FIAP_TechChallenge_ByteMeBurger-endpoints.http](FIAP_TechChallenge_ByteMeBurger-endpoints.http) file

7. Stop the services using Docker:
Expand Down
6 changes: 5 additions & 1 deletion database/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Use the official MySQL image as a base
FROM mysql:latest
FROM mysql:8.3.0

# Add our init.sql script to the Docker image
ADD init.sql /docker-entrypoint-initdb.d/

# NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
# (this is just an example, not intended to be a production configuration)
CMD ["mysqld", "--mysql-native-password=ON"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider the security implications of using mysql_native_password.

It's recommended to use more secure authentication methods than mysql_native_password, especially for production environments. Consider alternatives such as caching_sha2_password.

7 changes: 2 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
services:
api:
depends_on:
- seq
- database
container_name: restaurant_api
build:
Expand All @@ -27,16 +26,14 @@
- MySqlSettings__UserId=${MYSQL_USERID}
- MySqlSettings__Password=${MYSQL_PASSWORD}
- ASPNETCORE_ENVIRONMENT=Development
- Serilog__Write__To__2__Args__serverUr=http://seq:5341
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the typo in the Serilog server URL.

- Serilog__Write__To__2__Args__serverUr=http://seq:5341
+ Serilog__Write__To__2__Args__serverUrl=http://seq:5341

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- Serilog__Write__To__2__Args__serverUr=http://seq:5341
- Serilog__Write__To__2__Args__serverUrl=http://seq:5341

database:
container_name: restaurant_db
build:
context: ./database
dockerfile: Dockerfile
tags:
- techchallenge/db
# NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
# (this is just an example, not intended to be a production configuration)
command: --default-authentication-plugin=mysql_native_password
- techchallenge/restaurant_db
restart: always
environment:
- MYSQL_ROOT_PASSWORD=admin
Expand Down
4 changes: 2 additions & 2 deletions src/FIAP.TechChallenge.ByteMeBurger.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void Main(string[] args)
.AllowAnyMethod();
});
});

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
// https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-8.0#log-automatic-400-responses
builder.Services.AddEndpointsApiExplorer();
Expand Down Expand Up @@ -95,7 +95,7 @@ public static void Main(string[] args)
}

app.UseSerilogRequestLogging();
app.UseHealthChecks("/health", new HealthCheckOptions
app.UseHealthChecks("/healthz", new HealthCheckOptions
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
Expand Down
Loading