Before deploying a Wordpress website, the following general things are needed:
git@awan.io:TEAM/APP_NAME.git
After these prerequisites are present, the following 5 steps need to be taken to deploy the application to Awanio: 1. Create database resource 2. Download, extract and configure Wordpress 3. Add the awan.yml configuration file to the project 4. Initialize the Git repository and add awan as Git remote 5. Deploy to Awanio 6. Configure and enjoy Wordpress!
Resources
and click on ADD RESOURCE
.wordpress-db
, set the resource to mariadb:xx.x
and select the required instance type (we advice to use a minimum of 512 MB RAM, 1 vCPU).CREATE
and select the created resource from the list. SET VARIABLES
. In the popup enter the environment variables as noted from the resource page in the following format:MYSQL_DATABASE=database_name
MYSQL_USER=user_access
MYSQL_PASSWORD=db_password
MYSQL_HOST=db_host
MYSQL_PORT=3306
Download the latest wordpress from this page https://wordpress.org/latest.zip. Then extract the package in a folder, we named ours wordpress-site
. The folder should now at least contain the following items:
wordpress-site/
wp-admin/
wp-includes/
wp-config/
wp-config-sample.php
index.php
Rename the wp-config-sample.php
file to wp-config.php
. Open the wp-config.php
file and edit the following sections:
$dbName = getenv('DB_NAME') ?? 'wordpress';
define('DB_NAME', $dbName);
/** MySQL database username */
$dbUser = getenv('DB_USER') ?? 'root';
define('DB_USER', $dbUser);
/** MySQL database password */
$dbPassword = getenv('DB_PASSWORD') ?? '';
define('DB_PASSWORD', $dbPassword);
/** MySQL hostname */
$dbHost = getenv('DB_HOST') ?? 'localhost';
define('DB_HOST', $dbHost);
Still in the wp-config.php
file, please edit the Authentication Unique Keys and Salts section. This is important to increase the security of your Wordpress application.
define('AUTH_KEY', 'CHANGE_THIS_VALUE');
define('SECURE_AUTH_KEY', 'CHANGE_THIS_VALUE');
define('LOGGED_IN_KEY', 'CHANGE_THIS_VALUE');
define('NONCE_KEY', 'CHANGE_THIS_VALUE');
define('AUTH_SALT', 'CHANGE_THIS_VALUE');
define('SECURE_AUTH_SALT', 'CHANGE_THIS_VALUE');
define('LOGGED_IN_SALT', 'CHANGE_THIS_VALUE');
define('NONCE_SALT', 'CHANGE_THIS_VALUE');
All applications in Awanio use SSL termination. This means from user to cloud balancer data transfer via https. While from the balancer to your application, the communication line uses http. This will cause an issue because Wordpress will assume the application is run via http. For that, please add the following two variables under the WP_DEBUG constant setting in the wp-config.php
file
if($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = 443;
}
Awanio requires the awan.yaml configuration file in the root of the repository, in the wordpress-site
folder. Create the awan.yml
file in the main (root) folder. Paste the content in the awan.yaml
file, check out the reference for more options:
version: '1.0'
web:
type: php
version: 7.1
doc_root: ./
storage_dir: /code/wp-content
Initialize the Git repository if you haven't done it before by executing this command within the wordpress-site
folder:
git init
Add Git remote Awanio to the project:
NOTE: modify the command by using your own TEAM and APP_NAME.
git remote add awan git@awan.io:TEAM/APP_NAME.git
The application is now ready for deployment, use the command to commit everything and to push it to Awanio:
git commit -a -m "Deployment v1.0"
git push awan master
After the deployment is complete, please check your website at https://app-name.onawan.eu. Now configure your website as usual.
NOTE: modify the URL by using your own application URL.