Browse Source

Add Vagrant machine

* Remove accidentally commmitted module code
* Adjust gitignore files
* Add MakeFile target for pulling down puppet modules
* Add settings file for MySQL/Postgres
master
David Winterbottom 12 years ago
parent
commit
3fca12761a

+ 7
- 6
.gitignore View File

@@ -17,12 +17,6 @@ oscar/share
17 17
 .~lock.*
18 18
 dist/
19 19
 *.DS_Store
20
-sites/sandbox/*.sqlite
21
-sites/sandbox/public/
22
-sites/sandbox/whoosh_index/
23
-sites/demo/*.sqlite
24
-sites/demo/public/
25
-sites/demo/whoosh_index/
26 20
 .idea
27 21
 TODO
28 22
 .coverage
@@ -34,3 +28,10 @@ coverage.xml
34 28
 violations.txt
35 29
 nosetests.xml
36 30
 settings_local.py
31
+.vagrant
32
+sites/sandbox/*.sqlite
33
+sites/sandbox/public/
34
+sites/sandbox/whoosh_index/
35
+sites/demo/*.sqlite
36
+sites/demo/public/
37
+sites/demo/whoosh_index/

+ 0
- 1
.vagrant View File

@@ -1 +0,0 @@
1
-{"active":{"default":"21412894-03d1-4be4-bf6d-d4eca2a5662f"}}

+ 7
- 1
Makefile View File

@@ -38,4 +38,10 @@ i18n:
38 38
 		../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=ru; \
39 39
 		../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=es; \
40 40
 		../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=it; \
41
-		../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=da
41
+		../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=da
42
+
43
+puppet:
44
+	# Install puppet modules required to set-up a Vagrant box
45
+	puppet module install --target-dir sites/puppet/modules/ saz-memcached -v 2.0.2
46
+	git clone git://github.com/uggedal/puppet-module-python.git sites/puppet/modules/python
47
+	git clone git://github.com/codeinthehole/puppet-userconfig.git sites/puppet/modules/userconfig

+ 21
- 0
Vagrantfile View File

@@ -0,0 +1,21 @@
1
+# -*- mode: ruby -*-
2
+# vi: set ft=ruby :
3
+#
4
+# Before bringing up your Vagrant machine, run:
5
+#
6
+#     make puppet
7
+#
8
+# to fetch the puppet modules required to build the VM.
9
+
10
+Vagrant::Config.run do |config|
11
+    config.vm.box = "precise64"
12
+    config.vm.box_url = "http://files.vagrantup.com/precise64.box"
13
+	config.vm.forward_port 8000, 8080
14
+	#config.vm.boot_mode = :gui
15
+    config.vm.provision :puppet do |puppet|
16
+        puppet.manifests_path = "sites/puppet/manifests"
17
+        puppet.manifest_file = "site.pp"
18
+        puppet.module_path = "sites/puppet/modules"
19
+		#puppet.options = "--debug"
20
+    end
21
+end

+ 3
- 1
setup.py View File

@@ -8,9 +8,11 @@ To release a new version to PyPi:
8 8
 """
9 9
 
10 10
 from setuptools import setup, find_packages
11
+import os
11 12
 
12 13
 from oscar import get_version
13 14
 
15
+PROJECT_DIR = os.path.dirname(__file__)
14 16
 
15 17
 setup(name='django-oscar',
16 18
       version=get_version().replace(' ', '-'),
@@ -18,7 +20,7 @@ setup(name='django-oscar',
18 20
       author="David Winterbottom",
19 21
       author_email="david.winterbottom@tangentlabs.co.uk",
20 22
       description="A domain-driven e-commerce framework for Django 1.3+",
21
-      long_description=open('README.rst').read(),
23
+      long_description=open(os.path.join(PROJECT_DIR, 'README.rst')).read(),
22 24
       keywords="E-commerce, Django, domain-driven",
23 25
       license='BSD',
24 26
       platforms=['linux'],

+ 4
- 1
sites/puppet/manifests/site.pp View File

@@ -10,6 +10,9 @@ node precise64 {
10 10
 	class {"memcached": max_memory => 64 }
11 11
 
12 12
 	# Python
13
+	# - set-up a virtualenv
14
+	# - install testing requirements
15
+	# - install oscar in 'develop' mode
13 16
 	$virtualenv = "/var/www/virtualenv"
14 17
 	include python::dev
15 18
 	include python::venv
@@ -17,7 +20,7 @@ node precise64 {
17 20
 	    requirements => "/vagrant/requirements.txt"
18 21
 	}
19 22
     exec {"install-oscar":
20
-	    command => "$virtualenv/bin/python /vagrant/setup.py develop",
23
+	    command => "cd /vagrant && $virtualenv/bin/python setup.py develop",
21 24
 		require => Python::Venv::Isolate[$virtualenv]
22 25
 	}
23 26
 }

+ 0
- 8
sites/puppet/modules/memcached/Modulefile View File

@@ -1,8 +0,0 @@
1
-name    'saz-memcached'
2
-version '2.0.2'
3
-source 'git://github.com/saz/puppet-memcached.git'
4
-author 'saz'
5
-license 'Apache License, Version 2.0'
6
-summary 'UNKNOWN'
7
-description 'Manage memcached via Puppet'
8
-project_page 'https://github.com/saz/puppet-memcached'

+ 0
- 9
sites/puppet/modules/memcached/README-DEVELOPER View File

@@ -1,9 +0,0 @@
1
-In order to run tests:
2
-  - puppet and facter must be installed and available in Ruby's LOADPATH
3
-  - the latest revision of rspec-puppet must be installed
4
-  - rake, and rspec2 must be install
5
-
6
-  - the name of the module directory needs to be memcached
7
-
8
-to run all tests:
9
-  rake spec

+ 0
- 29
sites/puppet/modules/memcached/README.md View File

@@ -1,29 +0,0 @@
1
-
2
-# puppet-memcached
3
-
4
-Manage memcached via Puppet
5
-
6
-## How to use
7
-
8
-### Use roughly 90% of memory
9
-
10
-```
11
-    class { 'memcached': }
12
-```
13
-
14
-### Set a fixed memory limit in MB
15
-
16
-```
17
-    class { 'memcached':
18
-      max_memory => 2048
19
-    }
20
-```
21
-
22
-### Other class parameters
23
-
24
-* $logfile = '/var/log/memcached.log'
25
-* $listen_ip = '0.0.0.0'
26
-* $tcp_port = 11211
27
-* $udp_port = 11211
28
-* $user = '' (OS specific setting, see params.pp)
29
-* $max_connections = 8192

+ 0
- 17
sites/puppet/modules/memcached/Rakefile View File

@@ -1,17 +0,0 @@
1
-require 'rubygems'
2
-require 'rake'
3
-require 'rspec/core/rake_task'
4
-
5
-task :default => [:spec]
6
-
7
-desc "Run all module spec tests (Requires rspec-puppet gem)"
8
-RSpec::Core::RakeTask.new(:spec) do |t|
9
-  t.rspec_opts = ['--color']
10
-  # ignores fixtures directory.
11
-  t.pattern = 'spec/{classes,defines,unit}/**/*_spec.rb'
12
-end
13
-
14
-desc "Build package"
15
-task :build do
16
-  system("puppet-module build")
17
-end

