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

[Feature] - Docker container/image #26

Open
ITaluone opened this issue Apr 5, 2023 · 3 comments
Open

[Feature] - Docker container/image #26

ITaluone opened this issue Apr 5, 2023 · 3 comments

Comments

@ITaluone
Copy link

ITaluone commented Apr 5, 2023

Hi

I think this project is worth to be available as docker image :)

If it helps, i could provide a PR here.. so tell ma what you think :)

@dallmann-consulting
Copy link
Owner

I've thought about this before, but wasn't sure with the configuration. The configuration is located in a local file. I think it doesn' t make sense to have that inside the container. The database and configuration should live outside the docker container so that you can easily replace the container with a new version but keep your data.
And I didn't have enough spare time to try that.

@ITaluone
Copy link
Author

ITaluone commented May 5, 2023

I have somewhat acheived that already.
For now I have a docker volume.

This is my docker compose config:

version: '3'
name: ocpp
services:
  server:
    image: ocpp.server:latest // <--- just moved the complied files to my container
    container_name: OCPP.Server
    restart: always
    ports:
      - [a port]:8081
    volumes:
      - dbdata:/db
  management:
    image: ocpp.management:latest // <--- just moved the complied files to my container
    container_name: OCPP.Management
    restart: always
    ports:
      - [a port]:8082
    volumes:
      - dbdata:/db
    depends_on:
      - server
volumes:
  dbdata: // <--- creates a docker volume and every container mount it.. but not optimal :)

If you can somehow acheive to move the config from appsettings.json to the db..

@JeremyMahieu
Copy link
Contributor

There's no need to touch the app settings file, you can use environment variables which take priority over the app settings.

You can create a docker-compose.override.yml file with these settings. Or you can just add it to your other docker file. Anything you don't specify will still come from the appsettings. You can also set it in a .env file ofcourse.

version: '3.4'
services:
  ocpp-management:
    environment:
      - Kestrel__Endpoints__Http__Url=http://0.0.0.0:8082
      - Kestrel__Endpoints__HttpsInlineCertFile__Url=https://0.0.0.0:8092
      - ServerApiUrl=http://yourserver:8081/API
      - ConnectionStrings__SqlServer=Server=yourserver;Database=OCPP.Core;User Id=ocpp;Password=asdf;TrustServerCertificate=True;
      - ApiKey=11112222-3333-4444-5555-666677778888
      - MessageDumpDir=/log
      - Users__0__Username=example
      - Users__0__Password=example123
      - Users__0__Administrator=true
      - Users__1__Username=example2
      - Users__1__Password=example123
      - Users__1__Administrator=false
  ocpp-server:
    environment:
      - Kestrel__Endpoints__Http__Url=http://0.0.0.0:8081
      - Kestrel__Endpoints__HttpsInlineCertFile__Url=https://0.0.0.0:8091
      - ConnectionStrings__SqlServer=Server=yourserver;Database=OCPP.Core;User Id=ocpp;Password=asdf;TrustServerCertificate=True;
      - ApiKey=11112222-3333-4444-5555-666677778888
      - MessageDumpDir=/log

If you need the rest of the docker-compose file or the actual Dockerfile, let me know and I can do a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants