2016-07-14 19:03 GMT-03:00 Ben Parees <bpar...@redhat.com>: > > > On Thu, Jul 14, 2016 at 4:40 PM, Robson Ramos Barreto < > robson.rbarr...@gmail.com> wrote: > >> >> >> 2016-07-11 12:13 GMT-03:00 Ben Parees <bpar...@redhat.com>: >> >>> >>> >>> On Mon, Jul 11, 2016 at 10:28 AM, Robson Ramos Barreto < >>> robson.rbarr...@gmail.com> wrote: >>> >>>> >>>> >>>> 2016-07-11 11:16 GMT-03:00 Ben Parees <bpar...@redhat.com>: >>>> >>>>> >>>>> >>>>> On Mon, Jul 11, 2016 at 10:13 AM, Robson Ramos Barreto < >>>>> robson.rbarr...@gmail.com> wrote: >>>>> >>>>>> >>>>>> 2016-07-08 16:45 GMT-03:00 Ben Parees <bpar...@redhat.com>: >>>>>> >>>>>>> >>>>>>> >>>>>>> On Fri, Jul 8, 2016 at 3:33 PM, Robson Ramos Barreto < >>>>>>> robson.rbarr...@gmail.com> wrote: >>>>>>> >>>>>>>> Hello Ben >>>>>>>> >>>>>>>> Thank you for your time >>>>>>>> >>>>>>>> I'm using this one: >>>>>>>> https://github.com/rrbarreto/ose-wordpress/blob/master/wordpress-template.json >>>>>>>> >>>>>>>> I see. So the files are being replaced when the PV is mounted >>>>>>>> because the image with the contents are created before, right ? >>>>>>>> >>>>>>> >>>>>>> right >>>>>>> >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> > Your goal should be to have an image that is immutable w/ respect >>>>>>>> to application logic. >>>>>>>> I'm newbie with openshift / docker so I'd appreciate very much if >>>>>>>> you could give me any example from how I can do that >>>>>>>> >>>>>>> >>>>>>> well that template creates an image that is immutable w/ respect to >>>>>>> application logic.. the template is defining a buildconfig which >>>>>>> produces >>>>>>> a wordpress image that includes the wordpress code as part of the image. >>>>>>> >>>>>> That's it. The template is creating the image with the wordpress code >>>>>> only to ephemeral volume. When I attach a persistent volume (as you can >>>>>> see >>>>>> in the template) the worpress code isn't being built in the image. >>>>>> >>>>>> My goal is deploy wordpress application with persistent volume and >>>>>> make autoscaling. >>>>>> >>>>> >>>>> If you want the actual code to live on a PV so that it is shared >>>>> between instances when you scale up, you will need to create your own >>>>> wordpress image in which the code is built into the image, but during >>>>> startup, the image copies its code into the PV location and then launches >>>>> wordpress using the PV code. >>>>> >>>> >>>> How could I to do this ? >>>> >>> >>> we do something similar in our jenkins image, the config is baked into >>> the image and then copied to the PV mount path during startup so the config >>> can be modified by the user and persisted, you can look to this example: >>> >>> >>> https://github.com/openshift/jenkins/blob/master/1/contrib/s2i/run#L37-L65 >>> >>> >> Hello Ben, >> >> I understood that the BuildConfig section you can't define persistent due >> it create a temporary container to inject the data into the image. >> >> So due this we must create the custom image with the data as you guided me >> >> What image strategy to create custom image would you recommend ? >> s2i or Docker ? >> > > It's really up to you. If you're comfortable with Dockerfiles (and don't > intend to build this image on openshift online, which doesn't allow docker > builds), you can do that. > > Otherwise you might be better off forking our existing php s2i builder > image and modifying the assemble and run scripts it includes to do what I > described with the code: > https://github.com/sclorg/s2i-php-container > > that means you're still going to do a docker build to construct your > forked version of the php-s2i builder, but then you can use an s2i build to > create your actual application images. > > You could also override the assemble+run scripts by simplying including > them in your source repo in the .s2i/bin directory, then you don't need to > fork+create your own php s2i builder. > > > https://docs.openshift.org/latest/dev_guide/builds.html#override-builder-image-scripts > > That will be useful =D
Thank you a lot > > > >> >> Thank you once again for your time. >> >> Regards >> >> Robson >> >>> >>> >> >>> >>> >>>> >>>>> >>>>> >>>>> >>>>>> >>>>>> >>>>>>> If you are interested in changing the wordpress code that's included >>>>>>> in the image, you should change what the buildconfig is building by >>>>>>> changing the code in the repository referenced here: >>>>>>> >>>>>>> https://github.com/rrbarreto/ose-wordpress/blob/master/wordpress-template.json#L75 >>>>>>> >>>>>>> That parameter is defined here with a default value: >>>>>>> >>>>>>> https://github.com/rrbarreto/ose-wordpress/blob/master/wordpress-template.json#L378 >>>>>>> >>>>>>> obviously you can't change the >>>>>>> https://github.com/wordpress/wordpress.git repository, so you'd >>>>>>> want to: >>>>>>> 1) fork the wordpress repo >>>>>>> 2) make your changes in your fork >>>>>>> 3) update the template to change the default parameter value to >>>>>>> point to your fork, or at least when instantiating the template, >>>>>>> explicitly >>>>>>> set the parameter value to point to your fork instead of accepting the >>>>>>> default parameter value. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> Thank you >>>>>>>> >>>>>>>> Regards >>>>>>>> >>>>>>>> Robson >>>>>>>> >>>>>>>> 2016-07-08 13:18 GMT-03:00 Ben Parees <bpar...@redhat.com>: >>>>>>>> >>>>>>>>> Not sure which wordpress image/example you're using since there >>>>>>>>> are two in there, but if you started from this one: >>>>>>>>> https://github.com/openshift/origin/blob/master/examples/wordpress/template/wordpress-mysql.json, >>>>>>>>> then the wordpress source lives in /opt/app-root/src within the image >>>>>>>>> and >>>>>>>>> since you're mounting a PV to that path, you're replacing the >>>>>>>>> /opt/app-root/src image content with the contents of your PV. >>>>>>>>> >>>>>>>>> Fundamentally that wordpress image isn't designed to have >>>>>>>>> /opt/app-root/src be a volume. >>>>>>>>> >>>>>>>>> If you want the source code to be on a PV so you can safely edit >>>>>>>>> it and have your changes persisted, you need an image that's going >>>>>>>>> to, on >>>>>>>>> startup, copy its source from a location within the image, to a >>>>>>>>> location >>>>>>>>> that you're mounting the PV at, and then run the source from that PV >>>>>>>>> directory. >>>>>>>>> >>>>>>>>> But in general that would not be a recommended pattern. Your goal >>>>>>>>> should be to have an image that is immutable w/ respect to application >>>>>>>>> logic. >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Fri, Jul 8, 2016 at 11:29 AM, Robson Ramos Barreto < >>>>>>>>> robson.rbarr...@gmail.com> wrote: >>>>>>>>> >>>>>>>>>> Hello Guys, >>>>>>>>>> >>>>>>>>>> I'm trying to deploy wordpress with persistent volume on >>>>>>>>>> openshift enterprise 3.2 (30 Day Self-Supported) as in the example >>>>>>>>>> [1] but >>>>>>>>>> the git files aren't being wirtten in the NFS path. MySQL is being >>>>>>>>>> deployed >>>>>>>>>> properly in the NFS persistent volume >>>>>>>>>> >>>>>>>>>> # ls -ld /exports/wordpress/mysql/ >>>>>>>>>> drwxrwxrwx. 5 nfsnobody nfsnobody 4096 Jul 8 10:35 >>>>>>>>>> /exports/wordpress/mysql/ >>>>>>>>>> >>>>>>>>>> # ls -lr /exports/wordpress/mysql/ >>>>>>>>>> total 88084 >>>>>>>>>> drwx------. 2 27 27 19 Jul 8 09:48 wordpress >>>>>>>>>> drwx------. 2 27 27 4096 Jul 8 09:48 performance_schema >>>>>>>>>> -rw-rw----. 1 27 27 2 Jul 8 10:35 mysql-1-ijptl.pid >>>>>>>>>> -rw-rw----. 1 27 27 2 Jul 8 09:48 mysql-1-1soui.pid >>>>>>>>>> drwx------. 2 27 27 4096 Jul 8 09:48 mysql >>>>>>>>>> -rw-rw----. 1 27 27 38797312 Jul 8 09:48 ib_logfile1 >>>>>>>>>> -rw-rw----. 1 27 27 38797312 Jul 8 10:35 ib_logfile0 >>>>>>>>>> -rw-rw----. 1 27 27 12582912 Jul 8 10:35 ibdata1 >>>>>>>>>> -rw-rw----. 1 27 27 56 Jul 8 09:48 auto.cnf >>>>>>>>>> >>>>>>>>>> # ls -ld /exports/wordpress/wp/ >>>>>>>>>> drwxrwxrwx. 2 nfsnobody nfsnobody 26 Jul 7 18:43 >>>>>>>>>> /exports/wordpress/wp/ >>>>>>>>>> >>>>>>>>>> # ls -lr /exports/wordpress/wp/ >>>>>>>>>> total 0 >>>>>>>>>> >>>>>>>>>> $ oc get pods >>>>>>>>>> NAME READY STATUS >>>>>>>>>> RESTARTS AGE >>>>>>>>>> mysql-1-ijptl 1/1 Running >>>>>>>>>> 0 44m >>>>>>>>>> wordpress-mysql-example-1-1clom 1/1 Running >>>>>>>>>> 0 41m >>>>>>>>>> wordpress-mysql-example-1-build 0/1 Completed >>>>>>>>>> 0 44m >>>>>>>>>> >>>>>>>>>> $ oc rsh wordpress-mysql-example-1-1clom >>>>>>>>>> sh-4.2$ pwd >>>>>>>>>> /opt/app-root/src >>>>>>>>>> sh-4.2$ df -h /opt/app-root/src >>>>>>>>>> Filesystem Size Used Avail Use% Mounted >>>>>>>>>> on >>>>>>>>>> 192.168.0.9:/exports/wordpress/wp 50G 11G 40G 22% >>>>>>>>>> /opt/app-root/src >>>>>>>>>> sh-4.2$ ls >>>>>>>>>> sh-4.2$ echo "Create file from pod" > teste.txt >>>>>>>>>> >>>>>>>>>> # ls -lr /exports/wordpress/wp/ >>>>>>>>>> total 4 >>>>>>>>>> -rw-r--r--. 1 1001 nfsnobody 21 Jul 8 11:21 teste.txt >>>>>>>>>> >>>>>>>>>> # cat /exports/wordpress/wp/teste.txt >>>>>>>>>> Create file from pod >>>>>>>>>> >>>>>>>>>> $ oc get pvc >>>>>>>>>> NAME STATUS VOLUME CAPACITY ACCESSMODES AGE >>>>>>>>>> claim-mysql Bound nfs-pv007 5Gi RWO 19h >>>>>>>>>> claim-wp Bound nfs-pv008 2Gi RWO,RWX 19h >>>>>>>>>> >>>>>>>>>> $ oc volumes dc --all >>>>>>>>>> deploymentconfigs/mysql >>>>>>>>>> pvc/claim-mysql (allocated 5GiB) as mysql-data >>>>>>>>>> mounted at /var/lib/mysql/data >>>>>>>>>> deploymentconfigs/wordpress-mysql-example >>>>>>>>>> pvc/claim-wp (allocated 2GiB) as wordpress-mysql-example-data >>>>>>>>>> mounted at /opt/app-root/src >>>>>>>>>> >>>>>>>>>> Template >>>>>>>>>> >>>>>>>>>> 172 spec: >>>>>>>>>> {¬ >>>>>>>>>> 173 volumes: >>>>>>>>>> [¬ >>>>>>>>>> 174 >>>>>>>>>> {¬ >>>>>>>>>> 175 name: >>>>>>>>>> ${APP_NAME}-data,¬ >>>>>>>>>> 176 persistentVolumeClaim: >>>>>>>>>> {¬ >>>>>>>>>> 177 claimName: >>>>>>>>>> ${CLAIM_WP_NAME}¬ >>>>>>>>>> 178 >>>>>>>>>> }¬ >>>>>>>>>> 179 >>>>>>>>>> }¬ >>>>>>>>>> 180 >>>>>>>>>> ],¬ >>>>>>>>>> 181 containers: >>>>>>>>>> [¬ >>>>>>>>>> 182 >>>>>>>>>> {¬ >>>>>>>>>> 183 name: >>>>>>>>>> ${APP_NAME},¬ >>>>>>>>>> 184 image: >>>>>>>>>> ${APP_NAME},¬ >>>>>>>>>> 185 ports: >>>>>>>>>> [¬ >>>>>>>>>> 186 >>>>>>>>>> {¬ >>>>>>>>>> 187 containerPort: >>>>>>>>>> 8080,¬ >>>>>>>>>> 188 name: >>>>>>>>>> wp-server¬ >>>>>>>>>> 189 >>>>>>>>>> }¬ >>>>>>>>>> 190 >>>>>>>>>> ],¬ >>>>>>>>>> 191 volumeMounts: >>>>>>>>>> [¬ >>>>>>>>>> 192 >>>>>>>>>> {¬ >>>>>>>>>> 193 name: >>>>>>>>>> ${APP_NAME}-data,¬ >>>>>>>>>> 194 mountPath: >>>>>>>>>> ${WP_PATH}¬ >>>>>>>>>> 195 >>>>>>>>>> }¬ >>>>>>>>>> 196 ],¬ >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Any help will very appreciate >>>>>>>>>> >>>>>>>>>> Thank you >>>>>>>>>> >>>>>>>>>> [1] >>>>>>>>>> https://github.com/openshift/origin/tree/master/examples/wordpress/ >>>>>>>>>> >>>>>>>>>> Regards >>>>>>>>>> >>>>>>>>>> Robson >>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> users mailing list >>>>>>>>>> users@lists.openshift.redhat.com >>>>>>>>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Ben Parees | OpenShift >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Ben Parees | OpenShift >>>>>>> >>>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Ben Parees | OpenShift >>>>> >>>>> >>>> >>> >>> >>> -- >>> Ben Parees | OpenShift >>> >>> >> > > > -- > Ben Parees | OpenShift > >
_______________________________________________ users mailing list users@lists.openshift.redhat.com http://lists.openshift.redhat.com/openshiftmm/listinfo/users