+ 0
- 33
sites/puppet/modules/memcached/manifests/init.pp View File

@@ -1,33 +0,0 @@
1
-class memcached(
2
-  $package_ensure  = 'present',
3
-  $logfile         = '/var/log/memcached.log',
4
-  $max_memory      = false,
5
-  $listen_ip       = '0.0.0.0',
6
-  $tcp_port        = 11211,
7
-  $udp_port        = 11211,
8
-  $user            = $::memcached::params::user,
9
-  $max_connections = '8192',
10
-  $verbosity       = undef,
11
-  $unix_socket     = undef
12
-) inherits memcached::params {
13
-
14
-  package { $memcached::params::package_name:
15
-    ensure => $package_ensure,
16
-  }
17
-
18
-  file { $memcached::params::config_file:
19
-    owner   => 'root',
20
-    group   => 'root',
21
-    mode    => '0644',
22
-    content => template($memcached::params::config_tmpl),
23
-    require => Package[$memcached::params::package_name],
24
-  }
25
-
26
-  service { $memcached::params::service_name:
27
-    ensure     => running,
28
-    enable     => true,
29
-    hasrestart => true,
30
-    hasstatus  => false,
31
-    subscribe  => File[$memcached::params::config_file],
32
-  }
33
-}

+ 0
- 21
sites/puppet/modules/memcached/manifests/params.pp View File

