Skip to content

Commit c08e634

Browse files
committed
Add MySQL support to Vagrant machine
1 parent 5ee2541 commit c08e634

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ puppet:
4444
# Install puppet modules required to set-up a Vagrant box
4545
rm -rf sites/puppet/modules/*
4646
puppet module install --target-dir sites/puppet/modules/ saz-memcached -v 2.0.2
47+
puppet module install --target-dir sites/puppet/modules/ puppetlabs/mysql
4748
git clone git://github.com/akumria/puppet-postgresql.git sites/puppet/modules/postgresql
4849
git clone git://github.com/uggedal/puppet-module-python.git sites/puppet/modules/python
4950
git clone git://github.com/codeinthehole/puppet-userconfig.git sites/puppet/modules/userconfig

requirements_vagrant.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MySQL-python==1.2.4c1
2+
psycopg2==2.4.5

setup.py

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
PROJECT_DIR = os.path.dirname(__file__)
1616

17+
# Change to the current directory to solve an issue installing Oscar on the Vagrant machine.
18+
os.chdir(PROJECT_DIR)
19+
1720
setup(name='django-oscar',
1821
version=get_version().replace(' ', '-'),
1922
url='https://github.com/tangentlabs/django-oscar',

sites/puppet/manifests/site.pp

+17-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"python-imaging",
1414
"python-memcache",
1515
"postgresql-server-dev-9.1",
16+
"libmysqlclient-dev",
1617
]
1718
package {
1819
$packages: ensure => installed,
@@ -46,6 +47,18 @@
4647
encoding => "UTF8",
4748
}
4849

50+
# MySQL
51+
class {"mysql::python": }
52+
class {"mysql::server":
53+
config_hash => {"root_password" => "root_password"}
54+
}
55+
mysql::db {$database_name:
56+
user => $user,
57+
password => $password,
58+
host => "localhost",
59+
grant => ["all"],
60+
}
61+
4962
# Python
5063
# - set-up a virtualenv
5164
# - install testing requirements
@@ -56,8 +69,11 @@
5669
python::venv::isolate { $virtualenv:
5770
requirements => "/vagrant/requirements.txt"
5871
}
72+
python::pip::requirements {"/vagrant/requirements_vagrant.txt":
73+
venv => $virtualenv,
74+
}
5975
exec {"install-oscar":
60-
command => "$virtualenv/bin/python setup.py develop",
76+
command => "$virtualenv/bin/python /vagrant/setup.py develop",
6177
require => Python::Venv::Isolate[$virtualenv]
6278
}
6379
}

sites/sandbox/settings_mysql.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
from settings import *
2+
13
DATABASES = {
24
'default': {
35
'ENGINE': 'django.db.backends.mysql',
4-
'NAME': 'oscar',
5-
'USER': 'oscar_vagrant',
6+
'NAME': 'oscar_vagrant',
7+
'USER': 'oscar_user',
68
'PASSWORD': 'oscar_password',
7-
'HOST': '',
9+
'HOST': 'localhost',
810
'PORT': '',
911
}
1012
}

0 commit comments

Comments
 (0)