This commit is contained in:
Giorgos Logiotatidis 2017-07-13 16:33:01 +03:00
Родитель 13d6df7089
Коммит 729376e78e
8 изменённых файлов: 0 добавлений и 457 удалений

36
Vagrantfile поставляемый
Просмотреть файл

@ -1,36 +0,0 @@
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.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest:8000, host:8000
config.vm.network "private_network", ip: "33.33.33.77"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", MOUNT_POINT
config.vm.provider "virtualbox" do |vb|
vb.memory = CONF['memory']
end
config.vm.provision "shell", path: "bin/vagrant_provision.sh"
end

Просмотреть файл

@ -1,112 +0,0 @@
#!/bin/bash
set -e
set -x
INSTALL_DIR=/home/vagrant
cd $INSTALL_DIR/kitsune
# Configure locales
export LC_ALL="en_US.UTF-8"
locale-gen en_US.UTF-8
# Install package for add-apt-repository
apt-get install -y software-properties-common
# 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
apt-get update
# Install Python development-related things
apt-get install -y -q libapache2-mod-wsgi python-pip python-virtualenv libpython-dev
# Install services and their dependencies
# Services: Sphinx, Redis, and Memcached
apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev libjpeg-dev libssl-dev \
nodejs redis-server memcached libffi-dev
# Install git
apt-get install -y -q git
# Install mysql
export DEBIAN_FRONTEND=noninteractive
debconf-set-selections <<< 'mysql-server mysql-server/root_password password rootpass'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password rootpass'
apt-get install -y -q mysql-client mysql-server libmysqlclient-dev
# Install Elasticsearch 1.2.4 and set it up
curl https://packages.elastic.co/GPG-KEY-elasticsearch | apt-key add -
echo "deb https://packages.elastic.co/elasticsearch/1.2/debian stable main" \
> /etc/apt/sources.list.d/elasticsearch.list
apt-get update
apt-get install -y -q openjdk-7-jre-headless elasticsearch=1.2.4
update-rc.d elasticsearch defaults 95 10
# Copy over mysql cnf file
cp $INSTALL_DIR/kitsune/configs/vagrant/my.cnf /etc/mysql/my.cnf
service mysql 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'"
# Fix default port for redis to match kitsune
sed -ie 's/^port 6379$/port 6383/' /etc/redis/redis.conf
service redis-server restart
# Copy configurations for kitsune and mysql
# MySQL Default User: root
# MySQL Default Pass: rootpass
sudo -H -u vagrant cp $INSTALL_DIR/kitsune/configs/vagrant/settings_local.py \
$INSTALL_DIR/kitsune/kitsune/settings_local.py
# Build virtual environment
VENV=/home/vagrant/virtualenv
sudo -H -u vagrant -s -- <<EOF
virtualenv $VENV
source $VENV/bin/activate
cd ~/kitsune
./peep.sh install -r requirements/default.txt
./peep.sh install -r requirements/dev.txt
EOF
# Install npm and included packages (lessc is the one we need of these)
sudo -H -u vagrant -s -- <<EOF
npm install
./node_modules/.bin/gulp nunjucks
./node_modules/.bin/bower install
EOF
# Set up kitsune environment
sudo -H -u vagrant -s -- <<EOF
source $VENV/bin/activate
cd ~/kitsune
./manage.py update_product_details
./manage.py migrate
./manage.py generatedata
EOF
cat <<EOF
************************************************************************
If it gets here, then the Vagrant VM is provisioned. You should be all
set.
Consult the documentation on how to use and maintain this VM.
https://kitsune.readthedocs.io/
Next steps:
1. hop on #sumodev on irc.mozilla.org and say hi
2. find a bug to work on
************************************************************************
EOF

Просмотреть файл

@ -1,129 +0,0 @@
#
# 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/

Просмотреть файл

