File tree 7 files changed +122
-3
lines changed 7 files changed +122
-3
lines changed Original file line number Diff line number Diff line change 9
9
# Fetch dependencies.
10
10
RUN go mod download
11
11
# Build the binary.
12
- RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /go/bin/charging_station example/2.0.1/chargingstation/*.go
12
+ RUN go build -ldflags="-w -s" -o /go/bin/charging_station example/2.0.1/chargingstation/*.go
13
13
14
14
# ###########################
15
15
# STEP 2 build a small image
@@ -23,4 +23,4 @@ COPY --from=builder /go/bin/charging_station /bin/charging_station
23
23
# Ignore the warning.
24
24
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* && update-ca-certificates
25
25
26
- CMD [ "charge_point " ]
26
+ CMD [ "charging_station " ]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ mkdir -p certs/csms
4
+ mkdir -p certs/chargingstation
5
+ cd certs
6
+ # Create CA
7
+ openssl req -new -x509 -nodes -days 120 -extensions v3_ca -keyout ca.key -out ca.crt -subj " /CN=ocpp-go-example"
8
+ # Generate self-signed CSMS certificate
9
+ openssl genrsa -out csms/csms.key 4096
10
+ openssl req -new -out csms/csms.csr -key csms/csms.key -config ../openssl-csms.conf -sha256
11
+ openssl x509 -req -in csms/csms.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out csms/csms.crt -days 120 -extensions req_ext -extfile ../openssl-csms.conf -sha256
12
+ # Generate self-signed charging-station certificate
13
+ openssl genrsa -out chargingstation/charging-station.key 4096
14
+ openssl req -new -out chargingstation/charging-station.csr -key chargingstation/charging-station.key -config ../openssl-chargingstation.conf -sha256
15
+ openssl x509 -req -in chargingstation/charging-station.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out chargingstation/charging-station.crt -days 120 -extensions req_ext -extfile ../openssl-chargingstation.conf -sha256
Original file line number Diff line number Diff line change 9
9
# Fetch dependencies.
10
10
RUN go mod download
11
11
# Build the binary.
12
- RUN GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /go/bin/csms example/2.0.1/csms/*.go
12
+ RUN go build -ldflags="-w -s" -o /go/bin/csms example/2.0.1/csms/*.go
13
13
14
14
# ###########################
15
15
# STEP 2 build a small image
Original file line number Diff line number Diff line change
1
+ version : ' 3'
2
+ services :
3
+ csms :
4
+ build :
5
+ context : ../..
6
+ dockerfile : csms/Dockerfile
7
+ image : ldonini/ocpp2.0.1-csms:latest
8
+ container_name : csms
9
+ volumes :
10
+ - ./certs/csms:/usr/local/share/certs
11
+ - ./certs/ca.crt:/usr/local/share/certs/ca.crt
12
+ environment :
13
+ - SERVER_LISTEN_PORT=443
14
+ - TLS_ENABLED=true
15
+ - CA_CERTIFICATE_PATH=/usr/local/share/certs/ca.crt
16
+ - SERVER_CERTIFICATE_PATH=/usr/local/share/certs/csms.crt
17
+ - SERVER_CERTIFICATE_KEY_PATH=/usr/local/share/certs/csms.key
18
+ ports :
19
+ - " 443:443"
20
+ networks :
21
+ - sim
22
+ tty : true
23
+ charging-station :
24
+ build :
25
+ context : ../..
26
+ dockerfile : chargingstation/Dockerfile
27
+ image : ldonini/ocpp2.0.1-chargingstation:latest
28
+ container_name : charging-station
29
+ volumes :
30
+ - ./certs/chargingstation:/usr/local/share/certs
31
+ - ./certs/ca.crt:/usr/local/share/certs/ca.crt
32
+ environment :
33
+ - CLIENT_ID=chargingStationSim
34
+ - CSMS_URL=wss://csms:443
35
+ - TLS_ENABLED=true
36
+ - CA_CERTIFICATE_PATH=/usr/local/share/certs/ca.crt
37
+ - CLIENT_CERTIFICATE_PATH=/usr/local/share/certs/charging-station.crt
38
+ - CLIENT_CERTIFICATE_KEY_PATH=/usr/local/share/certs/charging-station.key
39
+ networks :
40
+ - sim
41
+ tty : true
42
+
43
+ networks :
44
+ sim :
45
+ driver : bridge
Original file line number Diff line number Diff line change
1
+ version : ' 3'
2
+ services :
3
+ csms :
4
+ build :
5
+ context : ../..
6
+ dockerfile : csms/Dockerfile
7
+ image : ldonini/ocpp2.0.1-csms:latest
8
+ container_name : csms
9
+ environment :
10
+ - SERVER_LISTEN_PORT=8887
11
+ ports :
12
+ - " 8887:8887"
13
+ networks :
14
+ - sim
15
+ tty : true
16
+ charging-station :
17
+ build :
18
+ context : ../..
19
+ dockerfile : chargingstation/Dockerfile
20
+ image : ldonini/ocpp2.0.1-chargingstation:latest
21
+ container_name : charging-station
22
+ environment :
23
+ - CLIENT_ID=chargingStationSim
24
+ - CSMS_URL=ws://csms:8887
25
+ networks :
26
+ - sim
27
+ tty : true
28
+
29
+ networks :
30
+ sim :
31
+ driver : bridge
Original file line number Diff line number Diff line change
1
+ [req]
2
+ distinguished_name = req_dn
3
+ req_extensions = req_ext
4
+ prompt = no
5
+ [req_dn]
6
+ CN = charging-station
7
+ [req_ext]
8
+ basicConstraints = CA:FALSE
9
+ subjectKeyIdentifier = hash
10
+ keyUsage = digitalSignature, keyEncipherment
11
+ extendedKeyUsage = clientAuth
12
+ subjectAltName = @alt_names
13
+ [alt_names]
14
+ DNS.1 = charging-station
Original file line number Diff line number Diff line change
1
+ [req]
2
+ distinguished_name = req_dn
3
+ req_extensions = req_ext
4
+ prompt = no
5
+ [req_dn]
6
+ CN = csms
7
+ [req_ext]
8
+ basicConstraints = CA:FALSE
9
+ subjectKeyIdentifier = hash
10
+ keyUsage = digitalSignature, keyEncipherment, dataEncipherment
11
+ extendedKeyUsage = serverAuth
12
+ subjectAltName = @alt_names
13
+ [alt_names]
14
+ DNS.1 = csms
You can’t perform that action at this time.
0 commit comments