Configure and manage word press sites using Forge

I often claim that I know nothing about servers. Moreover, although I am not an expert, as a web developer, I have learned a lot over time. I use Ubuntu every day as the virtual machine operating system that hosts the desktop operating system and the WordPress website. I’ve learned a lot, but without help, I can’t set up my own server or actual VPN (virtual private server). However, you are already familiar with laravel forge, a server configuration and deployment tool created by the easy to learn laravel project. It was designed primarily for the laravel project I originally used, but it works well in all PHP applications, including WordPress. The
In this article, a new calderaforms was recently created using the composer and WP starter projects. This paper introduces the reasons and methods for building and deploying com, and uses forge to set up a server on AWS. Why forged? Forge provides two main functions in Amazon, digital ocean or similar automated deployment, namely, automatic configuration of VPS. There are many other products that offer one or both of these services. For example, easy engine provides automatic configuration of VPS in the digital ocean of word press, and deployhq provides similar automatic deployment. I’ve used both before. They’re great. The
I recently started forge to manage several of the laravel applications I built. In addition, paying $10 a month helps support open source projects. I want to use plug-ins, themes, and word press to manage all dependencies on local and live sites in order to restart the caldera forms site. So I think it is a tool for configuring and deploying PHP applications, so it will work well in WordPress. And it did. Why WP starter? In fact, we first built a local site using WP starter of the we code more WordPress developer group. Wpstarter was mainly written by Giuseppe mazzapica. I have used several different common tools with composers to manage WordPress, including myself. The
Wpstarter is in configuration. I like the env variable because its setup is very simple. In addition, composer automatically loads, moves the content directory outside the default WordPress directory, and the appropriate index to work with this setting. Handles the creation of PHP and WP config files. It also records well. Wpstarter also has some wonderful tricks that have never been seen before. We will discuss this in the next section. The biggest reason I chose wpstarter is that it is a pure PHP system. There is no need to write anable or puppet scripts. It’s inconvenient not to know how to modify the script. Therefore, we are trying to automate all tasks written in PHP or JavaScript. In addition, for configuration. Env makes setting to forge very easy. The
What are environment variables? WordPress uses many constants to define the configuration. For example, in WP config, the database configuration is defined using constants. As a result, WP config sensitive information is stored in the entire stack of the site, not necessarily open source. WP config also depends on the environment. Both of these concerns violate the principles of the twelve factor app. Scott walkinshaw uses the twelve factor methodology to build a better WordPress stack, forming the foundation for roots berrock and subsequent trelis projects
I first came across this philosophy when I released the ordpress application. The
In a series of posts, I was introduced as an environment variable. They are variables that applications can use (set on the server). If you use references to server environment variables, the configuration of the application will no longer be associated with the environment. When used in WP config, the file will no longer store sensitive information. Phpdotenv gives you easy access to PHP environment variables. This package is used for WP starter, berrock, trelis, and laravel. Simple. You can use the env file and this package to load variables into the $\u env super global. The
Before setting up locally, let’s take a look at the process of building a local site using composer and WP starter. I configured the new website with vv. You can use the required local environment. It doesn’t really matter. If the local site is configured, the composer. JSON file is required. A good start includes: The{
\
\
\
Repository:[
The{
\
\
},
The{
\
\
},
],
\
\
\
\
\
},
\
\
},
\
\
Auto load optimization: true
},
Script:{
\
\
\
},
\
\
\
\
\
\
},
\
\
\
\
],
\
\
\
\
\
\
\
\
\
Sitemap.Xml
\
]The
}The
},
Setup path:{
\
\
],
\
\
],
\
\
]The
}The
}The
}Some of them are not very common, so let’s discuss them. This may seem normal at first, but it is worth noting that the gist file is used as a repository. Before using wpstarter, I didn’t know I could do this, but I could. The file in GIST will load the object cache and place the sample later. Used to create env files, etc. The
For example, wpackagist. Several plug-ins imported from org are pre populated with the require and require dev sections. Query monitor contains development requirements, so it will be installed on the local site, but not on site. In the configuration section, the path of the vendor directory will be moved to the WordPress content directory. This is useful for organizing in word press. The installation script provided by wpstarter is specified below. I repeat, I like that all this is done using PHP scripts. I do not need to modify the script, but if necessary, it is PHP, so I am confident to do so. The
Here are some additional sections that contain a lot of interesting content. In addition to the installation path settings described in the previous torque article, all configuration options for wpstarter are set. Although you can read the documentation for more information, one thing I think is cool is the way you can construct drop-down menus. The prefabricated composer I showed you JSON specifies the object cache placement to use. Before proceeding, there may be other plug-ins and composers. You must add a theme to JSON. Composer After setting JSON, switch from the terminal to the project directory and run \
In the project. Env The example file is displayed. Name. Change to Env. This file contains all the configuration options required for the word press site and has been documented. You can see everything here Open the env file and view the section near \
Gaida
Now, if all goes well, the WordPress site must run locally. You can also submit all the content to the GIT repository of the site and publicly host the repository. Your sensitive information is not stored in the repository. In addition, it has no affiliation. The plug-in or word press update will change to a single line. If there are other developers working on the project. They replicated the repository and used their own local database. You can set up env files and prepare for work. After the server is set to run the local site, a compatible distribution system is required. For this purpose, we use laravel forge. The servers they have configured include PHP 7, mysql, Memcache and composer. It is very easy to configure the system by connecting to Amazon or digital ocean accounts. You can also add SSL certificates or very simply let’s encrypt. To start, create a forge account and log in. On the server page of the account page, you can provide digital ocean, linode, or AWS credentials and verify the connection. Then navigate to the server page and select the server type. In my case, use Amazon to set the server name, size, and PHP version. At the time of writing this article, three versions of PHP (5.6, 7.0, 7.1 β) can be used. Then click Add server. It will take some time. Go and buy some more coffee. Male forge recently added the WordPress option, but I still recommend the laravel\/php option. WordPress options are designed for simple WordPress sites rather than using WordPress applications or appropriate dependency management. After configuring the server, navigate to the configuration page of the server, and then navigate to the MySQL tab, which is used to add new database tables and users to the table. Ensure that you can easily keep the SQL user’s password. Once created, return to the sites tab and create a new site. After the new website is created, the administration screen will prompt you to attach the GIT repository. From my experience, this is very smooth with bitbucket. To connect to GitHub, you need other steps, but follow the instructions. After connecting to the repository, navigate to the environment tab and click the edit.Env button. Well, the application’s. A pop-up window opens that allows you to modify the env file. Preset for laravel, not very useful. Fortunately, wpstarter’s. Env It can be based on the example file. You must use the MySQL details set for this server. Save when finished. Now, the last step is to modify the deployment script. I repeat, the default values are created with laravel in mind. For example, by default, the deployment script invokes the craftsman command. Artisan is similar to wpcli, but is used for laravel. The following is for my deployment script. CD \/home\/forge\/default
If[-b \
Then.
RM public \/index. PHP
Pie
Git pull origin master
Update composer –no-interaction–no-dev–preference-dist this is a standard bash script. You can customize it according to your needs. Wpstarter is the new index. Since the PHP file was created, we decided to delete the existing file from the deployment script first. Solved the problem that caused the second deployment failure. Then get the changes from the GIT repository and run composer. Plan to install wpcli in the future. Forge sends SSH key to server
Provides an easy way to add to. Wpcli can then be used as part of the deployment process. If a deployment script exists. Deploy and move. However, to set up SSH, you must click the SSH tab. Adding an SSH certificate using letsencrypt requires several clicks and minutes. HTTP to HTTPS redirection is handled automatically. If necessary, you can also add your own certificate. If everything is set up, click distribute. One is that forge only warns of failed deployments. There is no correct indication. I’ve connected forge to my slack channel to send all notifications. Only in this way can forge do more. You can also configure cron tasks, perform automated deployment, and build a load balanced server network. Know what you can do. I know. In most cases, my site is on a managed WordPress host because it makes my life easier. However, there are some tradeoffs, especially in terms of tools. Because a simple method is needed to create laravel applications in real time, using forge, which is already in use, can make it easier for people who do not actually use the server to configure VPS and set up reasonable deployment. I hope this article has a more detailed understanding of how to use this wonderful tool and composer, and learned the wonderful reasons for using environment variables.

Author:

Leave a Reply

Your email address will not be published. Required fields are marked *