Permalink
Browse files

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
  • Loading branch information...
codeinthehole committed Oct 1, 2012
1 parent a986bc5 commit 3fca12761ab855502d6e2f456cb5247b6feffc78
View
@@ -17,12 +17,6 @@ oscar/share
.~lock.*
dist/
*.DS_Store
-sites/sandbox/*.sqlite
-sites/sandbox/public/
-sites/sandbox/whoosh_index/
-sites/demo/*.sqlite
-sites/demo/public/
-sites/demo/whoosh_index/
.idea
TODO
.coverage
@@ -34,3 +28,10 @@ coverage.xml
violations.txt
nosetests.xml
settings_local.py
+.vagrant
+sites/sandbox/*.sqlite
+sites/sandbox/public/
+sites/sandbox/whoosh_index/
+sites/demo/*.sqlite
+sites/demo/public/
+sites/demo/whoosh_index/
View
@@ -1 +0,0 @@
-{"active":{"default":"21412894-03d1-4be4-bf6d-d4eca2a5662f"}}
View
@@ -38,4 +38,10 @@ i18n:
../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=ru; \
../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=es; \
../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=it; \
- ../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=da
+ ../sites/sandbox/manage.py makemessages --ignore=sandbox/ --locale=da
+
+puppet:
+ # Install puppet modules required to set-up a Vagrant box
+ puppet module install --target-dir sites/puppet/modules/ saz-memcached -v 2.0.2
+ git clone git://github.com/uggedal/puppet-module-python.git sites/puppet/modules/python
+ git clone git://github.com/codeinthehole/puppet-userconfig.git sites/puppet/modules/userconfig
View
@@ -0,0 +1,21 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+#
+# Before bringing up your Vagrant machine, run:
+#
+# make puppet
+#
+# to fetch the puppet modules required to build the VM.
+
+Vagrant::Config.run do |config|
+ config.vm.box = "precise64"
+ config.vm.box_url = "http://files.vagrantup.com/precise64.box"
+ config.vm.forward_port 8000, 8080
+ #config.vm.boot_mode = :gui
+ config.vm.provision :puppet do |puppet|
+ puppet.manifests_path = "sites/puppet/manifests"
+ puppet.manifest_file = "site.pp"
+ puppet.module_path = "sites/puppet/modules"
+ #puppet.options = "--debug"
+ end
+end
View
@@ -8,17 +8,19 @@
"""
from setuptools import setup, find_packages
+import os
from oscar import get_version
+PROJECT_DIR = os.path.dirname(__file__)
setup(name='django-oscar',
version=get_version().replace(' ', '-'),
url='https://github.com/tangentlabs/django-oscar',
author="David Winterbottom",
author_email="david.winterbottom@tangentlabs.co.uk",
description="A domain-driven e-commerce framework for Django 1.3+",
- long_description=open('README.rst').read(),
+ long_description=open(os.path.join(PROJECT_DIR, 'README.rst')).read(),
keywords="E-commerce, Django, domain-driven",
license='BSD',
platforms=['linux'],
@@ -10,14 +10,17 @@
class {"memcached": max_memory => 64 }
# Python
+ # - set-up a virtualenv
+ # - install testing requirements
+ # - install oscar in 'develop' mode
$virtualenv = "/var/www/virtualenv"
include python::dev
include python::venv
python::venv::isolate { $virtualenv:
requirements => "/vagrant/requirements.txt"
}
exec {"install-oscar":
- command => "$virtualenv/bin/python /vagrant/setup.py develop",
+ command => "cd /vagrant && $virtualenv/bin/python setup.py develop",
require => Python::Venv::Isolate[$virtualenv]
}
}
@@ -1,8 +0,0 @@
-name 'saz-memcached'
-version '2.0.2'
-source 'git://github.com/saz/puppet-memcached.git'
-author 'saz'
-license 'Apache License, Version 2.0'
-summary 'UNKNOWN'
-description 'Manage memcached via Puppet'
-project_page 'https://github.com/saz/puppet-memcached'
@@ -1,9 +0,0 @@
-In order to run tests:
- - puppet and facter must be installed and available in Ruby's LOADPATH
- - the latest revision of rspec-puppet must be installed
- - rake, and rspec2 must be install
-
- - the name of the module directory needs to be memcached
-
-to run all tests:
- rake spec
@@ -1,29 +0,0 @@
-
-# puppet-memcached
-
-Manage memcached via Puppet
-
-## How to use
-
-### Use roughly 90% of memory
-
-```
- class { 'memcached': }
-```
-
-### Set a fixed memory limit in MB
-
-```
- class { 'memcached':
- max_memory => 2048
- }
-```
-
-### Other class parameters
-
-* $logfile = '/var/log/memcached.log'
-* $listen_ip = '0.0.0.0'
-* $tcp_port = 11211
-* $udp_port = 11211
-* $user = '' (OS specific setting, see params.pp)
-* $max_connections = 8192
@@ -1,17 +0,0 @@
-require 'rubygems'
-require 'rake'
-require 'rspec/core/rake_task'
-
-task :default => [:spec]
-
-desc "Run all module spec tests (Requires rspec-puppet gem)"
-RSpec::Core::RakeTask.new(:spec) do |t|
- t.rspec_opts = ['--color']
- # ignores fixtures directory.
- t.pattern = 'spec/{classes,defines,unit}/**/*_spec.rb'
-end
-
-desc "Build package"
-task :build do
- system("puppet-module build")
-end
@@ -1,33 +0,0 @@
-class memcached(
- $package_ensure = 'present',
- $logfile = '/var/log/memcached.log',
- $max_memory = false,
- $listen_ip = '0.0.0.0',
- $tcp_port = 11211,
- $udp_port = 11211,
- $user = $::memcached::params::user,
- $max_connections = '8192',
- $verbosity = undef,
- $unix_socket = undef
-) inherits memcached::params {
-
- package { $memcached::params::package_name:
- ensure => $package_ensure,
- }
-
- file { $memcached::params::config_file:
- owner => 'root',
- group => 'root',
- mode => '0644',
- content => template($memcached::params::config_tmpl),
- require => Package[$memcached::params::package_name],
- }
-
- service { $memcached::params::service_name:
- ensure => running,
- enable => true,
- hasrestart => true,
- hasstatus => false,
- subscribe => File[$memcached::params::config_file],
- }
-}
@@ -1,21 +0,0 @@
-class memcached::params {
- case $::osfamily {
- 'Debian': {
- $package_name = 'memcached'
- $service_name = 'memcached'
- $config_file = '/etc/memcached.conf'
- $config_tmpl = "${module_name}/memcached.conf.erb"
- $user = 'nobody'
- }
- 'RedHat': {
- $package_name = 'memcached'
- $service_name = 'memcached'
- $config_file = '/etc/sysconfig/memcached'
- $config_tmpl = "${module_name}/memcached_sysconfig.erb"
- $user = 'memcached'
- }
- default: {
- fail("Unsupported platform: ${::osfamily}")
- }
- }
-}
@@ -1,31 +0,0 @@
-{
- "license": "Apache License, Version 2.0",
- "source": "git://github.com/saz/puppet-memcached.git",
- "description": "Manage memcached via Puppet",
- "dependencies": [
-
- ],
- "summary": "UNKNOWN",
- "types": [
-
- ],
- "author": "saz",
- "version": "2.0.2",
- "name": "saz-memcached",
- "checksums": {
- "templates/memcached_sysconfig.erb": "fdcbb4381b08683291fe7da542a6435f",
- "templates/memcached.conf.erb": "c86e1c762e655461c0651e16e094b52e",
- "README-DEVELOPER": "d45048731ddb158a56a1b26293fb5dbf",
- "spec/fixtures/manifests/site.pp": "d41d8cd98f00b204e9800998ecf8427e",
- "spec/classes/memcached_spec.rb": "abaa4afe238f7cf599bea859a8d37bfa",
- "tests/init.pp": "e798f4999ba392f3c0fce0d5290c263f",
- "Rakefile": "5e1b5fb743446de634dbba3093a255cf",
- "README.md": "02b0390847cb84c98c2c53c042f97b62",
- "spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c",
- "manifests/params.pp": "6eafeac3502dec0a85b13aa9b7b2bac2",
- "Modulefile": "41b0bfec37d8a4d807352b7d94b2e76e",
- "manifests/init.pp": "0030a2858c6866425183adbd651d17e7",
- "spec/spec_helper.rb": "983ae671e9a03e34b55b16e0476bf1c8"
- },
- "project_page": "https://github.com/saz/puppet-memcached"
-}
@@ -1,101 +0,0 @@
-require 'spec_helper'
-describe 'memcached' do
-
- let :default_params do
- {
- :package_ensure => 'present',
- :logfile => '/var/log/memcached.log',
- :max_memory => false,
- :listen_ip => '0.0.0.0',
- :tcp_port => '11211',
- :udp_port => '11211',
- :user => 'nobody',
- :max_connections => '8192'
- }
- end
-
- [ {},
- {
- :package_ensure => 'latest',
- :logfile => '/var/log/memcached.log',
- :max_memory => '2',
- :listen_ip => '127.0.0.1',
- :tcp_port => '11212',
- :udp_port => '11213',
- :user => 'somebdy',
- :max_connections => '8193'
- }
- ].each do |param_set|
- describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
-
- let :param_hash do
- default_params.merge(param_set)
- end
-
- let :params do
- param_set
- end
-
- ['Debian'].each do |osfamily|
-
- let :facts do
- {
- :osfamily => osfamily,
- :memorysize => '1',
- :processorcount => '1',
- }
- end
-
- describe "on supported osfamily: #{osfamily}" do
-
- it { should contain_class('memcached::params') }
-
- it { should contain_package('memcached').with_ensure(param_hash[:package_ensure]) }
-
- it { should contain_file('/etc/memcached.conf').with(
- 'owner' => 'root',
- 'group' => 'root'
- )}
-
- it { should contain_service('memcached').with(
- 'ensure' => 'running',
- 'enable' => true,
- 'hasrestart' => true,
- 'hasstatus' => false
- )}
-
- it 'should compile the template based on the class parameters' do
- content = param_value(
- subject,
- 'file',
- '/etc/memcached.conf',
- 'content'
- )
- expected_lines = [
- "logfile #{param_hash[:logfile]}",
- "-l #{param_hash[:listen_ip]}",
- "-p #{param_hash[:tcp_port]}",
- "-U #{param_hash[:udp_port]}",
- "-u #{param_hash[:user]}",
- "-c #{param_hash[:max_connections]}",
- "-t #{facts[:processorcount]}"
- ]
- if(param_hash[:max_memory])
- expected_lines.push("-m #{param_hash[:max_memory]}")
- else
- expected_lines.push("-m #{((facts[:memorysize].to_f*1024)*0.95).floor}")
- end
- (content.split("\n") & expected_lines).should =~ expected_lines
- end
- end
- end
- ['Redhat'].each do |osfamily|
- describe 'on supported platform' do
- it 'should fail' do
-
- end
- end
- end
- end
- end
-end
@@ -1,6 +0,0 @@
---format
-s
---colour
---loadby
-mtime
---backtrace
@@ -1,13 +0,0 @@
-require 'puppet'
-require 'rubygems'
-require 'rspec-puppet'
-
-# get the value of a certain parameter
-def param_value(subject, type, title, param)
- subject.resource(type, title).send(:parameters)[param.to_sym]
-end
-
-RSpec.configure do |c|
- c.module_path = File.join(File.dirname(__FILE__), '../../')
- c.manifest_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/manifests'))
-end
Oops, something went wrong.

0 comments on commit 3fca127

Please sign in to comment.