@@ -1,21 +0,0 @@
1
-class memcached::params {
2
-  case $::osfamily {
3
-    'Debian': {
4
-      $package_name = 'memcached'
5
-      $service_name = 'memcached'
6
-      $config_file  = '/etc/memcached.conf'
7
-      $config_tmpl  = "${module_name}/memcached.conf.erb"
8
-      $user = 'nobody'
9
-    }
10
-    'RedHat': {
11
-      $package_name = 'memcached'
12
-      $service_name = 'memcached'
13
-      $config_file  = '/etc/sysconfig/memcached'
14
-      $config_tmpl  = "${module_name}/memcached_sysconfig.erb"
15
-      $user = 'memcached'
16
-    }
17
-    default: {
18
-      fail("Unsupported platform: ${::osfamily}")
19
-    }
20
-  }
21
-}

+ 0
- 31
sites/puppet/modules/memcached/metadata.json View File

@@ -1,31 +0,0 @@
1
-{
2
-  "license": "Apache License, Version 2.0",
3
-  "source": "git://github.com/saz/puppet-memcached.git",
4
-  "description": "Manage memcached via Puppet",
5
-  "dependencies": [
6
-
7
-  ],
8
-  "summary": "UNKNOWN",
9
-  "types": [
10
-
11
-  ],
12
-  "author": "saz",
13
-  "version": "2.0.2",
14
-  "name": "saz-memcached",
15
-  "checksums": {
16
-    "templates/memcached_sysconfig.erb": "fdcbb4381b08683291fe7da542a6435f",
17
-    "templates/memcached.conf.erb": "c86e1c762e655461c0651e16e094b52e",
18
-    "README-DEVELOPER": "d45048731ddb158a56a1b26293fb5dbf",
19
-    "spec/fixtures/manifests/site.pp": "d41d8cd98f00b204e9800998ecf8427e",
20
-    "spec/classes/memcached_spec.rb": "abaa4afe238f7cf599bea859a8d37bfa",
21
-    "tests/init.pp": "e798f4999ba392f3c0fce0d5290c263f",
22
-    "Rakefile": "5e1b5fb743446de634dbba3093a255cf",
23
-    "README.md": "02b0390847cb84c98c2c53c042f97b62",
24
-    "spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c",
25
-    "manifests/params.pp": "6eafeac3502dec0a85b13aa9b7b2bac2",
26
-    "Modulefile": "41b0bfec37d8a4d807352b7d94b2e76e",
27
-    "manifests/init.pp": "0030a2858c6866425183adbd651d17e7",
28
-    "spec/spec_helper.rb": "983ae671e9a03e34b55b16e0476bf1c8"
29
-  },
30
-  "project_page": "https://github.com/saz/puppet-memcached"
31
-}

+ 0
- 101
sites/puppet/modules/memcached/spec/classes/memcached_spec.rb View File

