Jump to content

ProcessWire and Continuous Integration


hettiger
 Share

Recommended Posts

I'm using GitLab CI for continuous integration right now. Other people might use something like Travis CI. For the frontend part things are pretty easy:

image: node:6.10.3

cache:
  paths:
    - node_modules/

build:
  script:
    - npm install
    - node_modules/.bin/gulp build

Now I could extend my setup to run tests or whatever I want. It just works.

In this post I'm not interested into finding out how I could go about testing and stuff. I just want to know how I could accomplish the equivalent to the above setup task for ProcessWire. It doesn't seem to be too easy to me since the installation process is running in the browser asking you a lot of stuff. How could I go about it using the CLI?

That's what I currently have:

git clone git@github.com:processwire/processwire.git
cd processwire
mv site-blank site
rm .gitignore
git submodule add -b develop git@gitlab.local:path/to/MyModule.git site/modules/MyModule

From here on I'm stuck.

The only possible solution I see is maintaining a super repository including a database dump that has it's module dependencies defined in a .gitmodules file. This could then be installed using:

git clone --recursive git@...

Once that's completed all that needs to be done would be to create the database using the dump.

Probably that's a pretty solid solution but it adds the overhead of having to maintain an additional repository +  database dump. I'm trying to find an alternative that's using the original processwire repository. That way I could just rerun my build once a new version get's merged into master and see if everything would be still working as well.

I'm looking forward to your replies. Thanks! :-)

Link to comment
Share on other sites

45 minutes ago, LostKobrakai said:

ProcessWire is missing a CLI installer for a long time. You might want to take a look at how wireshell or tense did handle the task of automating installs.

Edit: And starting from an base install you could easily bootstrap things further with my Migrations module.

Thank you @LostKobrakai

for sure I'll have a look at these! Do you consider your Migrations module somewhat stable yet? (Even thought there's still the beta flag) I've already had a look at it the day you published it but didn't consider it for actual real world projects yet because it was brand new :-)

Link to comment
Share on other sites

I was just doing something similar the other day and managed to get the latest PW installed with one command.

Requirements are to have the latest version of Wireshell installed globally via composer. 
(idea - maybe wireshell could be packaged into a distributable Phar file to make this even easier…)

You then need a database and user setup (or just a database user that is allowed to create databases)

To create a new PW install with a blank profile in the current directory run this long command with your own details:

wireshell new . --profile=blank --dbUser=yourDBuserName --dbPass=yourDBuserPassword --dbName=yourDBname --timezone=Europe/Zurich --httpHosts=yourHostName --username=yourPWadminName --userpass=yourPWadminSecurePassword --useremail=yourEmail.com

(idea - maybe these details could be loaded from an external config file for easier CI workflow / setup…)

After this you could import fields and templates via Wireshell and I’ve not tested this but on the wireshell forum thread someone mentioned that you can also load templates / fields via a separate json files. 

Link to comment
Share on other sites

On 5/23/2017 at 7:02 PM, Michael Murphy said:

I was just doing something similar the other day and managed to get the latest PW installed with one command.

Requirements are to have the latest version of Wireshell installed globally via composer. 
(idea - maybe wireshell could be packaged into a distributable Phar file to make this even easier…)

You then need a database and user setup (or just a database user that is allowed to create databases)

To create a new PW install with a blank profile in the current directory run this long command with your own details:


wireshell new . --profile=blank --dbUser=yourDBuserName --dbPass=yourDBuserPassword --dbName=yourDBname --timezone=Europe/Zurich --httpHosts=yourHostName --username=yourPWadminName --userpass=yourPWadminSecurePassword --useremail=yourEmail.com

(idea - maybe these details could be loaded from an external config file for easier CI workflow / setup…)

After this you could import fields and templates via Wireshell and I’ve not tested this but on the wireshell forum thread someone mentioned that you can also load templates / fields via a separate json files. 

Thank you Michael, that's exactly what I was looking for.

My module is already creating it's fields / templates etc. itself during install using the existing ProcessWire API which works amazingly.

I should be up and running pretty quickly ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...