Skip to content

Commit

Permalink
Multistage deployment conf
Browse files Browse the repository at this point in the history
  • Loading branch information
meronym committed Jun 2, 2018
1 parent 5d1bff4 commit 1bf930e
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 673 deletions.
5 changes: 4 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Vagrant.configure(2) do |config|
config.vm.provision 'ansible' do |ansible|
ansible.playbook = 'provision/playbook.yml'
ansible.verbose = 'v'
ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python3" }
ansible.extra_vars = {
ansible_python_interpreter: '/usr/bin/python3',
target: 'local'
}
end
end
1 change: 1 addition & 0 deletions provision/playbook.retry
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wift-demo
53 changes: 49 additions & 4 deletions provision/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

vars:
root_dir: /srv/wift
root_site: wift.local
root_site: "{{ 'wift.local' if target == 'local' else 'wift.io' }}"

tasks:
- name: Add pipenv repository
Expand All @@ -28,27 +28,72 @@
- git
- vim
- nginx

- name: Create wift user
become: true
user:
name: wift
groups: www-data
state: present
createhome: true
when: target != 'local'

- name: Add .ssh directory for the wift user
file:
path: /home/wift/.ssh
state: directory
mode: 0700
owner: wift
group: wift
when: target != 'local'

- name: Copy wift app user ssh key
copy:
src: secrets/wift_demo
dest: /home/wift/.ssh/id_ed25519
owner: wift
group: wift
mode: 0700
when: target != 'local'

- name: Ensure github.com is a known host
become: true
become_user: wift
lineinfile:
dest: ~/.ssh/known_hosts
state: present
create: true
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}"
regexp: "^github\\.com"

- name: Clone the source code
become: true
become_user: wift
git:
repo: [email protected]:meronym/wift.git
dest: /home/wift/wift
when: target != 'local'

- name: Create wift root directory
become: true
file:
path: '{{ root_dir }}'
owner: vagrant
owner: "{{ 'vagrant' if target == 'local' else 'wift' }}"
group: www-data
state: directory
mode: 0755

- name: Link code repositories
file:
src: '/vagrant/{{ item }}'
src: "/{{ 'vagrant' if target == 'local' else '/home/wift/wift' }}/{{ item }}"
dest: '{{ root_dir }}/{{ item }}'
state: link
with_items:
- wift-api
- wift-checkout
- wift-landing
- wift-store

- name: Disable the default site
become: true
file:
Expand Down
8 changes: 8 additions & 0 deletions provision/secrets/wift_demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBpIbVmo+TOhsWXoOyi+Zo0J2mTJJa9bWhmUB9VWgPe/gAAALCddrFDnXax
QwAAAAtzc2gtZWQyNTUxOQAAACBpIbVmo+TOhsWXoOyi+Zo0J2mTJJa9bWhmUB9VWgPe/g
AAAEBkwXw/kanbxrqNqOEvQOBEpjbAK+qGDNQkpj1TPONnY2khtWaj5M6GxZeg7KL5mjQn
aZMklr1taGZQH1VaA97+AAAAJmx1Y2lhbmJvY2FATHVjaWFucy1NYWNCb29rLVByby0yLm
xvY2FsAQIDBAUGBw==
-----END OPENSSH PRIVATE KEY-----
1 change: 1 addition & 0 deletions provision/secrets/wift_demo.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGkhtWaj5M6GxZeg7KL5mjQnaZMklr1taGZQH1VaA97+ wift@wift-demo
1 change: 0 additions & 1 deletion wift-api/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ name = "pypi"

[packages]
flask = "*"
"web3" = "*"
redis = "*"
mongoengine = "*"
qrcode = "*"
Expand Down
Loading

0 comments on commit 1bf930e

Please sign in to comment.