@@ -1,101 +0,0 @@
1
-require 'spec_helper'
2
-describe 'memcached' do
3
-
4
-  let :default_params do
5
-    {
6
-      :package_ensure  => 'present',
7
-      :logfile         => '/var/log/memcached.log',
8
-      :max_memory      => false,
9
-      :listen_ip       => '0.0.0.0',
10
-      :tcp_port        => '11211',
11
-      :udp_port        => '11211',
12
-      :user            => 'nobody',
13
-      :max_connections => '8192'
14
-    }
15
-  end
16
-
17
-  [ {},
18
-    {
19
-      :package_ensure  => 'latest',
20
-      :logfile         => '/var/log/memcached.log',
21
-      :max_memory      => '2',
22
-      :listen_ip       => '127.0.0.1',
23
-      :tcp_port        => '11212',
24
-      :udp_port        => '11213',
25
-      :user            => 'somebdy',
26
-      :max_connections => '8193'
27
-    }
28
-  ].each do |param_set|
29
-    describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
30
-
31
-      let :param_hash do
32
-        default_params.merge(param_set)
33
-      end
34
-
35
-      let :params do
36
-        param_set
37
-      end
38
-
39
-      ['Debian'].each do |osfamily|
40
-
41
-        let :facts do
42
-          {
43
-            :osfamily => osfamily,
44
-            :memorysize => '1',
45
-            :processorcount => '1',
46
-          }
47
-        end
48
-
49
-        describe "on supported osfamily: #{osfamily}" do
50
-
51
-          it { should contain_class('memcached::params') }
52
-
53
-          it { should contain_package('memcached').with_ensure(param_hash[:package_ensure]) }
54
-
55
-          it { should contain_file('/etc/memcached.conf').with(
56
-            'owner'   => 'root',
57
-            'group'   => 'root'
58
-          )}
59
-
60
-          it { should contain_service('memcached').with(
61
-            'ensure'     => 'running',
62
-            'enable'     => true,
63
-            'hasrestart' => true,
64
-            'hasstatus'  => false
65
-          )}
66
-
67
-          it 'should compile the template based on the class parameters' do
68
-            content = param_value(
69
-              subject,
70
-              'file',
71
-              '/etc/memcached.conf',
72
-              'content'
73
-            )
74
-            expected_lines = [
75
-              "logfile #{param_hash[:logfile]}",
76
-              "-l #{param_hash[:listen_ip]}",
77
-              "-p #{param_hash[:tcp_port]}",
78
-              "-U #{param_hash[:udp_port]}",
79
-              "-u #{param_hash[:user]}",
80
-              "-c #{param_hash[:max_connections]}",
81
-              "-t #{facts[:processorcount]}"
82
-            ]
83
-            if(param_hash[:max_memory])
84
-              expected_lines.push("-m #{param_hash[:max_memory]}")
85
-            else
86
-              expected_lines.push("-m #{((facts[:memorysize].to_f*1024)*0.95).floor}")
87
-            end
88
-            (content.split("\n") & expected_lines).should =~ expected_lines
89
-          end
90
-        end
91
-      end
92
-      ['Redhat'].each do |osfamily|
93
-        describe 'on supported platform' do
94
-          it 'should fail' do
95
-
96
-          end
97
-        end
98
-      end
99
-    end
100
-  end
101
-end

+ 0
- 0
sites/puppet/modules/memcached/spec/fixtures/manifests/site.pp View File


+ 0
- 6
sites/puppet/modules/memcached/spec/spec.opts View File

@@ -1,6 +0,0 @@
1
---format
2
-s
3
---colour
4
---loadby
5
-mtime
6
---backtrace

+ 0
- 13
sites/puppet/modules/memcached/spec/spec_helper.rb View File

@@ -1,13 +0,0 @@
1
-require 'puppet'
2
-require 'rubygems'
3
-require 'rspec-puppet'
4
-
5
-# get the value of a certain parameter
6
-def param_value(subject, type, title, param)
7
-  subject.resource(type, title).send(:parameters)[param.to_sym]
8
-end
9
-
10
-RSpec.configure do |c|
11
-  c.module_path = File.join(File.dirname(__FILE__), '../../')
12
-  c.manifest_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/manifests'))
13
-end

