2016-07-08 16:45 GMT-03:00 Ben Parees <[email protected]>:

>
>
> On Fri, Jul 8, 2016 at 3:33 PM, Robson Ramos Barreto <
> [email protected]> 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 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 <[email protected]>:
>>
>>> 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 <
>>> [email protected]> 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
>>>> [email protected]
>>>> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>>>>
>>>>
>>>
>>>
>>> --
>>> Ben Parees | OpenShift
>>>
>>>
>>
>
>
> --
> Ben Parees | OpenShift
>
>
_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to