dsmHack / event_scripts

Scripts to help automate things for the main hack event.
MIT License
1 stars 3 forks source link

Wordpress local dev setup #3

Open crolek opened 6 years ago

crolek commented 6 years ago

Please see the CONTRIBUTING.md

Create a script that automatically invites users to the services. Please any work in a sub-folder under the following participant_onboarding

The problem:

Developers have all kinds of setups, OSes, admin rights (or not sometimes) on their machines. Trying to standardize the development as much as we can will help teams get going faster. Most non-profits use Wordpress, so targeting that type of development will get us the most help initially.

Potential Solution:

A Wordpress Docker dev container. Put all the resources in a container for the developers to use. Even having a blank version of Wordpress in it would be a good idea (this can be updated manually each season). The idea would be that the participant could just volume mount a local folder into the container. Then access the wordpress site via one of the exposed container ports.

If you have another solution please propose it. The key factor is to lower the bar to using Wordpress as much as we can.

Output:

ultimav commented 6 years ago

So something like https://hub.docker.com/r/_/wordpress/ and directions and how to easily spin it up, once docker is installed?

crolek commented 6 years ago

Yes, exactly. One things I'd like to try and have in the instructions is how you'd point to a remote database or a local one (if they had to separate from the team for a little bit). To be more specific, I'd like to instruct them how to connect to the local network's mysql server with the credentials that the organizing team gives them.

Basically try to get wordpress/*AMP setups out of the way and so the developers can just write some php/css/js.

ultimav commented 6 years ago

So even better

For macs we could use a modified version of this https://github.com/thoughtbot/laptop to setup things in one shot for developers ( or switch between a local and remote dbs).

I saw in a old msg, that we had though about setting up a shared RDS for cloud DB staging if bandwidth was ok.

For windows I think we could throw together a chocolatey script to do the same.

dragon788 commented 6 years ago

Our team used a Vagrant box that internally provisioned the full stack with Ansible as well as some nice bits like Mailcatcher for viewing emails triggered by the system. I believe it was http://vccw.cc and it worked great for fast setup and testing changes though it was hard to merge the changes due to how WordPress handles changes. We also used a migration tool to backup and restore the client site for local hacking.

cat5inthecradle commented 6 years ago

For Mac and Unix, I'd go docker for this, but there's going to be a Windows box or two on every team and that can be tricky. Even using docker there are so many ways to setup a local wordpress environment. Some of it depends too on how you're going to work with the client's data. That leads me to a couple of supplementary guides that we might want:

  1. How to take a file backup of a wordpress site (and stick it into github)
  2. How to take a database backup of a wordpress (and mount it in a mysql docker container or get it into the shared mysql server)

Vagrant, Docker, M/W/LAMP are all viable, and if people made guides for all of them that would be awesome. Simplicity and approachability should be key. It wouldn't hurt to also aspire to teach people through these guides a little bit about web development.

crolek commented 6 years ago

@DanaWork would the idea be that we setup one laptop with the configuration that we think is "correct" and then send them the "laptop" file?

@dragon788 I dont' know if I've seen that one before, but it does look promising. For the migration tool. Were you able to basically feed it the mysql or the wordpress admin info and it auto-pulls down the db and any php files you need?

@cat5inthecradle A backup of an existing wordpress site is definitely a guide we need to make. Do you want to make a README.md and to take that one on?

dragon788 commented 6 years ago

You just install the plugin and perform an export (to file is free, all the other options are paid plugins, but they may also allow scheduling I believe). Then on the new hosting provider and/or local dev environment you install the plugin and import, and it resets the entire site using the current site's URL (handles the migration for you) and voila, you have a full copy of the site and all its content.

The one caveat if you have a HUGE site is that backups over 512MB require a license to restore, but a workaround offered by a Wordpress static site hosting provider is to backup everything except your media, as you can typically perform a cross site media import apparently?

crolek commented 6 years ago

We might be able to see if we can get an organization license so we can just do full backups.

dragon788 commented 6 years ago

That would be sweet, or if they offer a non-profit discount, though many WP Plugin developers don't have a complex enough billing system to handle that kind of thing.