Skip to content

Commit

Permalink
Upload of staging site
Browse files Browse the repository at this point in the history
  • Loading branch information
strtwtsn committed Apr 30, 2021
1 parent cfe4ee5 commit 6df2dcf
Show file tree
Hide file tree
Showing 30 changed files with 1,524 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "wordpress"]
path = wordpress
url = https://github.com/WordPress/WordPress
25 changes: 25 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'

# Include the git capistrano module
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

# Include the git submodule strategy for capistrano
require "capistrano/scm/git-with-submodules"
install_plugin Capistrano::SCM::Git::WithSubmodules

# Includes everything else
require 'yaml'

require 'capistrano/file-permissions'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }


set :services, [:apache2]
require 'capistrano/service'
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gem 'capistrano', '3.11.0'
gem 'capistrano-git-with-submodules', '2.0.3'
gem 'capistrano-file-permissions'
gem 'capistrano-service'
38 changes: 38 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
GEM
remote: https://rubygems.org/
specs:
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
capistrano (3.11.0)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-file-permissions (1.0.0)
capistrano (~> 3.0)
capistrano-git-with-submodules (2.0.3)
capistrano (~> 3.7)
capistrano-service (0.0.2)
capistrano (>= 3.0.0.pre)
concurrent-ruby (1.1.6)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
net-ssh (5.2.0)
rake (13.0.1)
sshkit (1.21.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)

PLATFORMS
ruby

DEPENDENCIES
capistrano (= 3.11.0)
capistrano-file-permissions
capistrano-git-with-submodules (= 2.0.3)
capistrano-service

BUNDLED WITH
2.1.4
674 changes: 674 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# wordpress_elearning
# ecosystemassessments-wordpress
15 changes: 15 additions & 0 deletions config/database.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
production:
host: localhost
database: db_name
username: db_user
password: 'db_pass'
staging:
host: localhost
database: db_name
username: db_user
password: 'db_pass'
local:
host: localhost
database: db_name
username: root
password: 'root'
15 changes: 15 additions & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
production:
host: localhost
database: db_name
username: db_user
password: 'db_pass'
staging:
host: localhost
database: db_name
username: db_user
password: 'db_pass'
local:
host: localhost
database: db_name
username: root
password: 'root'
54 changes: 54 additions & 0 deletions config/deploy.example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
################################################################################
## Setup project
################################################################################

# Lock the project to Capistrano 3.11.0
lock '3.11.0'

# The WordPress admin user
set :wp_user, 'yourname'

# The WordPress admin email address
set :wp_email, '[email protected]'

# The WordPress 'Site Title' for the website
set :wp_sitename, 'WP Deploy'

# The local environment URL.
set :wp_localurl, 'http://wpdeploy.local'

# An identifying name for the application to be used by Capistrano
set :application, 'wp-deploy'
set :repo_url, '[email protected]:Mixd/wp-deploy.git'


################################################################################
## Setup Capistrano
################################################################################

set :log_level, :debug
set :keep_releases, 2
set :use_sudo, false
set :ssh_options, forward_agent: true


################################################################################
## Linked files and directories (symlinks)
################################################################################

set :linked_files, %w(wp-config.php .htaccess robots.txt)
set :linked_dirs, %w(content/uploads)

namespace :deploy do
desc 'create WordPress files for symlinking'
task :create_wp_files do
on roles(:app) do
execute :touch, "#{shared_path}/wp-config.php"
execute :touch, "#{shared_path}/.htaccess"
execute :touch, "#{shared_path}/robots.txt"
end
end

after 'check:make_linked_dirs', :create_wp_files
after :finishing, 'deploy:cleanup'
end
70 changes: 70 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
################################################################################
## Setup project
################################################################################

# Lock the project to Capistrano 3.11.0
lock '3.11.0'

# The WordPress admin user
set :wp_user, 'wcmc'

# The WordPress admin email address
set :wp_email, '[email protected]'

set :deploy_user, 'wcmc'

# The WordPress 'Site Title' for the website
set :wp_sitename, 'ecosystemassessments'

# The local environment URL.
set :wp_localurl, 'http://wpdeploy.local'

# An identifying name for the application to be used by Capistrano
set :application, 'ecosystemassessments'
set :repo_url, '[email protected]:unepwcmc/ecosystemassessments-wordpress.git'


################################################################################
## Setup Capistrano
################################################################################

set :log_level, :debug
set :keep_releases, 2
set :use_sudo, false
set :ssh_options, forward_agent: true


################################################################################
## Linked files and directories (symlinks)
################################################################################

