Hi Ben, sorry, of course I meant the BuildConfig and yes, I have read your documentation but it didn't help me to solve my problem since I'm still getting errors.
I have specified the following in my template file: source: contextDir: api git: ref: ${GIT_REF} uri: ${GIT_URI} type: Git strategy: type: Docker dockerStrategy: dockerfilePath: docker/Dockerfile & this as the dockerfile (api): FROM docker.io/openjdk:8-jre MAINTAINER hygi...@capitalone.com ENV SPRING_DATA_MONGODB_DATABASE=dashboard ENV SPRING_DATA_MONGODB_HOST=hygieia-mongodb ENV SPRING_DATA_MONGODB_PORT=27017 ENV SPRING_DATA_MONGODB_USERNAME=dashboarduser ENV SPRING_DATA_MONGODB_PASSWORD=dbpassword ENV AUTH_EXPIRATION_TIME=7200000 ENV jasypt.encryptor.password=hygieiasecret ENV AUTH_SECRET=hygieiasecret RUN \ mkdir /hygieia COPY *.jar /hygieia COPY properties-builder.sh /hygieia/ WORKDIR /hygieia VOLUME ["/hygieia/logs"] EXPOSE 8080 CMD ./properties-builder.sh &&\ java -Djava.security.egd=file:/dev/./urandom -jar api.jar --spring.config.location=/hygieia/dashboard.properties But it says that it can't find my source file in the copy step, which leads to an error in the build step. Note: My api.jar file and the properties-builder.sh file are located in the api/docker directory (same directory as the Dockerfile specified in the .yaml template file). Then, I have tried Type: Binary as source for the build config and used the build strategy Docker: source: from-repo: ${GIT_URI} contextDir: api type: Binary strategy: type: Docker dockerStrategy: dockerfilePath: docker/Dockerfile But this didn't work either. Please, could you tell me which source and build strategy is correct in order to execute the build with my existing dockerfile? Furthermore, regarding the aforementioned MongoDB question,I have found the Coolstore Microservice example from Redhat: strategy: recreateParams: post: execNewPod: command: - /bin/sh - -i - -c - env && while ! mongo ${RATING_MONGODB_SERVICE_HOST}:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval="$MONGODB_INIT" > /dev/null 2>&1; do echo "waiting for mongo ..."; sleep 5; done containerName: rating-mongodb env: - name: MONGODB_INIT value: db.ratings.insert({"_id":"329299","itemId":"329299","rating":5.0,"count":1}); db.ratings.insert({"_id":"329199","itemId":"329199","rating":1.0,"count":12}); db.ratings.insert({"_id":"165613","itemId":"165613","rating":2.3,"count":31}); db.ratings.insert({"_id":"165614","itemId":"165614","rating":3.0,"count":51}); db.ratings.insert({"_id":"165954","itemId":"165954","rating":4.0,"count":66}); db.ratings.insert({"_id":"444434","itemId":"444434","rating":5.0,"count":76}); db.ratings.insert({"_id":"444435","itemId":"444435","rating":4.0,"count":83}); db.ratings.insert({"_id":"444436","itemId":"444436","rating":3.0,"count":123}); I tried to adapt this example for my own project, however, it doesn't work. It seems that I'm providing a wrong SERVICE_HOST, which might be the reason why I can't connect to the mongodb host. It stays in the while loop with the message "waiting for mongo...". Could you tell me, what is the ${RATING_MONGODB_SERVICE_HOST} and where can I find the appropriate name/variable of my own project? And what are the meanings of the options "-i -c" in this case? I can't find the documentation regarding this to better understand the Coolstore Microservice example. 2017-11-14 21:46 GMT+01:00 Ben Parees <bpar...@redhat.com>: > > > On Tue, Nov 14, 2017 at 3:11 PM, Tien Hung Nguyen < > tienhng.ngu...@gmail.com> wrote: > >> Hello everybody, >> >> I'm new to OpenShift Origin and I have a few questions: >> >> My goal is to run an existing DevOps Dashboard Project on OpenShift >> Origin. The project does already workes on Docker (with Docker-compose.yaml >> and Dockerfile), consisting of the following 3 containers: >> 1. MongoDB >> 2. API >> 3. UI >> >> In the Dockerfile of the API project I have the following commands: >> >> FROM docker.io/openjdk:8-jre >> >> MAINTAINER hygi...@capitalone.com >> >> >> ENV SPRING_DATA_MONGODB_DATABASE=dashboard >> ENV SPRING_DATA_MONGODB_HOST=hygieia-mongodb >> ENV SPRING_DATA_MONGODB_PORT=27017 >> ENV SPRING_DATA_MONGODB_USERNAME=dashboarduser >> ENV SPRING_DATA_MONGODB_PASSWORD=dbpassword >> ENV AUTH_EXPIRATION_TIME=7200000 >> ENV jasypt.encryptor.password=hygieiasecret >> ENV AUTH_SECRET=hygieiasecret >> >> RUN \ >> mkdir /hygieia >> >> #COPY hygieia/ /hygieia >> COPY *.jar /hygieia/ >> COPY properties-builder.sh /hygieia/ >> >> WORKDIR /hygieia >> >> VOLUME ["/hygieia/logs"] >> >> EXPOSE 8080 >> CMD ./properties-builder.sh &&\ >> java -Djava.security.egd=file:/dev/./urandom -jar api.jar >> --spring.config.location=/hygieia/dashboard.properties >> >> The Docker-compose.yaml is as follows: >> mongodb: >> image: mongo:latest >> environment: >> - MONGODB_USERNAME=dashboarduser >> - MONGODB_DATABASE=dashboarddb >> - MONGODB_PASSWORD=dbpassword >> volumes: >> - mongo:/data/db:rw >> ports: >> - "27017:27017" >> >> hygieia-api: >> image: hygieia-api:latest >> volumes: >> - logs:/hygieia/logs >> environment: >> - jasypt.encryptor.password=hygieiasecret >> - SPRING_DATA_MONGODB_DATABASE=dashboarddb >> - SPRING_DATA_MONGODB_HOST=mongodb >> - SPRING_DATA_MONGODB_PORT=27017 >> - SPRING_DATA_MONGODB_USERNAME=dashboarduser >> - SPRING_DATA_MONGODB_PASSWORD=dbpassword >> - AUTH_EXPIRATION_TIME=7200000 >> - AUTH_SECRET=hygieiasecret >> links: >> - mongodb >> >> hygieia-ui: >> image: hygieia-ui:latest >> container_name: hygieia-ui >> ports: >> - "8088:80" >> links: >> - hygieia-api >> >> ==> The sub projects (API, UI) have a sub directory called "docker". In >> this directory there is a Dockerfile, a .jar file, and relevant .properties >> and .sh files). >> >> I have specified a Docker build strategy in the DeploymentConfig of the >> template file pointing to my Dockerfiles, >> > > DeploymentConfig or BuildConfig? > > > >> however, it says that it can't find my files while building the images, >> which I have defined (*.jar, .sh file and properties file). My question is >> now, how can I bring those files into the build process that they work with >> my dockerfiles? >> > > Have you been through our build documentation? > https://docs.openshift.org/latest/dev_guide/builds/index.html > > in particular: > https://docs.openshift.org/latest/dev_guide/builds/build_inputs.html > > and > https://docs.openshift.org/latest/dev_guide/builds/build_ > strategies.html#docker-strategy-options > > are probably relevant to your goals. > > > >> >> >> Furthermore, could you tell me what is the best way to create a new >> Database inside MongoDB when initializing the pods/containers with the help >> of the .yaml template file? Which is the best section to do that? >> > > A post-deployment hook in the database deploymentconfig, or a > pre-deployment hook in your application deploymentconfig, is likely your > best bet for initializing the DB. > > https://docs.openshift.org/latest/dev_guide/deployments/ > deployment_strategies.html#lifecycle-hooks > > For example our rails quickstart does a db migration as part of the > application's pre deployment hook: > https://github.com/openshift/origin/blob/master/examples/ > quickstarts/rails-postgresql.json#L146-L169 > > (this means the DB pod must be already up, and the app pod communicates > remotely to the db pod to initialize it) > > > >> >> >> >> _______________________________________________ >> users mailing list >> users@lists.openshift.redhat.com >> http://lists.openshift.redhat.com/openshiftmm/listinfo/users >> >> > > > -- > Ben Parees | OpenShift > >
_______________________________________________ users mailing list users@lists.openshift.redhat.com http://lists.openshift.redhat.com/openshiftmm/listinfo/users