Skip to content

Commit

Permalink
fixes to default http configs, dev server, setup.sh and manage scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmark committed Jan 31, 2012
1 parent 582a405 commit 43571ca
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 25 deletions.
2 changes: 2 additions & 0 deletions bin/manage.sh
Expand Up @@ -49,6 +49,8 @@ then
# Have to run as root so we can use port 80. WordPress won't run # Have to run as root so we can use port 80. WordPress won't run
# on an abitrary port. We need to pass the username in so we can # on an abitrary port. We need to pass the username in so we can
# tell the webserver to run as the local user. # tell the webserver to run as the local user.
echo "Need to run the server as root so we can use port 80. Your sudo password, please."

sudo tools/bin/runserver.py `whoami` sudo tools/bin/runserver.py `whoami`
else else
exit 0 exit 0
Expand Down
9 changes: 5 additions & 4 deletions bin/runserver.py
Expand Up @@ -164,20 +164,21 @@
break break


if php.poll() is 0: if php.poll() is 0:
print "nginx finished." print "php finished."
break break
elif php.poll() > 0: elif php.poll() > 0:
print "nginx exited badly." print "php exited badly."
break break


if memcache.poll() is 0: if memcache.poll() is 0:
print "nginx finished." print "memcache finished."
break break
elif memcache.poll() > 0: elif memcache.poll() > 0:
print "nginx exited badly." print "memcache exited badly."
break break


time.sleep(1) time.sleep(1)

except KeyboardInterrupt: except KeyboardInterrupt:
sys.stdout.write('\nstopping...') sys.stdout.write('\nstopping...')
nginx.terminate() nginx.terminate()
Expand Down
30 changes: 18 additions & 12 deletions fablib.py
Expand Up @@ -144,26 +144,28 @@ def bootstrap():


with settings(warn_only=True): with settings(warn_only=True):
env.run('rm wp-config.php'); env.run('rm wp-config.php');
env.run(env.prefix + './runscript.sh setup_wp-config') env.run(env.prefix + './manage.sh setup_wp-config')


create_db() create_db()
env.run(env.prefix + './runscript.sh install') env.run(env.prefix + './manage.sh install')
env.run(env.prefix + './runscript.sh install_network') env.run(env.prefix + './manage.sh install_network')


with settings(warn_only=True): with settings(warn_only=True):
env.run('rm wp-config.php'); env.run('rm wp-config.php');
env.run(env.prefix + './runscript.sh setup_wp-config --finish') env.run(env.prefix + './manage.sh setup_wp-config --finish')


print("\nStep 3: Setup plugins") print("\nStep 3: Setup plugins")


env.run(env.prefix + './runscript.sh setup_plugins') env.run(env.prefix + './manage.sh setup_plugins')


print("\nStep 4: Cleanup, create blogs") print("\nStep 4: Cleanup, create blogs")


env.run(env.prefix + './runscript.sh set_root_blog_defaults') env.run(env.prefix + './manage.sh set_root_blog_defaults')


if confirm("Create child blogs?"): create_blogs() if confirm("Create child blogs?"): create_blogs()


env.run(env.prefix + './manage.sh setup_upload_dirs')



def create_db(): def create_db():
if not env.db_root_pass: if not env.db_root_pass:
Expand Down Expand Up @@ -215,16 +217,20 @@ def reload_db(dump_slug='dump'):
destroy_db() destroy_db()
create_db() create_db()
with cd(env.path): with cd(env.path):
env.run(env.prefix + './manage.sh setup_wp-config --finish' % env ) env.run(env.prefix + './manage.sh setup_wp-config --finish' )
load_db(dump_slug) load_db(dump_slug)




def create_blogs(): def create_blogs():
with cd(env.path): i = 0
i = 0 response = ''
response = '' while "No more blogs" not in response:
while "No more blogs" not in response: with cd(env.path):
response = env.run(env.prefix + "./manage.sh setup_blog -n %s" % i) if env.has_key('settings'):
response = env.run(env.prefix + "./manage.sh setup_blog -n %s" % i)
else:
response = env.run(env.prefix + "./manage.sh setup_blog -n %s" % i, capture=True)
print( response )
i += 1 i += 1