set :linked_files, %w(wp-config.php .htaccess robots.txt index.php content/themes/ea/.env)
set :linked_dirs, %w(content/uploads content/plugins content/languages)


set :file_permissions_paths, ["content"]
set :file_permissions_users, ["www-data"]
set :file_permissions_chmod_mode, "0755"
set :file_permissions_groups, ["www-data"]


before "deploy:updated", "deploy:set_permissions:acl"

namespace :deploy do
desc 'create WordPress files for symlinking'
task :create_wp_files do
on roles(:app) do
execute :touch, "#{shared_path}/wp-config.php"
execute :touch, "#{shared_path}/.htaccess"
execute :touch, "#{shared_path}/robots.txt"
end
end

after 'check:make_linked_dirs', :create_wp_files
after :finishing, 'deploy:cleanup'
end


namespace :deploy do
after :publishing, 'service:apache2:restart'
end
21 changes: 21 additions & 0 deletions config/deploy/production.example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
################################################################################
## Setup Environment
################################################################################

# The Git branch this environment should be attached to.
set :branch, 'master'

# The environment's name. To be used in commands and other references.
set :stage, :production

# The URL of the website in this environment.
set :stage_url, 'http://www.example.com'

# The environment's server credentials
server 'XXX.XXX.XX.XXX', user: 'SSHUSER', roles: %w(web app db)

# The deploy path to the website on this environment's server.
set :deploy_to, '/deploy/to/path'

# The web user on this environment's server.
set :web_user, 'www-data'
21 changes: 21 additions & 0 deletions config/deploy/staging.example.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
################################################################################
## Setup Environment
################################################################################

# The Git branch this environment should be attached to.
set :branch, 'development'

# The environment's name. To be used in commands and other references.
set :stage, :staging

# The URL of the website in this environment.
set :stage_url, 'http://www.example.com'

# The environment's server credentials
server 'XXX.XXX.XX.XXX', user: 'SSHUSER', roles: %w(web app db)

# The deploy path to the website on this environment's server.
set :deploy_to, '/deploy/to/path'

# The web user on this environment's server.
set :web_user, 'www-data'
21 changes: 21 additions & 0 deletions config/deploy/staging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
################################################################################
## Setup Environment
################################################################################

# The Git branch this environment should be attached to.
set :branch, 'master'

# The environment's name. To be used in commands and other references.
set :stage, :staging

# The URL of the website in this environment.
set :stage_url, 'elearning.staging.wordpress-linode.linode.unep-wcmc.org'

# The environment's server credentials
server 'staging.wordpress-linode.linode.unep-wcmc.org', user: 'wcmc', roles: %w(web app db)

# The deploy path to the website on this environment's server.
set :deploy_to, "/home/#{fetch(:deploy_user)}/#{fetch(:application)}"

# The web user on this environment's server.
set :web_user, 'www-data'
12 changes: 12 additions & 0 deletions config/templates/local/.htaccess.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
2 changes: 2 additions & 0 deletions config/templates/local/robots.txt.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /
34 changes: 34 additions & 0 deletions config/templates/local/wp-config.php.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

define('DB_NAME', '<%= database['database'] %>');
define('DB_USER', '<%= database['username'] %>');
define('DB_PASSWORD', '<%= database['password'] %>');
define('DB_HOST', '<%= database['host'] %>');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('WPLANG', '');
define('WP_DEBUG', true);

$table_prefix = 'wp_';

<%= secret_keys %>

define('WP_HOME', '<%= wp_siteurl %>');
define('WP_SITEURL','<%= wp_siteurl %>/wordpress');

define('WP_CONTENT_URL', '<%= wp_siteurl %>/content');

/**
* Depending on your server configuration, you may find WordPress fails to find your content (themes and plugins).
* This is due to how your server returns `$_SERVER['DOCUMENT_ROOT']`. If this issue affects you, try swapping
* for the `dirname(__FILE__)` method below.
*/

// define('WP_CONTENT_DIR', realpath(dirname(__FILE__) . '/content'));
define('WP_CONTENT_DIR', realpath($_SERVER['DOCUMENT_ROOT'] . '/content'));

if (!defined('ABSPATH')) {
define('ABSPATH', dirname(__FILE__) . '/');
}

require_once(ABSPATH . 'wp-settings.php');
12 changes: 12 additions & 0 deletions config/templates/production/.htaccess.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
3 changes: 3 additions & 0 deletions config/templates/production/robots.txt.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
User-agent: *
Disallow: /wordpress/wp-admin/
Allow: /wordpress/wp-admin/admin-ajax.php
Loading

0 comments on commit 6df2dcf

Please sign in to comment.