Using standard WordPress structure with Trellis

I’m trying to setup my local environment with trellis.

I was able to setup two website if they follow the same structure, but wonder if it is possible to add for example WordPress install with standard structure. Or any other PHP site for that matter.

I understand that might be not the intended use, but wonder if there’s easy way to do so.

All I really need is to setup the websites by adding the folder containing website and import existing database.
So, ideally, I would like to add new folder, drop files into it, put sql file, and write couple of setup files, and as a result get the file created for domain in nginx config, get host setup, and database copied to mysql, if database does not exist.

You should be able to re-use a lot of the roles for the standard php sites but it’s not something we’re ever likely to support. You should look through Ansible Galaxy for roles that might be of help.

I would strongly recommend against using a default WordPress install. Bedrock offers so many advantages it would be far better to port the existing site to Bedrock rather than duplicate a lot of Trellis to support something that is worse by a considerable margin.

Thanks Nick,

I did convert one website to new structure, moved plugins, theme, and uploads to app folder.
I also figured the way to load the database dump (though was not able to use database file in the site’s folder), so ended up loading it from trellis folder. Still can’t get to admin, because it is forced to https and then returns 404… Needed to disable https plugin, to get all the resources to load, and diable ssl in wordpress_sites.yml to get front end to work, but still no luck with backend, something redirects to https.

Back to my question though, if there would be easy to include “Standard_wordpress_sites” , and maybe substitute just a wp-config.php files it would make my life easier. Not mentioning migrating couple static websites, couple joomla webstites, and some Code Igniter and node utilities…

But I do understand that for that I would need to dig deeper into Ansible and this has nothing to do with Trellis.
Just wondered if someone had already collected all the needed pieces. I guess will need to search Ansible for options.

So if you didn’t want to do a lot of customization to trellis but you just needed to add standard setup wordpress sites and non-wordpress php based sites to a trellis server it’s pretty easy. I have done both things in a pinch, had to migrate a clients existing wordpress site from a hacked server with no time to port it over at that moment. Or moving over a new clients old php site to our hosting while we developed their new site.

What I did was add the site into the wordpress_sites.yml kind of like it was a bedrock based site. You need to enter in at least all the required fields, even if they don’t get used for anything, just make up random stuff it doesn’t matter. Something like this…
    branch: regular-php-needs-love-too-branch
    www_redirect: true
    db_create: false
      enabled: false
      subdomains: false
      enabled: false
      enabled: true (you can still use the php fast cache, it has nothing to do with bedrock)
      duration: 30s
      disable_wp_cron: false (this is important you don't want to run a needless cron)
      wp_env: production

Now run the production playbook like any other normal day. This creates in log folders, sets up log rotation, sets up the nginx config for the site with cache if you want. Sets up the main site root folder, everything except for deploying the site.

Now you SSH into the server manually or SFTP if your feeling nostalgic and want to break out filezilla because you miss it. Or be even cooler and use an online IDE like Cloud 9

Now get to /srv/www/ and manually create the folders current/web/ so when your done you have /srv/www/

Drop your site at the end there so anything after the web/ becomes the webroot for the site your uploading then you may have to do a little minor debugging depending on what your working with for a website but I found most stuff works without any edits to the /etc/nginx/sites-available/ file.

Just make sure anything you upload retains the correct permissions and ownership (default is user web group www-data)