@ -1,75 +0,0 @@
from kitsune.settings import *
import sys
INSTALLED_APPS = list(INSTALLED_APPS)
MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
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': 'django.core.cache.backends.memcached.MemcachedCache',
'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',
'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')
AXES_BEHIND_REVERSE_PROXY = False
# if not TESTING:
# # debug_toolbar breaks the tests.
# INSTALLED_APPS += ['debug_toolbar']
# MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware']
# class ContainsEverything(object):
# def __contains__(self, item):
# return True
# INTERNAL_IPS = ContainsEverything()
# DEBUG_TOOLBAR_CONFIG = {
# 'SHOW_COLLAPSED': True,
# }

Просмотреть файл

@ -51,28 +51,6 @@ distributions. It's likely that you'll encounter some steps that are
slightly different. If you run into problems, let us know.
Vagrant
-------
We also have an option of using a virtual machine with Vagrant for an
all-in-one installation. This installs all required dependencies and
sets up your environment in such a way that makes it easy to run.
For full instruction about installing kitsune via vagrant, check this
:ref:`installation-vagrant` article.
Once Vagrant is installed, run ``vagrant up`` to start and configure your
virtual machine and ``vagrant ssh`` to SSH into the box.
Once inside the virtual machine, you can start the server by running the
following commands::
source virtualenv/bin/activate
cd kitsune
./manage.py runserver 0.0.0.0:8000
Now, just navigate to `<http://localhost:8000>` to see the application!
:ref:`Skip to Testing <testing-it-out>`
Requirements

Просмотреть файл

@ -1,63 +0,0 @@
Kitsune via Vagrant
===================
Its easy to run Kitsune in a `Vagrant`_-managed virtual machine so we can run
the entire Kitsune easily.
If you're on Mac OS X or Linux or even Windows and looking for a quick way to get started, you
should try these instructions.
.. note:: **If you have problems getting vagrant up**, please :ref:`contact-us-chapter`.
.. _vagrant: https://www.vagrantup.com/
.. _uses NFS to share the current working directory: https://www.vagrantup.com/docs/synced-folders/nfs.html
Install and run everything
--------------------------
#. Install VirtualBox 4.x from https://www.virtualbox.org/
.. note:: (Windows) After installing VirtualBox you need to set
PATH=C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe;
#. Install vagrant >= 1.6 using the installer from `vagrantup.com <https://www.vagrantup.com/>`_
#. Clone Kitsune::
git clone https://www.github.com/mozilla/kitsune.git
cd kitsune
#. Start the VM and install everything. (approx. 30 min on a fast net connection).::
vagrant up
.. note:: VirtualBox creates VMs in your system drive.
If it won't fit on your system drive, you will need to `change that directory to another drive <https://emptysqua.re/blog/moving-virtualbox-and-vagrant-to-an-external-drive/>`_.
At the end, you should see::
=> default: Done!
If the above process fails with an error, please email us the error
at dev-sumo@lists.mozilla.org and we'll see if we can fix it
#. Log into the VM with ssh::
vagrant ssh
#. Create a Superuser::
cd kitsune
source venv/bin/activate
./manage.py createsuperuser
You should give the Username and Password for login into your local Kitsune.
#. Run Kitsune::
./manage.py runserver 0.0.0.0:8000
Now, just navigate to <http://localhost:8000> to see the application!
If you have other problems during ``vagrant up``, please email us the
error at dev-sumo@lists.mozilla.org and we'll see if we can fix it.

Просмотреть файл

@ -1,12 +0,0 @@
# Default config for Vagrant
# Don't change this; use vagrantconfig_local.yaml to override these
# settings instead.
memory: 1024
# enable this to see verbose and debug puppet output
debug_mode: false
# set this to "gui" if vagrant cannot connect
boot_mode: none

Просмотреть файл

@ -1,8 +0,0 @@
# Overwritable config for Vagrant
# Don't change this; copy this to vagrantconfig_local.yaml, and change that instead.
#memory: 1024
# set this to "gui" if vagrant cannot connect
#boot_mode: gui