deploy
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
10 changed files
with
478 additions
and
3 deletions
.bundle/config
0 → 100644
.htaccess
0 → 100644
| 1 | |||
| 2 | # BEGIN WordPress | ||
| 3 | # The directives (lines) between `BEGIN WordPress` and `END WordPress` are | ||
| 4 | # dynamically generated, and should only be modified via WordPress filters. | ||
| 5 | # Any changes to the directives between these markers will be overwritten. | ||
| 6 | <IfModule mod_rewrite.c> | ||
| 7 | RewriteEngine On | ||
| 8 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | ||
| 9 | RewriteBase / | ||
| 10 | RewriteRule ^index\.php$ - [L] | ||
| 11 | RewriteCond %{REQUEST_FILENAME} !-f | ||
| 12 | RewriteCond %{REQUEST_FILENAME} !-d | ||
| 13 | RewriteRule . /index.php [L] | ||
| 14 | </IfModule> | ||
| 15 | |||
| 16 | # END WordPress | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
Capfile
0 → 100644
| 1 | # Load DSL and Setup Up Stages | ||
| 2 | require 'capistrano/setup' | ||
| 3 | |||
| 4 | # Includes default deployment tasks | ||
| 5 | require 'capistrano/deploy' | ||
| 6 | |||
| 7 | # Load tasks from gems | ||
| 8 | require 'capistrano/composer' | ||
| 9 | |||
| 10 | # Loads custom tasks from `lib/capistrano/tasks' if you have any defined. | ||
| 11 | # Customize this path to change the location of your custom tasks. | ||
| 12 | Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } |
Gemfile
0 → 100644
Gemfile.lock
0 → 100644
| 1 | GEM | ||
| 2 | remote: https://rubygems.org/ | ||
| 3 | specs: | ||
| 4 | airbrussh (1.4.1) | ||
| 5 | sshkit (>= 1.6.1, != 1.7.0) | ||
| 6 | capistrano (3.17.1) | ||
| 7 | airbrussh (>= 1.0.0) | ||
| 8 | i18n | ||
| 9 | rake (>= 10.0.0) | ||
| 10 | sshkit (>= 1.9.0) | ||
| 11 | capistrano-composer (0.0.6) | ||
| 12 | capistrano (>= 3.0.0.pre) | ||
| 13 | concurrent-ruby (1.1.10) | ||
| 14 | i18n (1.12.0) | ||
| 15 | concurrent-ruby (~> 1.0) | ||
| 16 | net-scp (1.2.1) | ||
| 17 | net-ssh (>= 2.6.5) | ||
| 18 | net-ssh (7.0.1) | ||
| 19 | rake (13.0.6) | ||
| 20 | sshkit (1.21.2) | ||
| 21 | net-scp (>= 1.1.2) | ||
| 22 | net-ssh (>= 2.8.0) | ||
| 23 | |||
| 24 | PLATFORMS | ||
| 25 | x86_64-darwin-21 | ||
| 26 | x86_64-darwin-22 | ||
| 27 | |||
| 28 | DEPENDENCIES | ||
| 29 | capistrano (~> 3.10) | ||
| 30 | capistrano-composer | ||
| 31 | |||
| 32 | BUNDLED WITH | ||
| 33 | 2.3.21 |
config/deploy.rb
0 → 100644
| 1 | set :application, 'msf-climate-hub' | ||
| 2 | set :repo_url, 'git@git.gotenzing.com:msf/msf-climate-hub.git' | ||
| 3 | |||
| 4 | # Branch options | ||
| 5 | # Prompts for the branch name (defaults to current branch) | ||
| 6 | #ask :branch, -> { `git rev-parse --abbrev-ref HEAD`.chomp } | ||
| 7 | |||
| 8 | # Hardcodes branch to always be master | ||
| 9 | # This could be overridden in a stage config file | ||
| 10 | set :branch, :"master" | ||
| 11 | SSHKit.config.command_map[:composer] = "/usr/bin/php74 /home/tenzing_www/composer.phar" | ||
| 12 | |||
| 13 | set :keep_releases, 2 | ||
| 14 | set :deploy_to, -> { "/var/www/html/production/#{fetch(:application)}" } | ||
| 15 | |||
| 16 | # Use :debug for more verbose output when troubleshooting | ||
| 17 | set :log_level, :info | ||
| 18 | |||
| 19 | # Put all shared files/directories here (e.g. uploads that need to go on the NFS drive) | ||
| 20 | set :linked_files, fetch(:linked_files, []).push('.env') | ||
| 21 | set :linked_dirs, fetch(:linked_dirs, []).push('wp-content/uploads', 'wp-content/storage', 'wp-content/languages', 'wp-content/cache') | ||
| 22 | |||
| 23 | namespace :deploy do | ||
| 24 | desc 'Restart application' | ||
| 25 | task :restart do | ||
| 26 | on roles(:app), in: :sequence, wait: 5 do | ||
| 27 | # Your restart mechanism here, for example: | ||
| 28 | # execute :service, :nginx, :reload | ||
| 29 | end | ||
| 30 | end | ||
| 31 | end | ||
| 32 | |||
| 33 | namespace :deploy do | ||
| 34 | desc 'Sync servers' | ||
| 35 | task :sync do | ||
| 36 | on roles(:web), in: :sequence, wait: 5 do | ||
| 37 | execute "cd '#{release_path}/'; rm -Rf .git/ " | ||
| 38 | execute("si #{fetch(:application)}") | ||
| 39 | end | ||
| 40 | end | ||
| 41 | end | ||
| 42 | |||
| 43 | namespace :deploy do | ||
| 44 | desc 'Sync servers' | ||
| 45 | task :sync_again do | ||
| 46 | on roles(:web), in: :sequence, wait: 5 do | ||
| 47 | execute("si #{fetch(:application)}") | ||
| 48 | end | ||
| 49 | end | ||
| 50 | end | ||
| 51 | |||
| 52 | |||
| 53 | namespace :deploy do | ||
| 54 | desc 'Install composer packages in msf-child theme' | ||
| 55 | task :install_theme_packages do | ||
| 56 | on roles(:web), in: :sequence, wait: 5 do | ||
| 57 | execute "cd '#{release_path}/wp-content/themes/msf-child'; /usr/bin/php74 /home/tenzing_www/composer.phar install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader" | ||
| 58 | end | ||
| 59 | end | ||
| 60 | end | ||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | namespace :deploy do | ||
| 65 | desc 'set file permissions' | ||
| 66 | task :set_permissions do | ||
| 67 | on roles(:web), in: :sequence, wait: 5 do | ||
| 68 | execute "cd '#{release_path}/'; chmod -Rf 777 .htaccess wp-config.php" | ||
| 69 | end | ||
| 70 | end | ||
| 71 | end | ||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | # Override `git#create_release` to handle submodules | ||
| 76 | namespace :git do | ||
| 77 | desc 'Copy repo to releases' | ||
| 78 | task create_release: :'git:update' do | ||
| 79 | on roles(:all) do | ||
| 80 | with fetch(:git_environmental_variables) do | ||
| 81 | within repo_path do | ||
| 82 | execute :git, :clone, '-b', fetch(:branch), '--recursive', '.', release_path | ||
| 83 | end | ||
| 84 | end | ||
| 85 | end | ||
| 86 | end | ||
| 87 | end | ||
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | # The above update_option_paths task is not run by default | ||
| 98 | # Note that you need to have WP-CLI installed on your server | ||
| 99 | # Uncomment the following line to run it on deploys if needed | ||
| 100 | # after 'deploy:publishing', 'deploy:update_option_paths' | ||
| 101 | |||
| 102 | #after 'deploy:updated', 'deploy:install_theme_packages' | ||
| 103 | after 'deploy:updated', 'deploy:sync' | ||
| 104 | #after 'deploy:updated', 'deploy:set_permissions' | ||
| 105 | after 'deploy:finished', 'deploy:sync_again' |
config/deploy/production.rb
0 → 100644
| 1 | set :stage, :production | ||
| 2 | |||
| 3 | # Simple Role Syntax | ||
| 4 | # ================== | ||
| 5 | role :web, %w{tenzing_www@web-1} | ||
| 6 | |||
| 7 | # you can set custom ssh options | ||
| 8 | # it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options | ||
| 9 | # you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start) | ||
| 10 | # set it globally | ||
| 11 | # set :ssh_options, { | ||
| 12 | # keys: %w(~/.ssh/id_rsa), | ||
| 13 | # forward_agent: false, | ||
| 14 | # auth_methods: %w(password) | ||
| 15 | # } | ||
| 16 | |||
| 17 | fetch(:default_env).merge!(wp_env: :production) |
config/deploy/staging.rb
0 → 100644
| 1 | set :application, 'msf-climate-hub' | ||
| 2 | set :stage, :staging | ||
| 3 | set :branch, "master" | ||
| 4 | |||
| 5 | # Simple Role Syntax | ||
| 6 | # ================== | ||
| 7 | role :web, %w{tenzing_www@web-1} | ||
| 8 | |||
| 9 | # you can set custom ssh options | ||
| 10 | # it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options | ||
| 11 | # you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start) | ||
| 12 | # set it globally | ||
| 13 | # set :ssh_options, { | ||
| 14 | # keys: %w(~/.ssh/id_rsa), | ||
| 15 | # forward_agent: false, | ||
| 16 | # auth_methods: %w(password) | ||
| 17 | # } | ||
| 18 | |||
| 19 | fetch(:default_env).merge!(wp_env: :staging) |
phpinfo.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | phpinfo(); | ||
| 4 | |||
| 5 | // $fields = | ||
| 6 | // array ( | ||
| 7 | |||
| 8 | // 'location' => | ||
| 9 | // array ( | ||
| 10 | // 'name' => 'Location', | ||
| 11 | // 'field_name' => 'location', | ||
| 12 | // 'type' => 'textfield', | ||
| 13 | // 'show_list' => 'off', | ||
| 14 | // 'extra' => | ||
| 15 | // array ( | ||
| 16 | // 'show_label' => 'yes', | ||
| 17 | // 'multiline' => 'no', | ||
| 18 | // ), | ||
| 19 | // ), | ||
| 20 | // 'city' => | ||
| 21 | // array ( | ||
| 22 | // 'name' => 'City', | ||
| 23 | // 'field_name' => 'city', | ||
| 24 | // 'type' => 'textfield', | ||
| 25 | // 'show_list' => 'off', | ||
| 26 | // 'extra' => | ||
| 27 | // array ( | ||
| 28 | // 'show_label' => 'yes', | ||
| 29 | // 'multiline' => 'no', | ||
| 30 | // ), | ||
| 31 | // ), | ||
| 32 | // 'event_date' => | ||
| 33 | // array ( | ||
| 34 | // 'name' => 'Event Start Date', | ||
| 35 | // 'field_name' => 'event_date', | ||
| 36 | // 'type' => 'datefield', | ||
| 37 | // 'show_list' => 'off', | ||
| 38 | // 'extra' => | ||
| 39 | // array ( | ||
| 40 | // 'show_label' => 'yes', | ||
| 41 | // 'date_format' => 'Short', | ||
| 42 | // 'custom_date_format' => '', | ||
| 43 | // ), | ||
| 44 | // ), | ||
| 45 | // 'event_date_end' => | ||
| 46 | // array ( | ||
| 47 | // 'name' => 'Event End Date (optional)', | ||
| 48 | // 'field_name' => 'event_date_end', | ||
| 49 | // 'type' => 'datefield', | ||
| 50 | // 'show_list' => 'off', | ||
| 51 | // 'extra' => | ||
| 52 | // array ( | ||
| 53 | // 'show_label' => 'yes', | ||
| 54 | // 'date_format' => 'Short', | ||
| 55 | // 'custom_date_format' => '', | ||
| 56 | // ), | ||
| 57 | // ), | ||
| 58 | // 'time_start' => | ||
| 59 | // array ( | ||
| 60 | // 'name' => 'Start Time', | ||
| 61 | // 'field_name' => 'time_start', | ||
| 62 | // 'type' => 'textfield', | ||
| 63 | // 'show_list' => 'off', | ||
| 64 | // 'extra' => | ||
| 65 | // array ( | ||
| 66 | // 'show_label' => 'yes', | ||
| 67 | // 'multiline' => 'no', | ||
| 68 | // ), | ||
| 69 | // ), | ||
| 70 | // 'time_end' => | ||
| 71 | // array ( | ||
| 72 | // 'name' => 'End Time', | ||
| 73 | // 'field_name' => 'time_end', | ||
| 74 | // 'type' => 'textfield', | ||
| 75 | // 'show_list' => 'off', | ||
| 76 | // 'extra' => | ||
| 77 | // array ( | ||
| 78 | // 'show_label' => 'yes', | ||
| 79 | // 'multiline' => 'no', | ||
| 80 | // ), | ||
| 81 | // ), | ||
| 82 | // 'reg_open' => | ||
| 83 | // array ( | ||
| 84 | // 'name' => 'Registration Opens', | ||
| 85 | // 'field_name' => 'reg_open', | ||
| 86 | // 'type' => 'datefield', | ||
| 87 | // 'show_list' => 'off', | ||
| 88 | // 'extra' => | ||
| 89 | // array ( | ||
| 90 | // 'show_label' => 'yes', | ||
| 91 | // 'date_format' => 'Short', | ||
| 92 | // 'custom_date_format' => '', | ||
| 93 | // ), | ||
| 94 | // ), | ||
| 95 | // 'early_bird_deadline' => | ||
| 96 | // array ( | ||
| 97 | // 'name' => 'Early Bird Deadline', | ||
| 98 | // 'field_name' => 'early_bird_deadline', | ||
| 99 | // 'type' => 'datefield', | ||
| 100 | // 'show_list' => 'off', | ||
| 101 | // 'extra' => | ||
| 102 | // array ( | ||
| 103 | // 'show_label' => 'yes', | ||
| 104 | // 'date_format' => 'Medium', | ||
| 105 | // 'custom_date_format' => '', | ||
| 106 | // ), | ||
| 107 | // ), | ||
| 108 | // 'reg_deadline' => | ||
| 109 | // array ( | ||
| 110 | // 'name' => 'Registration Deadline', | ||
| 111 | // 'field_name' => 'reg_deadline', | ||
| 112 | // 'type' => 'datefield', | ||
| 113 | // 'show_list' => 'off', | ||
| 114 | // 'extra' => | ||
| 115 | // array ( | ||
| 116 | // 'show_label' => 'yes', | ||
| 117 | // 'date_format' => 'Medium', | ||
| 118 | // 'custom_date_format' => '', | ||
| 119 | // ), | ||
| 120 | // ), | ||
| 121 | // 'cancel_deadline' => | ||
| 122 | // array ( | ||
| 123 | // 'name' => 'Cancellation Deadline', | ||
| 124 | // 'field_name' => 'cancel_deadline', | ||
| 125 | // 'type' => 'datefield', | ||
| 126 | // 'show_list' => 'off', | ||
| 127 | // 'extra' => | ||
| 128 | // array ( | ||
| 129 | // 'show_label' => 'yes', | ||
| 130 | // 'date_format' => 'Medium', | ||
| 131 | // 'custom_date_format' => '', | ||
| 132 | // ), | ||
| 133 | // ), | ||
| 134 | // 'edit_deadline' => | ||
| 135 | // array ( | ||
| 136 | // 'name' => 'Edit Deadline', | ||
| 137 | // 'field_name' => 'edit_deadline', | ||
| 138 | // 'type' => 'datefield', | ||
| 139 | // 'show_list' => 'off', | ||
| 140 | // 'extra' => | ||
| 141 | // array ( | ||
| 142 | // 'show_label' => 'yes', | ||
| 143 | // 'date_format' => 'Medium', | ||
| 144 | // 'custom_date_format' => '', | ||
| 145 | // ), | ||
| 146 | // ), | ||
| 147 | // 'cost' => | ||
| 148 | // array ( | ||
| 149 | // 'name' => 'Cost', | ||
| 150 | // 'field_name' => 'cost', | ||
| 151 | // 'type' => 'textfield', | ||
| 152 | // 'show_list' => 'off', | ||
| 153 | // 'extra' => | ||
| 154 | // array ( | ||
| 155 | // 'show_label' => 'yes', | ||
| 156 | // 'multiline' => 'no', | ||
| 157 | // ), | ||
| 158 | // ), | ||
| 159 | // 'early_bird_discount' => | ||
| 160 | // array ( | ||
| 161 | // 'name' => 'Early Bird ($) Discount ', | ||
| 162 | // 'field_name' => 'early_bird_discount', | ||
| 163 | // 'type' => 'textfield', | ||
| 164 | // 'show_list' => 'off', | ||
| 165 | // 'extra' => | ||
| 166 | // array ( | ||
| 167 | // 'show_label' => 'yes', | ||
| 168 | // 'multiline' => 'no', | ||
| 169 | // ), | ||
| 170 | // ), | ||
| 171 | // 'student_member_discount' => | ||
| 172 | // array ( | ||
| 173 | // 'name' => 'Student/Member ($) Discount', | ||
| 174 | // 'field_name' => 'student_member_discount', | ||
| 175 | // 'type' => 'textfield', | ||
| 176 | // 'show_list' => 'off', | ||
| 177 | // 'extra' => | ||
| 178 | // array ( | ||
| 179 | // 'show_label' => 'yes', | ||
| 180 | // 'multiline' => 'no', | ||
| 181 | // ), | ||
| 182 | // ), | ||
| 183 | // 'worth_cehours' => | ||
| 184 | // array ( | ||
| 185 | // 'name' => 'Worth CE Hours', | ||
| 186 | // 'field_name' => 'worth_cehours', | ||
| 187 | // 'type' => 'textfield', | ||
| 188 | // 'show_list' => 'off', | ||
| 189 | // 'extra' => | ||
| 190 | // array ( | ||
| 191 | // 'show_label' => 'yes', | ||
| 192 | // 'multiline' => 'no', | ||
| 193 | // ), | ||
| 194 | // ), | ||
| 195 | // 'is_archived_podcast' => | ||
| 196 | // array ( | ||
| 197 | // 'name' => 'Include in Archived Podcast', | ||
| 198 | // 'field_name' => 'is_archived_podcast', | ||
| 199 | // 'type' => 'checkbox', | ||
| 200 | // 'show_list' => false, | ||
| 201 | // 'extra' => | ||
| 202 | // array ( | ||
| 203 | // ), | ||
| 204 | // ), | ||
| 205 | // 'is_archived_webinar' => | ||
| 206 | // array ( | ||
| 207 | // 'name' => 'Include in Archived Webinars', | ||
| 208 | // 'field_name' => 'is_archived_webinar', | ||
| 209 | // 'type' => 'checkbox', | ||
| 210 | // 'show_list' => 'off', | ||
| 211 | // 'extra' => | ||
| 212 | // array ( | ||
| 213 | // ), | ||
| 214 | // ), | ||
| 215 | // 'event_include_on_home_page' => | ||
| 216 | // array ( | ||
| 217 | // 'name' => 'Include on Home Page', | ||
| 218 | // 'field_name' => 'event_include_on_home_page', | ||
| 219 | // 'type' => 'checkbox', | ||
| 220 | // 'show_list' => 'off', | ||
| 221 | // 'extra' => | ||
| 222 | // array ( | ||
| 223 | // ), | ||
| 224 | // ), | ||
| 225 | |||
| 226 | |||
| 227 | |||
| 228 | // ); | ||
| 229 | |||
| 230 | |||
| 231 | // $new_fields = array(); | ||
| 232 | // foreach($fields as $field){ | ||
| 233 | // $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
| 234 | // $charactersLength = strlen($characters); | ||
| 235 | // $randomString = ''; | ||
| 236 | // for ($i = 0; $i < 13; $i++) { | ||
| 237 | // $randomString .= $characters[rand(0, $charactersLength - 1)]; | ||
| 238 | // } | ||
| 239 | // error_log(print_r($field['name'], true)); | ||
| 240 | // array_push($new_fields, | ||
| 241 | |||
| 242 | // array( | ||
| 243 | // 'key' => 'field_'.$randomString, | ||
| 244 | // 'label' => $field['name'], | ||
| 245 | // 'name' => $field['field_name'], | ||
| 246 | // 'type' => $field['type'], | ||
| 247 | // 'instructions' => '', | ||
| 248 | // 'required' => 0, | ||
| 249 | // 'conditional_logic' => 0, | ||
| 250 | // 'wrapper' => | ||
| 251 | // (object) array( | ||
| 252 | // 'width' => '', | ||
| 253 | // 'class' => '', | ||
| 254 | // 'id' => '', | ||
| 255 | // ), | ||
| 256 | // 'default_value' => '', | ||
| 257 | // 'placeholder' => '', | ||
| 258 | // 'prepend' => '', | ||
| 259 | // 'append' => '', | ||
| 260 | // 'maxlength' => '', | ||
| 261 | // ) | ||
| 262 | |||
| 263 | // ); | ||
| 264 | // } | ||
| 265 | // var_dump(json_encode($new_fields)); | ||
| 266 | |||
| 267 |
| 1 | <?php | 1 | <?php |
| 2 | require_once(__DIR__ . '/../vendor/autoload.php'); | 2 | |
| 3 | (new \Dotenv\Dotenv(__DIR__.'/../'))->load(); | ||
| 4 | /** | 3 | /** |
| 5 | * The base configuration for WordPress | 4 | * The base configuration for WordPress |
| 6 | * | 5 | * |
| ... | @@ -19,7 +18,8 @@ require_once(__DIR__ . '/../vendor/autoload.php'); | ... | @@ -19,7 +18,8 @@ require_once(__DIR__ . '/../vendor/autoload.php'); |
| 19 | * | 18 | * |
| 20 | * @package WordPress | 19 | * @package WordPress |
| 21 | */ | 20 | */ |
| 22 | 21 | require_once(__DIR__ . '/vendor/autoload.php'); | |
| 22 | (new \Dotenv\Dotenv(__DIR__.'/'))->load(); | ||
| 23 | 23 | ||
| 24 | // ** Database settings - You can get this info from your web host ** // | 24 | // ** Database settings - You can get this info from your web host ** // |
| 25 | /** The name of the database for WordPress */ | 25 | /** The name of the database for WordPress */ | ... | ... |
-
Please register or sign in to post a comment