Permalink
Browse files

Modified provisioning to use MySQL

  • Loading branch information...
JensRantil committed Jun 12, 2014
1 parent 489dad0 commit 2a5f04849c10b58ca2424bc55d2b203c8d5627bb
Showing with 13 additions and 11 deletions.
  1. +1 −1 bin/setup_dependencies.sh
  2. +1 −1 conf/production.env.example
  3. +11 −9 fabfile.py
@@ -56,7 +56,7 @@ packages=(
'libxslt-dev'
'nodejs'
'npm'
- 'postgresql-9.1'
+ 'mysql-server'
'nginx'
'htop'
)
@@ -1,4 +1,4 @@
-DATABASE_URL=postgres://cabot:cabot@localhost:5432/index
+DATABASE_URL=mysql://cabot:cabot@localhost/cabot
DJANGO_SETTINGS_MODULE=app.settings
HIPCHAT_URL=https://api.hipchat.com/v1/rooms/message
LOG_FILE=/dev/null
View
@@ -15,9 +15,9 @@
VENV_DIR = '%s/venv' % HOME_DIR
BACKUP_DIR = '/tmp/'
-PG_DATABASE = 'index'
-PG_USERNAME = 'cabot'
-PG_PASSWORD = 'cabot' # You should probably change this
+MY_DATABASE = 'cabot'
+MY_USERNAME = 'cabot'
+MY_PASSWORD = 'cabot' # You should probably change this
def _ensure_dirs():
@@ -150,18 +150,20 @@ def backup():
"""
backup_file = 'outfile.sql.gz'
with cd(BACKUP_DIR):
- run('PGPASSWORD=cabot pg_dump -U cabot index | gzip > {}'.format(backup_file))
+ run('mysqldump -u root {0} | gzip > {1}'.format(MY_DATABASE, backup_file))
get(backup_file, 'backups/%(basename)s')
def create_database():
"""Creates role and database"""
with settings(warn_only=True):
- sudo(
- 'psql -c "CREATE USER %s WITH NOCREATEDB NOCREATEUSER ENCRYPTED PASSWORD E\'%s\'"' %
- (PG_USERNAME, PG_PASSWORD), user='postgres')
- sudo('psql -c "CREATE DATABASE %s WITH OWNER %s"' %
- (PG_DATABASE, PG_USERNAME), user='postgres')
+ run(
+ 'mysql -u root -e "CREATE USER %s@localhost IDENTIFIED BY \'%s\'"' %
+ (MY_USERNAME, MY_PASSWORD))
+ run('mysql -u root -e "CREATE DATABASE %s;"' %
+ (MY_DATABASE,))
+ run('mysql -u root -e "GRANT ALL PRIVILEGES ON `%s`.* TO `%s`@localhost"' %
+ (MY_DATABASE, MY_USERNAME))
@parallel

0 comments on commit 2a5f048

Please sign in to comment.