Wordpress bash scaffolder script

Before using DevKinsta, I was using Laragon. I would like to find a similar approach. I’m still on Windows.
To create a new site from Laragon with WP CLI, here is what I could do:

  • create a new folder (Laragon would detect this new folder and generate a new vhost)
  • launch an install.sh script sh install.sh which launched the installation of wordpress, generation of the wp-config file, installation of a list of plugins, update of options (deactivation of comments, date format, post_per_page, etc …)

I would like to be able to launch this type of script:

wp core download --locale=en_FR --force
wp config create --dbname=$db_name --dbuser=root --dbpass="" --dbprefix=$db_prefix --skip-check --extra-php
wp db create
wp core install --url=$site_url --title="$site_title" --admin_user=$admin_user --admin_email=$admin_email --admin_password=$admin_user_password
wp plugin install plugin-1
wp plugin install plugin-2
rm -rf wp-content/themes/twenty*
rm wp-content/plugins/hello.php
rm -rf wp-content/plugins/akismet
wp plugin activate --all --quiet

Is it currently possible to create a wordpress site without going through the devKinsta interface? If I create a folder and a wp-config file, how do I find it in the kinsta interface ?

How to launch a .sh script ? Currently I need to connect to the docker container to be able to do this and I don’t know where or how I should put and launch the script.

If the quick creation by script.sh is not possible how to launch at least the sh script without the wordpress/database creation/installation, just for the options update and the plugins installation?

Another question, how to make quick commands to connect to containers and save time?

  • docker exec -u www-data -it devkinsta_fpm bash => kinsta-fpm
  • docker exec -it devkinsta_db bash => kinsta-db

Hello @DavidH :wave:

I will try to answer your questions as follow:

Is it currently possible to create a wordpress site without going through the devKinsta interface? If I create a folder and a wp-config file, how do I find it in the kinsta interface ?

I don’t see a way/method to create a WP site manually without going through the DevKinsta interface - and then to see that WP site created manually in DevKinsta interface.

Yes, in order to execute that WP CLI (for example to install WP plugin), you can put the commands in a .sh script then execute it through the docker container ( devkinsta_fpm ).

So for example, you may want to do the following:

  1. Create a scripts.sh file (with text editor) inside this folder, let’s say:
    C:\Users\youruser\DevKinsta\public\sitename

  2. Put the WP CLI into that scripts.sh file (with text editor for example)
    you may want to put something like these to test:
    wp plugin install plugin-name-here
    wp plugin activate --all --quiet

  3. connect to your devkinsta_fpm docker container:
    docker exec -u www-data -it devkinsta_fpm bash

  4. once connected in that devkinsta_fpm docker container, you can type:
    cd /www/kinsta/public/sitename
    In this folder, you will see that scripts.sh file you just created before

  5. You can then execute that scripts.sh file with:
    sh scripts.sh
    this will run those 2 WP CLI commands saved in that script.sh file above.
    Note:
    If you add this line rm -rf wp-content/themes/twenty* in that script.sh, it will be executed as well, and will remove those themes folders/files (e.g.: twentytwenty/ twentytwentyone/ twentytwentythree/ twentytwentytwo/)

For this one:

Another question, how to make quick commands to connect to containers and save time?

  • docker exec -u www-data -it devkinsta_fpm bash => kinsta-fpm
  • docker exec -it devkinsta_db bash => kinsta-db

You can create a .bat file on your local computer (Windows) which contains that docker command.
For example, you can create a new batch file and name it as: kinsta-fpm.bat
then edit that kinsta-fpm.bat file and add the following lines in it (and save it):

@echo off
docker exec -u www-data -it devkinsta_fpm bash

after that, from the windows CMD / dos prompt, if you run that kinsta-fpm.bat , then it will execute that docker command line.

Like this (see the screenshot) I took on my Windows machine:

Hope the above answers would help :slight_smile:

Cheers,
Agus

Thank you I’ll try to put it all together

You’re most welcome David! :smiley:
Sounds good! please take your time and see if those work as expected!

Cheers,
Agus