Hey, I have an issue that I'm hoping has a simple solution 🙂 I'm working on a POC to showcase the deployment process of Dapr to a kubernetes cluster. First step is to try out the solution locally in a Docker Compose setup. Everything seems to spin up fine, but the Redis State Store component is complaining that is has no configuration file defined. I've tried shuffling the components folder around to no avail.
Let me list out the different parts:
Dockerfile
WORKDIR /app
EXPOSE 5000
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY /src /src
RUN dotnet restore "DaprStateStoreAPI.csproj"
RUN dotnet build "./DaprStateStoreAPI.csproj" -c Release -o /app/build
COPY /src/Components /app/build/Components
FROM build AS publish
RUN dotnet publish "DaprStateStoreAPI.csproj" -c Release -o /app/publish /p:UseAppHost=false
COPY --from=build /app/build/Components /app/publish/components
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV ASPNETCORE_URLS=https://+:5000
ENV DOTNET_EnableDiagnostics=1
ENV ASPNETCORE_ENVIRONMENT=Development
ENTRYPOINT ["dotnet", "DaprStateStoreAPI.dll"]```
**docker-compose.yml**
```version: '3.4'
services:
placement:
image: "daprio/dapr:latest"
command: ["./placement", "--port", "50006", "--log-level", "debug"]
redis:
image: redis:latest
hostname: dapr-statestore
ports:
- "6390:6379"
dapr-statestore-api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://+:5000
depends_on:
- redis
- placement
image: dapr-statestore-api:latest
build:
context: .
dockerfile: Dockerfile
ports:
- "5000:5000"
dapr-statestore-api-dapr:
image: "daprio/daprd:edge"
command: [
"./daprd",
"--app-id", "dapr-statestore-api",
"--app-port", "5000",
"--placement-host-address", "placement:50006", # Dapr's placement service can be reach via the docker DNS entry
"--log-level", "debug",
"--resources-path", "./components"
]
volumes:
- "./components/:/components" # Mount our components folder for the runtime to use. The mounted location must match the --resources-path argument.
depends_on:
- dapr-statestore-api
network_mode: "service:dapr-statestore-api" # Attach the daprstatestoreapi service to the network namespace
./arc/Components/statestore.yml
kind: Component
metadata:
name: statestore
spec:
type: state.redis
metadata:
- name: redisHost
value: redis:6379
- name: redisPassword
value: ""
- name: actorStateStore
value: "true"
The full console output from docker compose up attached, but the impoartant part:
daprstatestoreapi-redis-1 | 1:C 11 Sep 2023 18:59:11.931 * Redis version=7.2.1, bits=64, commit=00000000, modified=0, pid=1, just started
daprstatestoreapi-redis-1 | 1:C 11 Sep 2023 18:59:11.931 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf```
Hopefully you are able to easily spot the issue.