From 149244844868fd71dce725871980eb7ee5b7b31a Mon Sep 17 00:00:00 2001 From: Matthew Scragg Date: Tue, 2 Sep 2014 14:07:14 -0500 Subject: [PATCH] create provision script, removed salt states --- .gitignore | 1 + realms.py => manage.py | 0 provision.sh | 17 +++++++- realms/modules/wiki/assets.py | 2 +- realms/static/js/{dillinger.js => editor.js} | 3 ++ srv/minion | 2 - srv/salt/common/init.sls | 36 --------------- srv/salt/realms/init.sls | 44 ------------------- srv/salt/redis/init.sls | 9 ---- srv/salt/top.sls | 6 --- srv/salt/users/.bash_profile | 2 - srv/salt/users/init.sls | 46 -------------------- srv/salt/users/mysudoers | 1 - 13 files changed, 20 insertions(+), 149 deletions(-) rename realms.py => manage.py (100%) rename realms/static/js/{dillinger.js => editor.js} (99%) delete mode 100644 srv/minion delete mode 100644 srv/salt/common/init.sls delete mode 100644 srv/salt/realms/init.sls delete mode 100644 srv/salt/redis/init.sls delete mode 100644 srv/salt/top.sls delete mode 100644 srv/salt/users/.bash_profile delete mode 100644 srv/salt/users/init.sls delete mode 100644 srv/salt/users/mysudoers diff --git a/.gitignore b/.gitignore index bcfd54f..d09c579 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ config.json realms/static/vendor realms/static/assets/* wiki.db +npm-debug.log diff --git a/realms.py b/manage.py similarity index 100% rename from realms.py rename to manage.py diff --git a/provision.sh b/provision.sh index ebd814e..e5e0c14 100644 --- a/provision.sh +++ b/provision.sh @@ -1,5 +1,6 @@ #!/bin/bash +# Provision script created for Ubuntu 14.04 APP_DIR=/vagrant echo "Provisioning..." @@ -40,5 +41,17 @@ source .venv/bin/activate pip install -r requirements.txt -# Dev server http://127.0.0.1:5000 -# python realms.py runserver +cat << EOF > /usr/local/bin/realms-wiki +#!/bin/bash +${APP_DIR}/.venv/bin/python ${APP_DIR}/manage.py "\$@" +EOF +chmod +x /usr/local/bin/realms-wiki + +cat << EOF > /etc/init/realms-wiki.conf +description "Realms Wiki" +author "scragg@gmail.com" +start on runlevel [2345] +stop on runlevel [!2345] +respawn +exec /usr/local/bin/realms-wiki run +EOF \ No newline at end of file diff --git a/realms/modules/wiki/assets.py b/realms/modules/wiki/assets.py index b572460..a6c26b9 100644 --- a/realms/modules/wiki/assets.py +++ b/realms/modules/wiki/assets.py @@ -4,4 +4,4 @@ assets.register('editor', 'js/ace/ace.js', 'js/ace/mode-markdown.js', 'vendor/keymaster/keymaster.js', - 'js/dillinger.js') + 'js/editor.js') diff --git a/realms/static/js/dillinger.js b/realms/static/js/editor.js similarity index 99% rename from realms/static/js/dillinger.js rename to realms/static/js/editor.js index 74fa4d3..f1f9e3a 100644 --- a/realms/static/js/dillinger.js +++ b/realms/static/js/editor.js @@ -1,3 +1,6 @@ +/* + Source is modified version of http://dillinger.io/ + */ $(function () { var url_prefix = ""; diff --git a/srv/minion b/srv/minion deleted file mode 100644 index 995d6f7..0000000 --- a/srv/minion +++ /dev/null @@ -1,2 +0,0 @@ -master: localhost -file_client: local diff --git a/srv/salt/common/init.sls b/srv/salt/common/init.sls deleted file mode 100644 index c283506..0000000 --- a/srv/salt/common/init.sls +++ /dev/null @@ -1,36 +0,0 @@ -redis-lea-repo: - pkgrepo.managed: - - ppa: chris-lea/redis-server - - required_in: redis-server - -nodejs-lea-repo: - pkgrepo.managed: - - ppa: chris-lea/node.js - -python-redis-lea-repo: - pkgrepo.managed: - - ppa: chris-lea/python-redis - -common-pkgs: - pkg.installed: - - pkgs: - - python - - build-essential - - git - - libpcre3-dev - - libevent-dev - - python-software-properties - - python-pip - - python-virtualenv - - python-dev - - pkg-config - - curl - - libxml2-dev - - libxslt1-dev - - zlib1g-dev - - libffi-dev - - nodejs - - require: - - pkgrepo: nodejs-lea-repo - - pkgrepo: redis-lea-repo - - pkgrepo: python-redis-lea-repo diff --git a/srv/salt/realms/init.sls b/srv/salt/realms/init.sls deleted file mode 100644 index 89e7716..0000000 --- a/srv/salt/realms/init.sls +++ /dev/null @@ -1,44 +0,0 @@ -python-dev: - pkg.installed - -build-essential: - pkg.installed - -python-pip: - pkg.installed - -virtualenvwrapper: - pip.installed: - - require: - - pkg: python-pip - -bower: - npm.installed: - - user: root - - require: - - pkg: common-pkgs - -uglify-js: - npm.installed: - - user: root - - require: - - pkg: common-pkgs - -create_virtualenv: - virtualenv.managed: - - name: /home/deploy/virtualenvs/realms - - requirements: /home/deploy/realms/requirements.txt - - cwd: /home/deploy/realms - - user: root - -vagrant_ownership: - cmd.run: - - name: chown -R vagrant.vagrant /home/deploy - - onlyif: test -d /vagrant - - user: root - -deploy_ownership: - cmd.run: - - name: chown -R vagrant.vagrant /home/deploy - - unless: test -d /vagrant - - user: root diff --git a/srv/salt/redis/init.sls b/srv/salt/redis/init.sls deleted file mode 100644 index f89b129..0000000 --- a/srv/salt/redis/init.sls +++ /dev/null @@ -1,9 +0,0 @@ -redis-server: - pkg: - - installed - service: - - running - - enable: True - - reload: True - - require: - - pkg: redis-server \ No newline at end of file diff --git a/srv/salt/top.sls b/srv/salt/top.sls deleted file mode 100644 index a63743a..0000000 --- a/srv/salt/top.sls +++ /dev/null @@ -1,6 +0,0 @@ -base: - '*': - - common - - users - - redis - - realms diff --git a/srv/salt/users/.bash_profile b/srv/salt/users/.bash_profile deleted file mode 100644 index 40566b7..0000000 --- a/srv/salt/users/.bash_profile +++ /dev/null @@ -1,2 +0,0 @@ -source /usr/local/bin/virtualenvwrapper.sh -WORKON_HOME=/home/deploy/virtualenvs \ No newline at end of file diff --git a/srv/salt/users/init.sls b/srv/salt/users/init.sls deleted file mode 100644 index 897a2d4..0000000 --- a/srv/salt/users/init.sls +++ /dev/null @@ -1,46 +0,0 @@ -deploy: - user.present: - - shell: /bin/bash - - home: /home/deploy - - fullname: Deploy - -sudo: - pkg: - - installed - -/etc/sudoers.d/mysudoers: - file.managed: - - source: salt://users/mysudoers - - mode: 440 - - user: root - - group: root - - require: - - pkg: sudo - -/home/deploy: - file.directory: - - user: deploy - - group: deploy - -/home/deploy/.bash_profile: - file.managed: - - source: salt://users/.bash_profile - - mode: 440 - - user: deploy - - group: deploy - - require: - - file: /home/deploy - -/home/deploy/.bashrc: - file.copy: - - mode: 440 - - user: deploy - - group: deploy - - source: /etc/skel/.bashrc - -bashrc-append: - file.append: - - name: /home/deploy/.bashrc - - text: . ~/.bash_profile - - user: deploy - - group: deploy \ No newline at end of file diff --git a/srv/salt/users/mysudoers b/srv/salt/users/mysudoers deleted file mode 100644 index 8790061..0000000 --- a/srv/salt/users/mysudoers +++ /dev/null @@ -1 +0,0 @@ -deploy ALL=(ALL) NOPASSWD:ALL \ No newline at end of file