nzamani / sap-cloud-connector-docker

SAP Cloud Connector in Docker
75 stars 55 forks source link

Externalize the sapcc data storge #17

Open eugen-eugen opened 4 years ago

eugen-eugen commented 4 years ago

Hallo, nzamani,

Thank You very much for the sapcc docker enablement. One thing, I want to know: what have ich to do in order to store sapcc-data (user, accounts, connection etc, configs.) not inside of docker container, but on an external volume? Thank You !

cmedley commented 4 years ago

FYI - We got it running on kubernetes using statefulset. We didn't know what needed to persist during restarts, so we started up the sapcc container on local and looked at what changed during normal usage. We ended up just moving the entire /opt/sap/scc/ directory to EBS using an init container. In the Dockerfile we added run command to copy /opt/sap/scc/* to a tmp location. The init container checks if EBS is empty. If empty it moves the contents from that tmp location to EBS. It was easier that way. So far it is running great.

nzamani commented 4 years ago

Thanks @eugen-eugen for the question, and thanks @cmedley for your answer. I'm a little late on this... You could also try to use docker volumes, and maybe you wanna try volumes in combination with Docker Compose.

gnnivlek commented 3 years ago

hi @cmedley, may I ask what are the commands that you use on your init container? Thank you.

PrabuddhaRaj commented 3 years ago

hi @cmedley , Hi @nzamani , i also have the same issue where i have configured the cloud connector on kubernetes and i need to save my state to a persistent storage volume. can you share the code/commands for init containers used and copying the folder code from /opt/sap/scc to another location?

cmedley commented 3 years ago

@gnnivlek ... apologize for delay ... just saw this .... + @PrabuddhaRaj

Here are the commands that I used in init container. Let me know if that works for you (or if there is a better way to handle)


initContainers:
  - name: init-myservice
    image: <image here>
    command:
      - bash
      - "-c"
      - |
        set -ex

        if find /opt/sap/scc/config -mindepth 1 | read; then
          echo "directory not empty";
          echo `ls -la /opt/sap/scc`
        else
          echo "directory empty";
          cp -fR /opt/sap/scc_seed/* /opt/sap/scc/
          echo "what is the listing now?";
          echo `ls -la /opt/sap/scc`
        fi
    volumeMounts:
      - name: sccdata
        mountPath: /opt/sap/scc

the volumeClaimTemplates look like this:

  volumeClaimTemplates:
    - metadata:
        name: sccdata
      spec:
        storageClassName: default
        accessModes: [ReadWriteOnce]
        resources:
          requests:
            storage: 1Gi
cmedley commented 3 years ago

@gnnivlek @PrabuddhaRaj in addition to the initContainer ... I added this command to dockerfile

RUN mkdir /opt/sap/scc_seed && cp -fR /opt/sap/scc/* /opt/sap/scc_seed/