This is a port of Hermo ecommerce system to Woocommerce. This application is designed to work with AWS Elastic Beanstalk.
Deployment is made via bitbucket only triggered via the branch master
(see bitbucket-pipelines.yml
).
For development, name your branch dev-*
and you can deploy to staging environment, provided the environment is active in AWS Elastic Beanstalk.
- You'll need nginx/apache that points to this code.
- Point your database to
runa-alpha
with the database nameshopx_production
- Read more below on setting up the environment variables.
- Example nginx config with Basic Auth implemented (auth is optional):
server {
listen 80;
server_name shop.hermo.my;
return 301 https://shop.hermo.my$request_uri;
}
server {
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/shop.hermo.my/shop.hermo.my.crt;
ssl_certificate_key /etc/nginx/ssl/shop.hermo.my/shop.hermo.my.key;
server_name shop.hermo.my;
root /var/www/shopx;
index index.php;
auth_basic "Exclusive Members";
auth_basic_user_file /var/www/shopx/.htpasswd;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fixes timeouts
fastcgi_read_timeout 600;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
This is a customized wordpress designed to work with S3, Beanstalk and Cloudfront. Here's some notes:
wp-content/uploads
is ignored since it is being managed by S3 and Cloudfront- Assets uploaded will be available at https://media.hermo.my/wp-content/uploads/*
- Product images should be uploaded to https://media.hermo.my/shopx/* using the S3 Media Manager
- For local development, a yesterday snapshot of the database is available in
runa-alpha
everyday. - Make sure to create a
.env.php
file with these values:
$_SERVER['DB_NAME'] = 'x';
$_SERVER['DB_USER'] = 'x';
$_SERVER['DB_PASSWORD'] = 'x';
$_SERVER['DB_HOST'] = 'x';
$_SERVER['DB_CHARSET'] = 'utf8mb4';
$_SERVER['DB_COLLATE'] = '';
$_SERVER['AUTH_KEY'] = 'x';
$_SERVER['SECURE_AUTH_KEY'] = 'x';
$_SERVER['LOGGED_IN_KEY'] = 'x';
$_SERVER['NONCE_KEY'] = 'x';
$_SERVER['AUTH_SALT'] = 'x';
$_SERVER['SECURE_AUTH_SALT'] = 'x';
$_SERVER['LOGGED_IN_SALT'] = 'x';
$_SERVER['NONCE_SALT'] = 'x';
$_SERVER['WP_DEBUG'] = false;
$_SERVER['AWS_ACCESS_KEY'] = 'x';
$_SERVER['AWS_SECRET'] = 'x';
- If you intend to update the environment variables, don't forget to add it in
.ebextensions/options.config
as well, to update Beanstalk on the additional variables. - Nginx configurations is managed by Beanstalk, which you can customize at
.platform/nginx/
- Please note that the configuration will only reflect in Beanstalk environment, not locally.
sh -c "echo -n 'username:' >> .htpasswd"
— Replace username with your desired passwordsh -c "openssl passwd -apr1 >> .htpasswd"
- Copy the output of
cat .htpasswd
- Then update the password in
.ebextensions/options.config