-
Notifications
You must be signed in to change notification settings - Fork 826
[Bug 905834] Developer Vagrant environment #1999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
89a4fa6
[bug 905834] Vagrant support for dev deployment.
dean 9d76eaf
[bug 905834] Code cleanup and small checks.
dean 772bbcc
[bug 905834] Changed sys.path arrangement
dean a6da82b
[bug 905834] Fixed submodule check.
dean bc49f0e
[bug 905834] Added ignore for .vagrant
dean 4195d81
Bogus commit to test travis tests.
dean ef1e5b0
Fix for bogus commit.
dean e0e8286
Updated vagrant for peep changes.
dean 93999fe
[bug 905834] Removed submodule check.
dean 365e575
[bug 905834] Added python2.6 package.
dean a74b954
Updated req installs.
dean 1ebe2bc
Removed manage.py extras
dean eb9d511
Updated provision to reflect changes.
dean 18c7963
fix comment
dean e517ee3
Fixed up provision script a bit more.
dean a4e3a29
Removed check for submodule. Just do it.
dean 17f173c
[bug 905834] Updated with rdalal's suggestions.
dean abb3c31
[bug 905834] Simplified file name.
dean c285c33
Updated docs for vagrant.
dean d4d3d99
[bug 905834] Removed submodule update.
dean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,3 +20,4 @@ docs/_build | |
| .DS_Store | ||
| james.ini | ||
| build.py | ||
| .vagrant/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| require "yaml" | ||
|
|
||
| # Load up our vagrant config files -- vagrantconfig.yaml first | ||
| _config = YAML.load(File.open(File.join(File.dirname(__FILE__), | ||
| "vagrantconfig.yaml"), File::RDONLY).read) | ||
|
|
||
| # Local-specific/not-git-managed config -- vagrantconfig_local.yaml | ||
| begin | ||
| extra = YAML.load(File.open(File.join(File.dirname(__FILE__), | ||
| "vagrantconfig_local.yaml"), File::RDONLY).read) | ||
| if extra | ||
| _config.merge!(extra) | ||
| end | ||
| rescue Errno::ENOENT # No vagrantconfig_local.yaml found -- that's OK; just | ||
| # use the defaults. | ||
| end | ||
|
|
||
| CONF = _config | ||
| MOUNT_POINT = '/home/vagrant/kitsune' | ||
|
|
||
| Vagrant::Config.run do |config| | ||
| config.vm.box = "ubuntu-14.04" | ||
| config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box" | ||
|
|
||
| Vagrant.configure("1") do |config| | ||
| config.vm.customize ["modifyvm", :id, "--memory", CONF['memory']] | ||
| end | ||
|
|
||
| Vagrant.configure("2") do |config| | ||
| config.vm.provider "virtualbox" do |v| | ||
| v.name = "KITSUNE_VM" | ||
| v.customize ["modifyvm", :id, "--memory", CONF['memory']] | ||
| end | ||
| end | ||
|
|
||
| config.vm.network :hostonly, "33.33.33.77" | ||
| config.vm.forward_port 8000, 8000 | ||
|
|
||
| config.vm.share_folder("vagrant-root", MOUNT_POINT, ".") | ||
| config.vm.provision "shell", path: "bin/vagrant_provision.sh" | ||
| end | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| INSTALL_DIR=/home/vagrant | ||
|
|
||
| cd $INSTALL_DIR/kitsune | ||
|
|
||
| # Install package for add-apt-repository | ||
| apt-get install -y software-properties-common | ||
|
|
||
| # ElasticSearch key add/setup | ||
| curl http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add - | ||
| echo "deb http://packages.elasticsearch.org/elasticsearch/0.90/debian stable main" \ | ||
| > /etc/apt/sources.list.d/elasticsearch.list | ||
|
|
||
| # Add the needed repositories for Node/Redis/Python2.6 | ||
| add-apt-repository ppa:chris-lea/node.js | ||
| add-apt-repository ppa:chris-lea/redis-server | ||
| add-apt-repository ppa:fkrull/deadsnakes | ||
|
|
||
| apt-get update | ||
|
|
||
| # Set default password for MariaDB | ||
| export DEBIAN_FRONTEND=noninteractive | ||
| debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password password rootpass' | ||
| debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password_again password rootpass' | ||
|
|
||
| # Install services and their dependencies | ||
| # Services: Sphinx, MariaDB, ElasticSearch, Redis, and Memcached | ||
| apt-get install -y sphinx-common libapache2-mod-wsgi python-pip libmysqlclient-dev git \ | ||
| libxml2-dev libxslt1-dev zlib1g-dev libjpeg-dev python-dev libssl-dev \ | ||
| openjdk-7-jre-headless mariadb-server-5.5 nodejs elasticsearch redis-server \ | ||
| memcached python2.6 python2.6-dev | ||
|
|
||
| # Setup the virtualenv and start using it | ||
| pip install virtualenv | ||
| virtualenv -p /usr/bin/python2.6 $INSTALL_DIR/virtualenv | ||
| chown -R vagrant $INSTALL_DIR/virtualenv | ||
| source $INSTALL_DIR/virtualenv/bin/activate | ||
|
|
||
| python $INSTALL_DIR/kitsune/scripts/peep.py install -r $INSTALL_DIR/kitsune/requirements/py26.txt | ||
| pip install nose-progressive==1.5.0 | ||
|
|
||
| # Copy configurations for kitsune and mysql | ||
| # MySQL Default User: root | ||
| # MySQL Default Pass: rootpass | ||
| cp $INSTALL_DIR/kitsune/configs/vagrant/settings_local.py \ | ||
| $INSTALL_DIR/kitsune/kitsune/settings_local.py | ||
|
|
||
| cp $INSTALL_DIR/kitsune/configs/vagrant/my.cnf /etc/mysql/my.cnf | ||
|
|
||
| # Fix default port to match kitsune | ||
| sed -ie 's/^port 6379$/port 6383/' /etc/redis/redis.conf | ||
| service redis-server restart | ||
|
|
||
| # Create the kitsune database | ||
| mysql -e 'CREATE DATABASE kitsune CHARACTER SET utf8 COLLATE utf8_unicode_ci' | ||
| mysql -e "GRANT ALL ON kitsune.* TO kitsune@localhost IDENTIFIED BY 'password'" | ||
|
|
||
| # Install npm and included packages (lessc is the one we need of these) | ||
| npm install | ||
| ./node_modules/.bin/gulp nunjucks | ||
|
|
||
| # Retrieve and store historical version data | ||
| ./manage.py update_product_details | ||
|
|
||
| # Setup tables and generate some data | ||
| ./manage.py syncdb --migrate --noinput | ||
| ./manage.py generatedata | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| # | ||
| # The MySQL database server configuration file. | ||
| # | ||
| # You can copy this to one of: | ||
| # - "/etc/mysql/my.cnf" to set global options, | ||
| # - "~/.my.cnf" to set user-specific options. | ||
| # | ||
| # One can use all long options that the program supports. | ||
| # Run program with --help to get a list of available options and with | ||
| # --print-defaults to see which it would actually understand and use. | ||
| # | ||
| # For explanations see | ||
| # http://dev.mysql.com/doc/mysql/en/server-system-variables.html | ||
|
|
||
| # This will be passed to all mysql clients | ||
| # It has been reported that passwords should be enclosed with ticks/quotes | ||
| # escpecially if they contain "#" chars... | ||
| # Remember to edit /etc/mysql/debian.cnf when changing the socket location. | ||
| [client] | ||
| user = root | ||
| password = rootpass | ||
| port = 3306 | ||
| socket = /var/run/mysqld/mysqld.sock | ||
|
|
||
| # Here is entries for some specific programs | ||
| # The following values assume you have at least 32M ram | ||
|
|
||
| # This was formally known as [safe_mysqld]. Both versions are currently parsed. | ||
| [mysqld_safe] | ||
| socket = /var/run/mysqld/mysqld.sock | ||
| nice = 0 | ||
|
|
||
| [mysqld] | ||
| # | ||
| # * Basic Settings | ||
| # | ||
| user = mysql | ||
| pid-file = /var/run/mysqld/mysqld.pid | ||
| socket = /var/run/mysqld/mysqld.sock | ||
| port = 3306 | ||
| basedir = /usr | ||
| datadir = /var/lib/mysql | ||
| tmpdir = /tmp | ||
| lc-messages-dir = /usr/share/mysql | ||
| skip-external-locking | ||
| # | ||
| # Instead of skip-networking the default is now to listen only on | ||
| # localhost which is more compatible and is not less secure. | ||
| bind-address = 127.0.0.1 | ||
| # | ||
| # * Fine Tuning | ||
| # | ||
| key_buffer = 16M | ||
| max_allowed_packet = 16M | ||
| thread_stack = 192K | ||
| thread_cache_size = 8 | ||
| # This replaces the startup script and checks MyISAM tables if needed | ||
| # the first time they are touched | ||
| myisam-recover = BACKUP | ||
| #max_connections = 100 | ||
| #table_cache = 64 | ||
| #thread_concurrency = 10 | ||
| # | ||
| # * Query Cache Configuration | ||
| # | ||
| query_cache_limit = 1M | ||
| query_cache_size = 16M | ||
| # | ||
| # * Logging and Replication | ||
| # | ||
| # Both location gets rotated by the cronjob. | ||
| # Be aware that this log type is a performance killer. | ||
| # As of 5.1 you can enable the log at runtime! | ||
| #general_log_file = /var/log/mysql/mysql.log | ||
| #general_log = 1 | ||
| # | ||
| # Error log - should be very few entries. | ||
| # | ||
| log_error = /var/log/mysql/error.log | ||
| # | ||
| # Here you can see queries with especially long duration | ||
| #log_slow_queries = /var/log/mysql/mysql-slow.log | ||
| #long_query_time = 2 | ||
| #log-queries-not-using-indexes | ||
| # | ||
| # The following can be used as easy to replay backup logs or for replication. | ||
| # note: if you are setting up a replication slave, see README.Debian about | ||
| # other settings you may need to change. | ||
| #server-id = 1 | ||
| #log_bin = /var/log/mysql/mysql-bin.log | ||
| expire_logs_days = 10 | ||
| max_binlog_size = 100M | ||
| #binlog_do_db = include_database_name | ||
| #binlog_ignore_db = include_database_name | ||
| # | ||
| # * InnoDB | ||
| # | ||
| # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. | ||
| # Read the manual for more InnoDB related options. There are many! | ||
| # | ||
| # * Security Features | ||
| # | ||
| # Read the manual, too, if you want chroot! | ||
| # chroot = /var/lib/mysql/ | ||
| # | ||
| # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". | ||
| # | ||
| # ssl-ca=/etc/mysql/cacert.pem | ||
| # ssl-cert=/etc/mysql/server-cert.pem | ||
| # ssl-key=/etc/mysql/server-key.pem | ||
|
|
||
|
|
||
|
|
||
| [mysqldump] | ||
| quick | ||
| quote-names | ||
| max_allowed_packet = 16M | ||
|
|
||
| [mysql] | ||
| #no-auto-rehash # faster start of mysql but no tab completition | ||
|
|
||
| [isamchk] | ||
| key_buffer = 16M | ||
|
|
||
| # | ||
| # * IMPORTANT: Additional settings that can override those from this file! | ||
| # The files must end with '.cnf', otherwise they'll be ignored. | ||
| # | ||
| !includedir /etc/mysql/conf.d/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| from kitsune.settings import * | ||
| import sys | ||
|
|
||
| INSTALLED_APPS = list(INSTALLED_APPS) | ||
| MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES) | ||
| JINGO_EXCLUDE_APPS = list(JINGO_EXCLUDE_APPS) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm not sure why you're doing this ^ ^^ ^^^ |
||
|
|
||
| TESTING = 'test' in sys.argv | ||
|
|
||
| DEBUG = True | ||
| TEMPLATE_DEBUG = DEBUG | ||
| SESSION_COOKIE_SECURE = False | ||
|
|
||
| # Allows you to run Kitsune without running Celery---all tasks | ||
| # will be done synchronously. | ||
| CELERY_ALWAYS_EAGER = True | ||
|
|
||
| # Allows you to specify waffle settings in the querystring. | ||
| WAFFLE_OVERRIDE = True | ||
|
|
||
| # Change this to True if you're going to be doing search-related | ||
| # work. | ||
| ES_LIVE_INDEXING = False | ||
|
|
||
| # Basic cache configuration for development. | ||
| CACHES = { | ||
| 'default': { | ||
| 'BACKEND': 'caching.backends.memcached.CacheClass', | ||
| 'LOCATION': 'localhost:11211', | ||
| 'PREFIX': 'sumo:', | ||
| } | ||
| } | ||
|
|
||
| DATABASES = { | ||
| 'default': { | ||
| 'NAME': 'kitsune', | ||
| # 'NAME': 'kitsune_generatedata', | ||
| 'ENGINE': 'django.db.backends.mysql', | ||
| # 'HOST': 'mariadb', | ||
| 'HOST': 'localhost', | ||
| 'USER': 'root', | ||
| 'PASSWORD': 'rootpass', | ||
| 'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'}, | ||
| 'TEST_CHARSET': 'utf8', | ||
| 'TEST_COLLATION': 'utf8_unicode_ci', | ||
| }, | ||
| } | ||
|
|
||
| REDIS_BACKENDS = { | ||
| 'default': 'redis://localhost:6383?socket_timeout=0.5&db=0', | ||
| 'karma': 'redis://localhost:6383?socket_timeout=0.5&db=1', | ||
| 'helpfulvotes': 'redis://localhost:6383?socket_timeout=0.5&db=2', | ||
| } | ||
|
|
||
| LESS_PREPROCESS = True | ||
| LESS_BIN = path('node_modules/.bin/lessc') | ||
| UGLIFY_BIN = path('node_modules/.bin/uglifyjs') | ||
| CLEANCSS_BIN = path('node_modules/.bin/cleancss') | ||
| NUNJUCKS_PRECOMPILE_BIN = path('node_modules/.bin/nunjucks-precompile') | ||
|
|
||
| INSTALLED_APPS += ['django_qunit'] | ||
|
|
||
| AXES_BEHIND_REVERSE_PROXY = False | ||
|
|
||
|
|
||
| # if not TESTING: | ||
| # # debug_toolbar breaks the tests. | ||
| # INSTALLED_APPS += ['debug_toolbar'] | ||
| # MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware'] | ||
| # JINGO_EXCLUDE_APPS += ['debug_toolbar'] | ||
|
|
||
| # class ContainsEverything(object): | ||
| # def __contains__(self, item): | ||
| # return True | ||
|
|
||
| # INTERNAL_IPS = ContainsEverything() | ||
|
|
||
| # DEBUG_TOOLBAR_CONFIG = { | ||
| # 'SHOW_COLLAPSED': True, | ||
| # } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Default config for Vagrant | ||
|
|
||
| # Don't change this; use vagrantconfig_local.yaml to override these | ||
| # settings instead. | ||
|
|
||
| memory: 256 | ||
|
|
||
| # enable this to see verbose and debug puppet output | ||
| debug_mode: false | ||
|
|
||
| # set this to "gui" if vagrant cannot connect | ||
| boot_mode: none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Overwritable config for Vagrant | ||
|
|
||
| # Don't change this; copy this to vagrantconfig_local.yaml, and change that instead. | ||
|
|
||
| #memory: 256 | ||
|
|
||
| # set this to "gui" if vagrant cannot connect | ||
| #boot_mode: gui |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could also just do this instead (probably a better idea):