Recent Posts
None | 34 sec ago
None | 1 min ago
None | 1 min ago
None | 2 min ago
None | 2 min ago
Ruby | 2 min ago
None | 3 min ago
Bash | 3 min ago
None | 4 min ago
None | 4 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Anonymous on the 9th of Feb 2010 09:30:32 PM Download | Raw | Embed | Report
  1. # MySQL:
  2.  
  3. # install mysql non-interactively and set root password
  4. DEBIAN_FRONTEND=noninteractive apt-get install mysql-server -y
  5.  
  6. # hang out while sql starts
  7. echo "sleeping for 5 seconds to let MySQL start"
  8. sleep 5
  9.  
  10. # move in our my.cnf file
  11. ln -sf /opt/loggly/web/config/my.cnf /etc/mysql/my.cnf
  12.  
  13. # reset the password
  14. mysqladmin -u root password $DB_MYSQL_ROOT_PWD
  15.  
  16. # build the SQL for the create and priv statements
  17. cat <<EOF>> /tmp/create_django.sql
  18.  
  19. create database django;
  20. grant all privileges on django.* to django@'$LOCAL_FQDN' identified by '$DB_DJANGO_PWD';
  21. grant all privileges on test_django.* to django@'$LOCAL_FQDN' identified by '$DB_DJANGO_PWD';
  22. grant all privileges on django.* to django@'%' identified by '$DB_DJANGO_PWD';
  23. grant all privileges on test_django.* to django@'%' identified by '$DB_DJANGO_PWD';
  24. grant all privileges on django.* to django@'localhost' identified by '$DB_DJANGO_PWD';
  25. grant all privileges on test_django.* to django@'localhost' identified by '$DB_DJANGO_PWD';
  26. use mysql;
  27. update user set password=password('$DB_DJANGO_PWD') where user="django";
  28. flush privileges;
  29.  
  30. EOF
  31.  
  32. # run the SQL
  33. mysql -u root -p$DB_MYSQL_ROOT_PWD < /tmp/create_django.sql
  34.  
  35. # remove the tmp file
  36. #rm -rf /tmp/create_django.sql
  37.  
  38. # stop apache (because django won't work anyway without the syncdb crap, which has to be run manually)
  39. /etc/init.d/apache2 stop
  40.  
  41. # restart mysql
  42. /etc/init.d/mysql restart
  43.  
  44. # populate our fixture for servers
  45. internalip=`ifconfig -a|grep Bcast:|cut -d\: -f2|awk '{print $1}'`
  46. externalip=$EXTERNAL_IP
  47. launchtime=`date +%Y-%m-%d\ %H:%M:%S`
  48.  
  49. cat <<EOF> /opt/loggly/web/app/server/fixtures/initial_data.json
  50. [{"pk": 1, "model": "server.server", "fields": {"fqdn": "dev-web.$DOMAIN", "internal_ip": "$internalip", "external_ip": "$externalip", "role": "web", "launched": "$launchtime", "status": "up"}},{"pk": 2, "model": "server.server", "fields": {"fqdn": "dev-db.$DOMAIN", "internal_ip": "$internalip", "external_ip": "$externalip", "role": "database", "launched": "$launchtime", "status": "up"}},{"pk": 3, "model": "server.server", "fields": {"fqdn": "dev-solr.$DOMAIN", "internal_ip": "$internalip", "external_ip": "$externalip", "role": "indexer", "launched": "$launchtime", "status": "up"}},{"pk": 4, "model": "server.server", "fields": {"fqdn": "dev-proxy.$DOMAIN", "internal_ip": "$internalip", "external_ip": "$externalip", "role": "proxy", "launched": "$launchtime", "status": "up"}}]
  51. EOF
  52.  
  53. # populate our fixture for sites
  54. cat <<EOF> /opt/loggly/web/app/sites/fixtures/initial_data.json
  55. [{"pk": 1, "model": "sites.site", "fields": {"domain": "http://www.$DOMAIN", "name": "$DOMAIN"}}]
  56. EOF
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: