Skip to content
This repository was archived by the owner on Aug 21, 2022. It is now read-only.

Commit 756d7c4

Browse files
Itsik YehudaItsik Yehuda
Itsik Yehuda
authored and
Itsik Yehuda
committed
firs commit
0 parents  commit 756d7c4

File tree

5,869 files changed

+1397504
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,869 files changed

+1397504
-0
lines changed

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
*.log
2+
*.backup
3+
*.save
4+
wp-config.php
5+
wp-content/advanced-cache.php
6+
wp-content/backup-db/
7+
wp-content/backups/
8+
wp-content/blogs.dir/
9+
wp-content/cache/
10+
wp-content/upgrade/
11+
wp-content/wp-cache-config.php
12+
wp-content/plugins/hello.php
13+
14+
/.htaccess
15+
/license.txt
16+
/readme.html
17+
/sitemap.xml
18+
/sitemap.xml.gz

.slugignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docs/
2+
resources/

README.md

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# WordPress Heroku
2+
3+
This project is a template for installing and running [WordPress](http://wordpress.org/) on [Heroku](http://www.heroku.com/). The repository comes bundled with:
4+
* [PostgreSQL for WordPress](http://wordpress.org/extend/plugins/postgresql-for-wordpress/)
5+
* [Amazon S3 and Cloudfront](https://wordpress.org/plugins/amazon-s3-and-cloudfront/)
6+
* [WP Sendgrid](https://wordpress.org/plugins/wp-sendgrid/)
7+
* [Wordpress HTTPS](https://wordpress.org/plugins/wordpress-https/)
8+
9+
## Installation
10+
11+
Clone the repository from Github
12+
13+
$ git clone git://github.com/itsiky/heroku-wordpress.git
14+
15+
With the [Heroku gem](http://devcenter.heroku.com/articles/heroku-command), create your app
16+
17+
$ cd heroku-wordpress
18+
$ heroku create
19+
Creating strange-bird-1234... done, stack is cedar
20+
http://strange-bird-1234.herokuapp.com/ | [email protected]:strange-bird-1234.git
21+
Git remote heroku added
22+
23+
Add a database to your app
24+
25+
$ heroku addons:create heroku-postgresql
26+
Creating HEROKU_POSTGRESQL_INSTANCE... done, (free)
27+
Adding HEROKU_POSTGRESQL_INSTANCE to strange-bird-1234... done
28+
Setting DATABASE_URL and restarting strange-bird-1234... done, v3
29+
Database has been created and is available
30+
! This database is empty. If upgrading, you can transfer
31+
! data from another database with pgbackups:restore
32+
Use `heroku addons:docs heroku-postgresql` to view documentation.
33+
34+
Promote the database (replace HEROKU_POSTGRESQL_INSTANCE with the name from the above output)
35+
36+
$ heroku pg:promote HEROKU_POSTGRESQL_INSTANCE
37+
Promoting HEROKU_POSTGRESQL_INSTANCE to DATABASE_URL... done
38+
Ensuring an alternate alias for existing DATABASE... done, HEROKU_POSTGRESQL_COLOR
39+
Promoting HEROKU_POSTGRESQL_INSTANCE to DATABASE_URL on strange-bird-1234... done
40+
41+
Add the ability to send email (i.e. Password Resets etc)
42+
43+
$ heroku addons:create sendgrid:starter
44+
Creating SENDGRID_INSTANCE... done, (free)
45+
Adding SENDGRID_INSTANCE to strange-bird-1234... done
46+
Setting SENDGRID_PASSWORD, SENDGRID_USERNAME and restarting strange-bird-1234... done, v7
47+
Use `heroku addons:docs sendgrid` to view documentation.
48+
49+
Create a new branch for any configuration/setup changes needed
50+
51+
$ git checkout -b production
52+
53+
Store unique keys and salts in Heroku environment variables. Wordpress can provide random values [here](https://api.wordpress.org/secret-key/1.1/salt/).
54+
55+
heroku config:set AUTH_KEY='put your unique phrase here' \
56+
SECURE_AUTH_KEY='put your unique phrase here' \
57+
LOGGED_IN_KEY='put your unique phrase here' \
58+
NONCE_KEY='put your unique phrase here' \
59+
AUTH_SALT='put your unique phrase here' \
60+
SECURE_AUTH_SALT='put your unique phrase here' \
61+
LOGGED_IN_SALT='put your unique phrase here' \
62+
NONCE_SALT='put your unique phrase here'
63+
64+
Deploy to Heroku
65+
66+
$ git push heroku production:master
67+
-----> Deleting 0 files matching .slugignore patterns.
68+
-----> PHP app detected
69+
70+
! WARNING: No composer.json found.
71+
Using index.php to declare PHP applications is considered legacy
72+
functionality and may lead to unexpected behavior.
73+
74+
-----> No runtime requirements in composer.json, defaulting to PHP 5.6.2.
75+
-----> Installing system packages...
76+
- PHP 5.6.2
77+
- Apache 2.4.10
78+
- Nginx 1.6.0
79+
-----> Installing PHP extensions...
80+
- zend-opcache (automatic; bundled, using 'ext-zend-opcache.ini')
81+
-----> Installing dependencies...
82+
Composer version 1.0-dev (ffffab37a294f3383c812d0329623f0a4ba45387) 2014-11-05 06:04:18
83+
Loading composer repositories with package information
84+
Installing dependencies
85+
Nothing to install or update
86+
Generating optimized autoload files
87+
-----> Preparing runtime environment...
88+
NOTICE: No Procfile, defaulting to 'web: vendor/bin/heroku-php-apache2'
89+
-----> Discovering process types
90+
Procfile declares types -> web
91+
92+
-----> Compressing... done, 78.5MB
93+
-----> Launcing... done, v5
94+
http://strange-bird-1234.herokuapp.com deployed to Heroku
95+
96+
To git@heroku:strange-bird-1234.git
97+
* [new branch] production -> master
98+
99+
After deployment WordPress has a few more steps to setup and thats it!
100+
101+
## Usage
102+
103+
Because a file cannot be written to Heroku's file system, updating and installing plugins or themes should be done locally and then pushed to Heroku.
104+
105+
## Updating
106+
107+
Updating your WordPress version is just a matter of merging the updates into
108+
the branch created from the installation.
109+
110+
$ git pull # Get the latest
111+
112+
Using the same branch name from our installation:
113+
114+
$ git checkout production
115+
$ git merge master # Merge latest
116+
$ git push heroku production:master
117+
118+
WordPress needs to update the database. After push, navigate to:
119+
120+
http://your-app-url.herokuapp.com/wp-admin
121+
122+
WordPress will prompt for updating the database. After that you'll be good
123+
to go.
124+
125+
## Deployment optimisation
126+
127+
If you have files that you want tracked in your repo, but do not need deploying (for example, *.md, *.pdf, *.zip). Then add path or linux file match to the `.slugignore` file & these will not be deployed.
128+
129+
Examples:
130+
```
131+
path/to/ignore/
132+
bin/
133+
*.md
134+
*.pdf
135+
*.zip
136+
```

index.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Front to the WordPress application. This file doesn't do anything, but loads
4+
* wp-blog-header.php which does and tells WordPress to load the theme.
5+
*
6+
* @package WordPress
7+
*/
8+
9+
/**
10+
* Tells WordPress to load the WordPress theme and output it.
11+
*
12+
* @var bool
13+
*/
14+
define('WP_USE_THEMES', true);
15+
16+
/** Loads the WordPress Environment and Template */
17+
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

tools/logfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
LOG: database system was shut down at 2017-04-08 09:07:43 PDT
2+
LOG: MultiXact member wraparound protections are now enabled
3+
LOG: database system is ready to accept connections
4+
LOG: autovacuum launcher started

tools/postgresDB.bat

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@ECHO OFF
2+
3+
echo "Starting DB agent ..."
4+
5+
"pg_ctl" -D "C:\Users\KSAF\Documents\datadir" -l logfile stop
6+
7+
timeout /t 2 /nobreak
8+
9+
"pg_ctl" -D "C:\Users\KSAF\Documents\datadir" -l logfile start
10+
11+
timeout /t 2 /nobreak
12+
13+
echo "DB agent started ..."
14+
15+
pause
16+
17+
pause

wp-activate.php

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
<?php
2+
/**
3+
* Confirms that the activation key that is sent in an email after a user signs
4+
* up for a new site matches the key for that user and then displays confirmation.
5+
*
6+
* @package WordPress
7+
*/
8+
9+
define( 'WP_INSTALLING', true );
10+
11+
/** Sets up the WordPress Environment. */
12+
require( dirname(__FILE__) . '/wp-load.php' );
13+
14+
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
15+
16+
if ( !is_multisite() ) {
17+
wp_redirect( wp_registration_url() );
18+
die();
19+
}
20+
21+
if ( is_object( $wp_object_cache ) )
22+
$wp_object_cache->cache_enabled = false;
23+
24+
// Fix for page title
25+
$wp_query->is_404 = false;
26+
27+
/**
28+
* Fires before the Site Activation page is loaded.
29+
*
30+
* @since 3.0.0
31+
*/
32+
do_action( 'activate_header' );
33+
34+
/**
35+
* Adds an action hook specific to this page.
36+
*
37+
* Fires on {@see 'wp_head'}.
38+
*
39+
* @since MU
40+
*/
41+
function do_activate_header() {
42+
/**
43+
* Fires before the Site Activation page is loaded.
44+
*
45+
* Fires on the {@see 'wp_head'} action.
46+
*
47+
* @since 3.0.0
48+
*/
49+
do_action( 'activate_wp_head' );
50+
}
51+
add_action( 'wp_head', 'do_activate_header' );
52+
53+
/**
54+
* Loads styles specific to this page.
55+
*
56+
* @since MU
57+
*/
58+
function wpmu_activate_stylesheet() {
59+
?>
60+
<style type="text/css">
61+
form { margin-top: 2em; }
62+
#submit, #key { width: 90%; font-size: 24px; }
63+
#language { margin-top: .5em; }
64+
.error { background: #f66; }
65+
span.h3 { padding: 0 8px; font-size: 1.3em; font-weight: bold; }
66+
</style>
67+
<?php
68+
}
69+
add_action( 'wp_head', 'wpmu_activate_stylesheet' );
70+
71+
get_header( 'wp-activate' );
72+
?>
73+
74+
<div id="signup-content" class="widecolumn">
75+
<div class="wp-activate-container">
76+
<?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
77+
78+
<h2><?php _e('Activation Key Required') ?></h2>
79+
<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
80+
<p>
81+
<label for="key"><?php _e('Activation Key:') ?></label>
82+
<br /><input type="text" name="key" id="key" value="" size="50" />
83+
</p>
84+
<p class="submit">
85+
<input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
86+
</p>
87+
</form>
88+
89+
<?php } else {
90+
91+
$key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
92+
$result = wpmu_activate_signup( $key );
93+
if ( is_wp_error($result) ) {
94+
if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
95+
$signup = $result->get_error_data();
96+
?>
97+
<h2><?php _e('Your account is now active!'); ?></h2>
98+
<?php
99+
echo '<p class="lead-in">';
100+
if ( $signup->domain . $signup->path == '' ) {
101+
printf(
102+
/* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */
103+
__( 'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ),
104+
network_site_url( 'wp-login.php', 'login' ),
105+
$signup->user_login,
106+
$signup->user_email,
107+
wp_lostpassword_url()
108+
);
109+
} else {
110+
printf(
111+
/* translators: 1: site URL, 2: site domain, 3: username, 4: user email, 5: lost password URL */
112+
__( 'Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of &#8220;%3$s&#8221;. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.' ),
113+
'http://' . $signup->domain,
114+
$signup->domain,
115+
$signup->user_login,
116+
$signup->user_email,
117+
wp_lostpassword_url()
118+
);
119+
}
120+
echo '</p>';
121+
} else {
122+
?>
123+
<h2><?php _e( 'An error occurred during the activation' ); ?></h2>
124+
<p><?php echo $result->get_error_message(); ?></p>
125+
<?php
126+
}
127+
} else {
128+
$url = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : '';
129+
$user = get_userdata( (int) $result['user_id'] );
130+
?>
131+
<h2><?php _e('Your account is now active!'); ?></h2>
132+
133+
<div id="signup-welcome">
134+
<p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
135+
<p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p>
136+
</div>
137+
138+
<?php if ( $url && $url != network_home_url( '', 'http' ) ) :
139+
switch_to_blog( (int) $result['blog_id'] );
140+
$login_url = wp_login_url();
141+
restore_current_blog();
142+
?>
143+
<p class="view"><?php
144+
/* translators: 1: site URL, 2: login URL */
145+
printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' ), $url, esc_url( $login_url ) );
146+
?></p>
147+
<?php else: ?>
148+
<p class="view"><?php
149+
/* translators: 1: login URL, 2: network home URL */
150+
printf( __( 'Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url( 'wp-login.php', 'login' ), network_home_url() );
151+
?></p>
152+
<?php endif;
153+
}
154+
}
155+
?>
156+
</div>
157+
</div>
158+
<script type="text/javascript">
159+
var key_input = document.getElementById('key');
160+
key_input && key_input.focus();
161+
</script>
162+
<?php get_footer( 'wp-activate' );

0 commit comments

Comments
 (0)