Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Getting Started With WordPress and Che

DZone's Guide to

Getting Started With WordPress and Che

Eclipse Che was built with the goal of simplifying project configuration in mind. The most recent release boasts rich PHP and database features that make Che the perfect solution for WordPress development. In this post, we will walk you through some of the basics of using Che with WordPress.

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

Eclipse Che was built with the goal of simplifying project configuration in mind. The most recent release boasts rich PHP and database features that make Che the perfect solution for WordPress development. In this post, we will walk you through:

  • Setting up Che
  • Importing a WordPress Project
  • Starting Your MySQL Server
  • Running Your Project
  • Saving Your Workspace

Get Started With Wordpress and Che

Create a new Wordpress project with a dedicated database.

1. Start Che

/bin/che run

### Open browser to:
http://localhost:8080

If you do not have any projects in Che, you'll be redirected to a startup page to create a new project.

2. Import a Wordpress Project

Click New Project and import a Wordpress repository and set up the right environment for it.

Select Source

Let's import WP from an official WordPress GitHub repo

Select Stack

Che offers a certified PHP image with Apache2, MySQL, git, curl and a number of popular PHP extensions. Dockerfile

Configure Workspace

Give your workspace a nice name and configure RAM, i.e. apply the memory limit to a workspace machine.

Create the Project

Select Create Project. The project construction process goes through a number of steps including creating a new workspace, downloading an image to use for the workspace environment, instantiating that environment, installing Che services into the workspace, and then creating your project.


Click the Open in IDE button to open your project in the IDE.

3. Start MySQL Server

After the project is successfully created, you can start MySQL server either in the terminal (you can find it on the Consoles panel and open it by clicking + button) or using a command widget (CMD) - sudo service mysql start.

We have already created a sample DB in the base image:

ENV CHE_MYSQL_PASSWORD=che
ENV CHE_MYSQL_DB=che_db
ENV CHE_MYSQL_USER=che

You may verify that the DB is there and MySQL is running: mysql -u che -p che.

4. Run Your Project

Let's start Apache server. You can do that in the terminal, however, using a Commands Widget is a better option. Go to CMD > Edit Commands… menu, click + button at Custom section and paste your command name, command itself here.

Here are some commands that you may use: 

# Apache start
  sudo service apache2 start && sudo tail -f /var/log/apache2/access.log -f /var/log/apache2/error.log

# Apache restart
  sudo service apache2 restart

# Apache stop
  sudo service apache2 stop 

Preview URL is another important object. It will be http://${server.port.80}/${current.project.relpath}.

${server.port.80} returns host and port, while ${current.project.relpath} will be interpreted as a relative path to your project (relative to /projects which is DocumentRoot for Apache in this environment).


Run Apache, click the preview URL and find your WordPress project started there. Follow the WordPress guide to start your first site.


You will be prompted to connect your MySQL database (see details above). You can also connect an external database.

A few steps to install WP and voilà, it’s done.

5. Snapshot Workspace

The last step is to save your workspace.

Go to Machine Perspective, choose Machine > Create Snapshot. It will create a new image which will be used to load the workspace based upon the current contents of the environment.

Note, that snapshot images are stored in a Docker registry. You should set up Docker registry on your local machine first, or use an external registry. Find more info in our Node Tutorial.

To download Che, find more technical documentation, or to learn more about the all-new Eclipse Che and how Che works, please visit eclipse.org/che.
Download | Contribute | Docs | Features

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

Topics:
wordpress ,php ,cloud ,ide ,text editors ,agile adoption ,docker

Published at DZone with permission of Tyler Jewell, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}