taperole 1.5.5 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +3 -0
  3. data/.travis.yml +10 -0
  4. data/CHANGELOG.md +9 -0
  5. data/README.md +22 -5
  6. data/bin/tape +6 -0
  7. data/lib/tape/ansible_runner.rb +1 -0
  8. data/lib/tape/overwriter.rb +14 -0
  9. data/requirements.yml +1 -2
  10. data/roles/backend_install_essentials/meta/main.yml +1 -1
  11. data/roles/backend_install_essentials/tasks/main.yml +5 -0
  12. data/roles/backend_install_essentials/templates/gemrc.j2 +1 -0
  13. data/roles/postgres/meta/main.yml +2 -0
  14. data/roles/ruby/defaults/main.yml +11 -0
  15. data/roles/ruby/files/gemrc +5 -0
  16. data/{vendor/zzet.rbenv → roles/ruby}/tasks/apt_build_depends.yml +2 -3
  17. data/roles/ruby/tasks/main.yml +120 -0
  18. data/taperole.gemspec +1 -1
  19. data/templates/base/tape_vars.example.yml +17 -0
  20. data/test/base_docker_box/Dockerfile +38 -0
  21. data/test/rails/Dockerfile +34 -0
  22. data/test/rails/start_rails.sh +6 -0
  23. data/test/rails/tape_vars.yml +12 -0
  24. data/vars/defaults.yml +26 -0
  25. data/vendor/Stouts.backup/.bumpversion.cfg +6 -0
  26. data/vendor/Stouts.backup/.gitignore +1 -0
  27. data/vendor/Stouts.backup/.travis.yml +34 -0
  28. data/vendor/Stouts.backup/CONTRIBUTORS +7 -0
  29. data/vendor/Stouts.backup/LICENSE +21 -0
  30. data/vendor/Stouts.backup/Makefile +20 -0
  31. data/vendor/Stouts.backup/README.md +169 -0
  32. data/vendor/Stouts.backup/defaults/main.yml +93 -0
  33. data/vendor/Stouts.backup/meta/.galaxy_install_info +1 -0
  34. data/vendor/Stouts.backup/meta/main.yml +16 -0
  35. data/vendor/Stouts.backup/tasks/backup.yml +10 -0
  36. data/vendor/Stouts.backup/tasks/configure.yml +53 -0
  37. data/vendor/Stouts.backup/tasks/install.deb.yml +19 -0
  38. data/vendor/Stouts.backup/tasks/main.yml +5 -0
  39. data/vendor/Stouts.backup/tasks/remove.yml +12 -0
  40. data/vendor/Stouts.backup/templates/conf.j2 +78 -0
  41. data/vendor/Stouts.backup/templates/cron.j2 +10 -0
  42. data/vendor/Stouts.backup/templates/duply.sh.j2 +2240 -0
  43. data/vendor/Stouts.backup/templates/exclude.j2 +3 -0
  44. data/vendor/Stouts.backup/templates/logrotate.j2 +14 -0
  45. data/vendor/Stouts.backup/templates/post.j2 +14 -0
  46. data/vendor/Stouts.backup/templates/pre.j2 +26 -0
  47. data/vendor/Stouts.backup/templates/restore.j2 +29 -0
  48. data/vendor/Stouts.backup/test.yml +6 -0
  49. metadata +42 -26
  50. data/id_rsa_sb_basebox +0 -27
  51. data/vendor/zzet.rbenv/.kitchen.yml +0 -40
  52. data/vendor/zzet.rbenv/.travis.yml +0 -15
  53. data/vendor/zzet.rbenv/README.md +0 -100
  54. data/vendor/zzet.rbenv/defaults/main.yml +0 -20
  55. data/vendor/zzet.rbenv/files/default-gems +0 -1
  56. data/vendor/zzet.rbenv/files/gemrc +0 -4
  57. data/vendor/zzet.rbenv/meta/.galaxy_install_info +0 -1
  58. data/vendor/zzet.rbenv/meta/main.yml +0 -27
  59. data/vendor/zzet.rbenv/role.yml +0 -10
  60. data/vendor/zzet.rbenv/tasks/homebrew_build_depends.yml +0 -12
  61. data/vendor/zzet.rbenv/tasks/main.yml +0 -226
  62. data/vendor/zzet.rbenv/tasks/pacman_build_depends.yml +0 -2
  63. data/vendor/zzet.rbenv/tasks/yum_build_depends.yml +0 -15
  64. data/vendor/zzet.rbenv/test/integration/default/serverspec/rbenv_spec.rb +0 -26
  65. data/vendor/zzet.rbenv/test/integration/helpers/serverspec/spec_helper.rb +0 -10
  66. data/vendor/zzet.rbenv/test/integration/site.yml +0 -8
  67. data/vendor/zzet.rbenv/vars/user.yml +0 -2
  68. /data/{vendor/zzet.rbenv → roles/ruby}/files/vars +0 -0
  69. /data/{vendor/zzet.rbenv → roles/ruby}/handlers/main.yml +0 -0
  70. /data/{vendor/zzet.rbenv → roles/ruby}/templates/rbenv.sh.j2 +0 -0
  71. /data/{vendor/zzet.rbenv → roles/ruby}/vars/main.yml +0 -0
  72. /data/{vendor/zzet.rbenv → roles/ruby}/vars/system.yml +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3642d8e1e592ff03a1a9653c09bbef2b5828a2a0
