Skip to content

Commit

Permalink
fix: set mysql image version
Browse files Browse the repository at this point in the history
  • Loading branch information
italopessoa committed May 22, 2024
1 parent 8ebd6ce commit e45aed5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
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
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"]
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
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

0 comments on commit e45aed5

Please sign in to comment.