Please explain persistent disks more with Wordpress as an example

  • I want to set up Wordpress with the Woocommerce plugin
  • I then want to add products which have images and other data, and these images go under the wordpress director eg. /wp-content/uploads/
  • I am new to these new type of hosting services like Render as I am only familiar with VPS setups
  • Now my question is…I understand these deployments work with my github repo, and if I need to make a new change, I push it to the repo and Render detects the change and rebuilds the site
  • But what if I need to upload an image in Wordpress, how will it store the image if I am not pushing the image via git? Maybe I can push the plugins via git but if I need to add a product and add the image…I have to push the image via git? This sounds…wrong…or I am missing something here.

Can someone please clarify?

Hey there

We have an example of how to install and use Wordpress on us located at Deploy WordPress | Render Docs this uses the official Wordpress Docker image and provisions a web service with disk and a mySQL service, I will highlight that “as is” it would cost $50 per month based on the 2 Standard instance types it uses.

Being based on a Docker image, key to this setup is having a disk mounted to /var/www/html so when the Docker image starts, the Docker image detects that Wordpress is not installed in the path and then installs it - you’ll see this in the

==> Deploying...WordPress not found in /var/www/html - copying now...Complete! WordPress has been successfully copied to /var/www/html

so if you then use shell or ssh to access the service you’re dropped right into the folder

So from this point, you can treat it much like any other Wordpress install - uploads etc are all put to wp-content/uploads and it just works - you can install updates, plugins, themes etc

No Git involved, just remember - as it’s not managed mySQL you have to make sure you’re taking a backup of it yourself,

Regards

John B
Render Support, UTC+1 :uk:

Hi John,

Thank you. But what if I do want git involved for updating theme fles eg. functions.php etc etc. I would like to push that to the repo and Render rebuilds the website. But the current method doesnt seem to have any wordpress files in the repo, even if I do the deployment manually where I fork the wordpress example repo Render mentions. How can I modify the deployment tutorial where I can push my themes and updates to them to my repo, triggering the site rebuild. Right now I have a demo site up using the manual deploy but there is nothing new in my repo other than what I forked.

FROM wordpress:5.3.2-apache
RUN usermod -s /bin/bash www-data
RUN chown www-data:www-data /var/www
USER www-data:www-data

Should I change it to this?

FROM wordpress:5.3.2-apache
RUN usermod -s /bin/bash www-data
RUN chown www-data:www-data /var/www
USER www-data:www-data
RUN rm -rf /var/www/html/*
COPY . /var/www/html
RUN chown -R www-data:www-data /var/www/html

The tutorial and our example use the official Wordpress image so their documentation about its usage applies here https://hub.docker.com/_/wordpress

We mount a single volume to /var/www/html so that on initial deployment, the image copies Wordpress into those paths, from that point on, any updates, themes, plugins, etc are all written to that mounted disk.

If you jump to this part of the docs https://hub.docker.com/_/wordpress#:~:text=Static%20image%20/%20updates-via-redeploy they talk about how you can use the COPY directive to copy themes etc into the install. However, this won’t work as the disk isn’t mounted during build time, it’s only mounted at runtime, so even though the COPY operation would run, once the disk is mounted the files that were copied aren’t available.

It seems like the approach you want to take is at odds with the Docker image deployment of Wordpress. You obviously always need to have /var/www/html/wp-content/uploads using a Disk as that’s where the user uploads go to, but there are other files that Wordpress modifies for settings/configuration etc. I’m afraid I don’t know enough about Wordpress to be able to advise you on how to achieve what you want here.

John B
Render Support, UTC+1 :uk:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.