4
- data.tar.gz: 8c9db8b3d3b4969965e161359b04339c99d390a7
3
+ metadata.gz: cd21b5c1b7d9532c3a6225c43fc6225726196307
4
+ data.tar.gz: 1b30b5918731df5a64930e0fc7705ea9e05a53ca
5
5
  SHA512:
6
- metadata.gz: 912a32647fc58e95972132b420692edc5fbe0ad96b3ec1890487734e5aa45d64929ca9d7377d2d6d4d23ec749d1bf97c172e4427d9036d14358d4780e2008dc6
7
- data.tar.gz: d02b21d825c769550001ef0a27b65673b3b0370d86f0f15aa63258afbc50bfedced91e2824a74a7878378e8c8a822b0934975ad023efbc13d85a12788a7877fe
6
+ metadata.gz: accd791072ff897618d73a8a0d7b412feacdc3ab40740ddc5dd9939092ba1f7695d3f3cf5629fc6f61fca0848c061453d1499cec2262e0792799c1a92f937bf6
7
+ data.tar.gz: 8109633af31ad2bbc309aff92848c9c94f870048a1039eb2f9f33ce8ff481648d858b9c0e8886e114b75ce6d28a3fa6217ac19c7e88041bd1a6b6eca72a0b003
data/.hound.yml CHANGED
@@ -3,5 +3,8 @@ fail_on_violations: true
3
3
  ruby:
4
4
  config_file: config/style_guides/ruby.yml
5
5
 
6
+ scss:
7
+ enabled: false
8
+
6
9
  AllCops:
7
10
  RunRailsCops: false
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: python
2
+
3
+ python: "2.7"
4
+
5
+ services:
6
+ - docker
7
+
8
+ script:
9
+ - docker build -f test/rails/Dockerfile -t imagetest .
10
+ - docker run -i -t $(docker images -q imagetest) /start_rails.sh | grep "Hello"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 1.6.0
2
+ * Added Hound
3
+ * Documentation Updates
4
+ * Added option to ask for ansible vault password so that we can use ansible vaults
5
+ * Added postgresql backup functionality
6
+ * Move ruby installation out of zzet ansible galaxy role
7
+ * Added travis automated testing with Docker
8
+ * Added an overwrite command so that users can overwrite a role
9
+
1
10
  ### 1.5.0
2
11
  * Self-signed SSL is now on by default
3
12
  * Port 80 redirects to 443