+ 0
- 46
sites/puppet/modules/memcached/templates/memcached.conf.erb View File

@@ -1,46 +0,0 @@
1
-# File managed by puppet
2
-
3
-# Run memcached as a daemon.
4
--d
5
-
6
-# pidfile
7
--P /var/run/memcached.pid
8
-
9
-# Log memcached's output
10
-logfile <%= logfile %>
11
-
12
-<% if @verbosity -%>
13
-# Verbosity
14
--<%= verbosity %>
15
-<% end -%>
16
-
17
-# Use <num> MB memory max to use for object storage.
18
-<% if max_memory -%>
19
--m <%= max_memory %>
20
-<% else -%>
21
--m <%= ((memorysize.to_f*1024)*0.95).floor %>
22
-<% end -%>
23
-
24
-<% if @unix_socket -%>
25
-# UNIX socket path to listen on
26
--s <%= unix_socket %>
27
-<% else -%>
28
-
29
-# IP to listen on
30
--l <%= listen_ip %>
31
-
32
-# TCP port to listen on
33
--p <%= tcp_port %>
34
-
35
-# UDP port to listen on
36
--U <%= udp_port %>
37
-<% end -%>
38
-
39
-# Run daemon as user
40
--u <%= user %>
41
-
42
-# Limit the number of simultaneous incoming connections.
43
--c <%= max_connections %>
44
-
45
-# Number of threads to use to process incoming requests.
46
--t <%= processorcount %>

+ 0
- 5
sites/puppet/modules/memcached/templates/memcached_sysconfig.erb View File

@@ -1,5 +0,0 @@
1
-PORT="<%= udp_port %>"
2
-USER="<%= user %>"
3
-MAXCONN="<%= max_connections %>"
4
-CACHESIZE="<%= max_memory %>"
5
-OPTIONS=""

+ 0
- 1
sites/puppet/modules/memcached/tests/init.pp View File

@@ -1 +0,0 @@
1
-include memcached

+ 0
- 1
sites/puppet/modules/python

@@ -1 +0,0 @@
1
-Subproject commit d12cc81c170e5dbc78973f30a35e1b36da667a89

+ 0
- 1
sites/puppet/modules/userconfig

@@ -1 +0,0 @@
1
-Subproject commit a6faba58ebfeef2ea84b6614853da24b383e1409

+ 0
- 1
sites/sandbox/settings.py View File

@@ -265,7 +265,6 @@ AUTH_PROFILE_MODULE = 'user.Profile'
265 265
 # Oscar settings
266 266
 from oscar.defaults import *
267 267
 
268
-
269 268
 OSCAR_RECENTLY_VIEWED_PRODUCTS = 20
270 269
 OSCAR_ALLOW_ANON_CHECKOUT = True
271 270
 OSCAR_INITIAL_ORDER_STATUS = 'Pending'

+ 10
- 0
sites/sandbox/settings_mysql.py View File

@@ -0,0 +1,10 @@
1
+DATABASES = {
2
+    'default': {
3
+        'ENGINE': 'django.db.backends.mysql',
4
+        'NAME': 'oscar',
5
+        'USER': 'oscar_vagrant',
6
+        'PASSWORD': 'oscar_password',
7
+        'HOST': '',
8
+        'PORT': '',
9
+    }
10
+}

+ 10
- 0
sites/sandbox/settings_postgres.py View File

@@ -0,0 +1,10 @@
1
+DATABASES = {
2
+    'default': {
3
+        'ENGINE': 'django.contrib.gis.db.backends.postgis',
4
+        'NAME': 'oscar',
5
+        'USER': 'oscar_vagrant',
6
+        'PASSWORD': 'oscar_password',
7
+        'HOST': '',
8
+        'PORT': '',
9
+    }
10
+}

Loading…
Cancel
Save