Expand Down
4 changes: 2 additions & 2 deletions sample-http/development-nginx.conf
Expand Up @@ -40,10 +40,10 @@ server {
alias /tmp/nginxroot/themes; alias /tmp/nginxroot/themes;
} }
location ^~ /wp-content/blogs.dir { location ^~ /wp-content/blogs.dir {
alias /tmp/nginxroot/blogs.dir; alias /tmp/nginxroot/media/blogs.dir;
} }
location ^~ /wp-content/uploads { location ^~ /wp-content/uploads {
alias /tmp/nginxroot/uploads; alias /tmp/nginxroot/media/uploads;
} }
location ^~ /wp-content/media { location ^~ /wp-content/media {
alias /tmp/nginxroot/media; alias /tmp/nginxroot/media;
Expand Down
4 changes: 2 additions & 2 deletions sample-http/production-nginx.conf
Expand Up @@ -38,10 +38,10 @@ server {
alias /home/wordpress/sites/example/themes; alias /home/wordpress/sites/example/themes;
} }
location ^~ /wp-content/blogs.dir { location ^~ /wp-content/blogs.dir {
alias /home/wordpress/sites/example/blogs.dir; alias /home/wordpress/sites/example/media/blogs.dir;
} }
location ^~ /wp-content/uploads { location ^~ /wp-content/uploads {
alias /home/wordpress/sites/example/uploads; alias /home/wordpress/sites/example/media/uploads;
} }
location ^~ /wp-content/media { location ^~ /wp-content/media {
alias /home/wordpress/sites/example/media; alias /home/wordpress/sites/example/media;
Expand Down
4 changes: 2 additions & 2 deletions sample-http/staging-nginx.conf
Expand Up @@ -38,10 +38,10 @@ server {
alias /home/wordpress/sites/example/themes; alias /home/wordpress/sites/example/themes;
} }
location ^~ /wp-content/blogs.dir { location ^~ /wp-content/blogs.dir {
alias /home/wordpress/sites/example/blogs.dir; alias /home/wordpress/sites/example/media/blogs.dir;
} }
location ^~ /wp-content/uploads { location ^~ /wp-content/uploads {
alias /home/wordpress/sites/example/uploads; alias /home/wordpress/sites/example/media/uploads;
} }
location ^~ /wp-content/media { location ^~ /wp-content/media {
alias /home/wordpress/sites/example/media; alias /home/wordpress/sites/example/media;
Expand Down
8 changes: 5 additions & 3 deletions setup.sh
Expand Up @@ -41,9 +41,6 @@ cd wordpress
git checkout $WORDPRESS_TAG git checkout $WORDPRESS_TAG
cd $PROJECT_DIR cd $PROJECT_DIR


# Link up themes that ship with WordPress
ln -s wordpress/wp-content/themes/* themes/

# Get Akismet # Get Akismet
git submodule add https://github.com/git-mirror/wordpress-akismet.git plugins/akismet git submodule add https://github.com/git-mirror/wordpress-akismet.git plugins/akismet


Expand All @@ -62,10 +59,15 @@ git add .
git commit -m "WordPress project setup" git commit -m "WordPress project setup"


echo "----------------------------------------------------" echo "----------------------------------------------------"
echo ""
echo " Please review the configuration in data/ and http/ " echo " Please review the configuration in data/ and http/ "
echo "" echo ""
echo " When you are satisfied with the configuration, run " echo " When you are satisfied with the configuration, run "
echo " ./manage.sh setup_env" echo " ./manage.sh setup_env"
echo " to get the proper libraries installed, then run" echo " to get the proper libraries installed, then run"
echo " fab bootstrap" echo " fab bootstrap"
echo " to install your WordPress blog" echo " to install your WordPress blog"
echo ""
echo " If you want to use the themes that come with"
echo " WordPress, run:"
echo " cp -rf wordpress/wp-content/themes/* themes/"

0 comments on commit 43571ca

Please sign in to comment.