data/README.md CHANGED
@@ -1,13 +1,14 @@
1
+ [![Build Status](https://travis-ci.org/smashingboxes/taperole.svg?branch=master)](https://travis-ci.org/smashingboxes/taperole)
1
2
  [![Stories in Ready](https://badge.waffle.io/smashingboxes/taperole.png?label=ready&title=Ready)](https://waffle.io/smashingboxes/tape)
2
3
  # Infrastructure Management
3
4
 
4
- [![Slack Status](https://taperole-slack.herokuapp.com/badge.svg)](https://taperole-slack.herokuapp.com/)
5
-
6
5
  ## Deploying & provisioning with tape
7
- **Use Unbuntu precise64 (14.04 x64)**
6
+ **Use Unbuntu trusty64 (14.04 x64)**
8
7
 
9
8
  **Enable ssh access via root user**
10
9
 
10
+ For a tutorial on getting started: [Taperole: the Smashing Boxes Way to Deploy Your Rails App](http://smashingboxes.com/blog/taperole-the-smashing-boxes-way-to-deploy-your-rails-app)
11
+
11
12
  ### Basics
12
13
 
13
14
  **Install**
@@ -40,8 +41,13 @@ tape installer install
40
41
 
41
42
  All default configurations found in `vars/defaults.yml` can be overridden in your local `taperole/tape_vars.yml` file
42
43
 
43
- **Default Node Version**: 4.2.x
44
- **Default Ruby Version** 2.3.0
44
+ **Default Node Version**: 4.2.x
45
+ **Default Ruby Version** 2.3.0
46
+
47
+ ### Backups
48
+ Backups are handled via [duply](http://duply.net/) and occur every night at 4am under the root user. You can configure your backup schedule and target where you want your backups stored at within your `taperole/tape_vars.yml` file.
49
+
50
+ By default, all servers in your [production] group will have backups enabled
45
51
 
46
52
  ### Custom roles
47
53
  You can add app specific ansible roles to `<app_root>/roles`.
@@ -75,6 +81,7 @@ tape ansible deploy -l staging
75
81
  ### With vagrant
76
82
 
77
83
 
84
+ 1. `echo 'y' | tape installer install`
78
85
  1. `vagrant up`
79
86
  2. Put the following into your [hosts inventory file](http://docs.ansible.com/intro_inventory.html):
80
87
 
@@ -89,6 +96,16 @@ You can specify a port using the `ansible_ssh_port` in your hosts inventory file
89
96
  3. Update `tape_vars.yml` with information to a [rails app you want to deploy](https://github.com/BrandonMathis/vanilla-rails-app)
90
97
  4. `tape ansible everything -l vagrant`
91
98
 
99
+ ### With Docker
100
+ 1. Setup your machine to work with Docker. We recommend [Docker Machine](https://docs.docker.com/machine/)
101
+
102
+ **Test Rails**
103
+
104
+ 2. `docker build -f test/rails/Dockerfile -t tapetest .`
105
+ 3. `docker run -i -t $(docker images -q imagetest) /start_rails.sh | grep "Hello"`
106
+
107
+ If the last command resulted in a `<h1>Hello</h1>` then your Rails application deployed successfully!
108
+
92
109
  ## Development
93
110
 
94
111
  ```sh
data/bin/tape CHANGED
@@ -11,6 +11,7 @@ opt_parser = OptionParser.new do |opts|
11
11
  opts.banner = "Usage: tape <module> <action> [options]"
12
12
 
13
13
  opts.on("-v", "--[no-]verbose", "Be loud") {|v| options.verbose = v}
14
+ opts.on("--ask-vault-pass", "Ask for Ansible vault password") { options.vault = true }
14
15
 
15
16
  opts.on("-i", "--inventory [INVENTORY_FILE]",
16
17
  String, "Do actions with the given inventory file") do |i|
@@ -47,6 +48,11 @@ opt_parser = OptionParser.new do |opts|
47
48
  options.tags = t
48
49
  end
49
50
 
51
+ opts.on("-r", "--role=ROLE_NAME",
52
+ String, "name of the role to operate on") do |r|
53
+ options.role = r
54
+ end
55
+
50
56
  opts.separator ''
51
57
  opts.separator "MODULES"
52
58
  TapeBoxer.registered_modules.values.each do |exec_module|
@@ -93,6 +93,7 @@ class AnsibleRunner < ExecutionModule
93
93
  def exec_ansible(playbook, args)
94
94
  enforce_roles_path!
95
95
  cmd = "ANSIBLE_CONFIG=#{local_dir}/.tape/ansible.cfg ansible-playbook -i #{inventory_file} #{playbook} #{args} #{hosts_flag} -e tape_dir=#{tape_dir}"
96
+ cmd += ' --ask-vault-pass' if opts.vault
96
97
  cmd += ' -vvvv' if opts.verbose
97
98
  cmd += " -t #{opts.tags}" if opts.tags
98
99
  STDERR.puts "Executing: #{cmd}" if opts.verbose
@@ -0,0 +1,14 @@
1
+ require 'pathname'
2
+ module TapeBoxer
3
+ class Overwriter < ExecutionModule
4
+ TapeBoxer.register_module :overwrite, self
5
+
6
+ action :role,
7
+ proc { overwrite_role },
8
+ "Overwrite a taperole ansible role"
9
+
10
+ def overwrite_role
11
+ FileUtils.cp_r("#{tape_dir}/roles/#{opts.role}", "taperole/roles/")
12
+ end
13
+ end
14
+ end
data/requirements.yml CHANGED
@@ -2,8 +2,7 @@
2
2
  - src: jnv.unattended-upgrades
3
3
  version: v1.1.1
4
4
 
5
- - src: zzet.rbenv
6
- version: 2.1.7
5
+ - src: Stouts.backup
7
6
 
8
7
  - src: lxhunter.apt
9
8
 
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  dependencies:
3
3
  - role: geerlingguy.memcached
4
- - role: zzet.rbenv
4
+ - role: ruby
5
5
  - role: node
@@ -1,3 +1,8 @@
1
+ - name: Disable gem install downloading documents
2
+ template: src=gemrc.j2
3
+ dest=/etc/gemrc
4
+ mode=u=rw,g=r,o=r
5
+
1
6
  - name: Install imagemagick
2
7
  apt: name={{ item }} state=present
3
8
  with_items:
@@ -0,0 +1 @@
1
+ gem: --no-rdoc --no-ri
@@ -13,3 +13,5 @@ dependencies:
13
13
  db: "{{ app_name }}_{{ be_app_env }}"
14
14
  role_attr_flags: CREATEDB,LOGIN,REPLICATION,SUPERUSER
15
15
  postgresql_ext_install_dev_headers: yes
16
+ - role: Stouts.backup
17
+ when: group_names[0] in backup_hosts # Allows user to pick which hosts have backups enabled (defaults to production)
@@ -0,0 +1,11 @@
1
+ ---
2
+ rbenv:
3
+ env: system
4
+ version: v1.0.0
5
+ ruby_version: 2.3.0
6
+
7
+ rbenv_repo: "https://github.com/rbenv/rbenv.git"
8
+
9
+ rbenv_root: "/usr/local/rbenv"
10
+
11
+ rbenv_users: []
@@ -0,0 +1,5 @@
1
+ ---
2
+ :sources:
3
+ - https://rubygems.org
4
+ install: --no-document
5
+ update: --no-document
@@ -1,6 +1,6 @@
1
1
  - name: update apt cache
2
2
  apt: update_cache=yes
3
- sudo: true
3
+ become: true
4
4
  tags:
5
5
  - rbenv
6
6
 
@@ -16,7 +16,6 @@
16
16
  - libxml2-dev
17
17
  - libxslt1-dev
18
18
  - zlib1g-dev
19
- sudo: true
19
+ become: true
20
20
  tags:
21
21
  - rbenv
22
-
@@ -0,0 +1,120 @@
1
+ ---
2
+ - name: include env vars
3
+ include_vars: "{{ rbenv.env }}.yml"
4
+
5
+ - include: apt_build_depends.yml
6
+ when: ansible_pkg_mgr == 'apt'
7
+
8
+ - name: set rbenv_owner
9
+ set_fact: 'rbenv_owner={{ rbenv_owner | default("root", true) }}'
10
+
11
+ - name: checkout rbenv_repo for system
12
+ become: yes
13
+ become_user: '{{ rbenv_owner }}'
14
+ git: >
15
+ repo={{ rbenv_repo }}
16
+ dest={{ rbenv_root }}
17
+ version={{ rbenv.version }}
18
+ accept_hostkey=yes
19
+ force=yes
20
+ when: rbenv.env == "system"
21
+ tags:
22
+ - rbenv
23
+
24
+ - name: create plugins directory for system
25
+ become: yes
26
+ become_user: '{{ rbenv_owner }}'
27
+ file: state=directory path={{ rbenv_root }}/plugins
28
+ when: rbenv.env == "system"
29
+ tags:
30
+ - rbenv
31
+
32
+ - name: install plugins for system
33
+ become: yes
34
+ become_user: '{{ rbenv_owner }}'
35
+ git: >
36
+ repo=https://github.com/rbenv/ruby-build.git
37
+ dest={{ rbenv_root }}/plugins/ruby-build
38
+ accept_hostkey=yes
39
+ force=yes
40
+ tags:
41
+ - rbenv
42
+
43
+ - name: Set group ownership of content under rbenv_root
44
+ shell:
45
+ find '{{ rbenv_root }}'
46
+ \( -iname ".git" -prune \) -o
47
+ ! -group '{{ item }}'
48
+ -exec chgrp -v '{{ item }}' {} + | head -n 1
49
+ become: yes
50
+ with_items: '{{ rbenv_group }}'
51
+ when:
52
+ - rbenv.env == "system"
53
+ - rbenv_group is defined
54
+ - rbenv_group != None
55
+ register: rbenv_chgrp
56
+ changed_when: '"changed group" in rbenv_chgrp.stdout'
57
+ tags:
58
+ - rbenv
59
+
60
+ - name: Set group permissions of content under rbenv_root
61
+ shell:
62
+ find '{{ rbenv_root }}'
63
+ \( -iname ".git" -prune \) -o
64
+ -type d ! -perm -g+s
65
+ -exec chmod -v g+rwxs {} + | head -n 1
66
+ become: yes
67
+ when:
68
+ - rbenv.env == "system"
69
+ - rbenv_group is defined
70
+ - rbenv_group != None
71
+ register: rbenv_chmod
72
+ changed_when: '"changed from" in rbenv_chmod.stdout'
73
+ tags:
74
+ - rbenv
75
+
76
+ - name: add rbenv initialization to profile system-wide
77
+ template: src=rbenv.sh.j2 dest=/etc/profile.d/rbenv.sh owner=root group=root mode=0755
78
+ become: yes
79
+ when:
80
+ - ansible_os_family != 'OpenBSD'
81
+ tags:
82
+ - rbenv
83
+
84
+ - name: check ruby {{ rbenv.ruby_version }} installed for system
85
+ shell: $SHELL -lc "rbenv versions | grep {{ rbenv.ruby_version }}"
86
+ register: ruby_installed
87
+ changed_when: false
88
+ ignore_errors: yes
89
+ always_run: yes
90
+ when: rbenv.env == "system"
91
+ tags:
92
+ - rbenv
93
+
94
+ - name: install ruby {{ rbenv.ruby_version }} for system
95
+ shell: bash -lc "rbenv install {{ rbenv.ruby_version }}"
96
+ become: yes
97
+ when:
98
+ - rbenv.env == "system"
99
+ - ruby_installed.rc != 0
100
+ tags:
101
+ - rbenv
102
+
103
+ - name: check if current system ruby version is {{ rbenv.ruby_version }}
104
+ shell: $SHELL -lc "rbenv version | cut -d ' ' -f 1 | grep -Fx '{{ rbenv.ruby_version }}'"
105
+ register: ruby_selected
106
+ changed_when: false
107
+ ignore_errors: yes
108
+ always_run: yes
109
+ when: rbenv.env == "system"
110
+ tags:
111
+ - rbenv
112
+
113
+ - name: set ruby {{ rbenv.ruby_version }} for system
114
+ become: yes
115
+ shell: bash -lc "rbenv global {{ rbenv.ruby_version }} && rbenv rehash"
116
+ when:
117
+ - rbenv.env == "system"
118
+ - ruby_selected.rc != 0
119
+ tags:
120
+ - rbenv
data/taperole.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "taperole"
3
- spec.version = '1.5.5'
3
+ spec.version = '1.6.0'
4
4
  spec.authors = ['Jack Forrest', 'Smashing Boxes', 'Brandon Mathis']
5
5
  spec.description = "General purpose server provisioning and application deployment toolkit"
6
6
  spec.email = ['jack@smashingboxes.com', 'brandon@sbox.es']
@@ -10,3 +10,20 @@ be_app_repo:
10
10
  # fe_build_command: gulp build
11
11
 
12
12
  slack_webhook_url:
13
+
14
+ # Configure Postgresql Backups
15
+ #
16
+ # Store Backups on S3
17
+ # backup_dir: s3+http://[aws_access_key:aws_secret_access_key]@bucket_name[/folder]
18
+ #
19
+ # Store Backups on Seperate server via rsync
20
+ # backup_dir: s3+http://[aws_access_key:aws_secret_access_key]@bucket_name[/folder]
21
+ #
22
+ # Adjust Cron Job Schedule (default is every night at 4am)
23
+ # backup_schedule: "* */4 * * *"
24
+ #
25
+ # Change Which Servers are backed up
26
+ # backup_hosts:
27
+ # - production
28
+ # - staging
29
+ # - qa
@@ -0,0 +1,38 @@
1
+ # Start with the ubuntu image
2
+ FROM ubuntu
3
+
4
+ CMD ["bash"]
5
+
6
+ # Update apt cache
7
+ RUN apt-get -y update
8
+
9
+ # Install ansible dependencies
10
+ RUN apt-get install -y python-dev git aptitude sudo wget make zlib1g-dev libssl-dev build-essential libreadline-dev libyaml-dev libxml2-dev libcurl4-openssl-dev python-software-properties libffi-dev curl
11
+
12
+ # Install Ruby
13
+ WORKDIR /tmp
14
+ RUN wget http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz
15
+ RUN tar -xvzf ruby-2.3.0.tar.gz
16
+ WORKDIR /tmp/ruby-2.3.0
17
+ RUN ./configure --prefix=/usr/local
18
+ RUN make
19
+ RUN make install
20
+
21
+ # Add an authorized_keys file to the container since tape expects this
22
+ RUN mkdir -p /root/.ssh
23
+ RUN touch /root/.ssh/authorized_keys
24
+ RUN chown root:root /root/.ssh/authorized_keys
25
+ RUN chmod 600 /root/.ssh/authorized_keys
26
+
27
+ # Clone ansible repo (could also add the ansible PPA and do an apt-get install instead)
28
+ RUN apt-get install wget
29
+ RUN wget https://bootstrap.pypa.io/get-pip.py
30
+ RUN python get-pip.py
31
+ RUN pip install ansible
32
+
33
+ # Set variables for ansible
34
+ WORKDIR /tmp/ansible
35
+ ENV PATH /tmp/ansible/bin:/usr/sbin:/sbin:/usr/bin:/bin:$PATH
36
+ ENV ANSIBLE_LIBRARY /tmp/ansible/library
37
+ ENV PYTHONPATH /tmp/ansible/lib:$PYTHON_PATH
38
+
@@ -0,0 +1,34 @@
1
+ FROM brandonmathis/taperole:latest
2
+
3
+ # add playbooks to the image. This might be a git repo instead
4
+ ADD . /taperole
5
+
6
+ # We dont have swap access on travis. Chill this role out
7
+ RUN truncate -s 0 /taperole/roles/general/tasks/swapfile.yml
8
+
9
+ # Install Tape
10
+ WORKDIR /taperole
11
+ RUN gem build taperole.gemspec
12
+ RUN gem install slack-notifier
13
+ RUN gem install --local taperole
14
+
15
+ # Configure tape
16
+ RUN git clone https://github.com/BrandonMathis/vanilla-rails-app.git
17
+ WORKDIR /taperole/vanilla-rails-app
18
+ RUN echo 'n' | tape installer install
19
+ ADD ./test/rails/tape_vars.yml taperole/tape_vars.yml
20
+
21
+ # FIXME
22
+ # Disable ufw bc docker gets mad about iptables
23
+ RUN sed -i '/ufw/d' taperole/omnibox.yml
24
+
25
+ # Run Tape
26
+ RUN echo '[omnibox]' > taperole/hosts
27
+ RUN echo 'localhost ansible_connection=local be_app_env=production be_app_branch=master' >> taperole/hosts
28
+ RUN tape ansible everything
29
+ RUN chown deployer:users /home/deployer -R
30
+ ADD test/rails/start_rails.sh /
31
+
32
+ # Set command that runs the rails app
33
+ WORKDIR /
34
+ CMD ["/start_rails.sh"]
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ service postgresql start
3
+ service monit start
4
+ monit start all
5
+ sleep 10
6
+ curl https://localhost --insecure
@@ -0,0 +1,12 @@
1
+ app_name: vanilla
2
+
3
+ # Rails App Configs
4
+ be_app_repo: https://github.com/BrandonMathis/vanilla-rails-app.git
5
+
6
+ # HTML/JS App Configs
7
+ # Uncomment if you want to deploy a JS/HTML App
8
+ # fe_app_repo:
9
+ # fe_app_branch: master
10
+ # fe_build_command: gulp build
11
+
12
+ slack_webhook_url:
data/vars/defaults.yml CHANGED
@@ -43,3 +43,29 @@ no_changes_found_error: |
43
43
  ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️
44
44
  No Changes detected on remote branch proceeding with deploy anyway
45
45
  ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️ ‼️
46
+
47
+ # Postgres Backups
48
+ backup_hosts:
49
+ - production
50
+ backup_dir: file:///var/lib/postgresql/backups
51
+ backup_schedule: 0 4 * * *
52
+ backup_enabled: yes
53
+ backup_cron: yes
54
+ backup_user: root
55
+
56
+ backup_postgres_user: postgres
57
+ backup_postgres_host: localhost
58
+
59
+ backup_profiles:
60
+ - name: postgresql
61
+ schedule: "{{ backup_schedule }}"
62
+ source: postgresql://{{ app_name }}_{{ be_app_env }}
63
+ target: "{{ backup_dir }}"
64
+ user: root
65
+
66
+ rbenv:
67
+ env: system
68
+ version: v1.0.0
69
+ ruby_version: 2.3.1
70
+
71
+ rbenv_group: root
@@ -0,0 +1,6 @@
1
+ [bumpversion]
2
+ commit = True
3
+ current_version = 3.3.0
4
+ tag = True
5
+ tag_name = {new_version}
6
+
@@ -0,0 +1 @@
1
+ .idea/
@@ -0,0 +1,34 @@
1
+ ---
2
+ language: python
3
+ python: "2.7"
4
+ before_install:
5
+ - sudo apt-get update -qq
6
+ - sudo apt-get install -qq python-apt python-pycurl
7
+ install:
8
+ - pip install ansible>=1.6.0
9
+ script:
10
+ # Prepare tests
11
+ - echo localhost > inventory
12
+
13
+ # Check syntax
14
+ - ansible-playbook --syntax-check -i inventory test.yml
15
+
16
+ # First run
17
+ - ansible-playbook -i inventory test.yml --connection=local --sudo
18
+
19
+ # Second run Idempotence test
20
+ - >
21
+ ansible-playbook -i inventory test.yml --connection=local --sudo
22
+ | grep -q 'changed=0.*failed=0'
23
+ && (echo 'Idempotence test: pass' && exit 0)
24
+ || (echo 'Idempotence test: fail' && exit 1)
25
+
26
+ - sudo /usr/local/bin/duply test backup
27
+ - test -d /home/travis/test || exit 1
28
+
29
+ backup_home: /home/travis/backup
30
+ backup_duplicity_version: 0.6.18-0ubuntu3.5
31
+ backup_profiles:
32
+ - name: test
33
+ source: /home/travis/build
34
+ target: file:///home/travis/test
@@ -0,0 +1,7 @@
1
+ Contributors:
2
+
3
+ * Alexander Merkulov (https://github.com/merqlove)
4
+ * Clemens Stolle (https://github.com/klaemo)
5
+ * George Yanev (https://github.com/geyanev)
6
+ * Kirill Klenov (http://klen.github.io/)
7
+ * Viator (https://github.com/viatoriche)
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Stouts
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,20 @@
1
+ .PHONY: release major minor patch
2
+
3
+ VERSION?=minor
4
+ release:
5
+ @bumpversion $(VERSION)
6
+ @git checkout master
7
+ @git merge develop
8
+ @git checkout develop
9
+ @git push --all
10
+ @git push --tags
11
+ @git checkout develop
12
+
13
+ major:
14
+ make release VERSION=major
15
+
16
+ minor:
17
+ make release VERSION=minor
18
+
19
+ patch:
20
+ make release VERSION=patch