Began work on main production tasks

master
Dylan DiGeronimo 2019-12-11 23:20:40 -05:00
parent 349f882a89
commit 08c3158667
5 changed files with 59 additions and 1 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
*.retry
.vscode/

View File

@ -0,0 +1,7 @@
---
# Variables for production server
project_path: "~/cce-search-prototype"
user_name: "ubuntu"
git_repo: "https://github.com/EbookFoundation/cce-search-prototype"
git_branch: "master"

2
hosts
View File

@ -0,0 +1,2 @@
[production]
cce-prod ansible_host=cce.ebookfoundation.org ansible_user=ubuntu

View File

@ -0,0 +1,46 @@
---
- name: Install prod dependencies
become: true
apt:
name: "{{ item }}"
update_cache: true
state: present
with_items:
- 'git'
- 'pipenv'
- name: Create project directory
become: true
file:
path: "{{ project_path }}"
state: directory
owner: "{{ user_name }}"
mode: 0755
- name: Checkout repo
git:
accept_hostkey: yes
force: yes
repo: "{{ git_repo }}"
dest: "{{ project_path }}"
version: "{{ git_branch }}"
# Source: https://github.com/pypa/pipenv/issues/363#issuecomment-421310544
- name: Check for venv
ignore_errors: true
command: "pipenv --venv"
args:
chdir: "{{ project_path }}"
register: pipenv_venv_check_cmd
changed_when:
- ('No virtualenv' not in pipenv_venv_check_cmd.stderr)
- name: Run pipenv install
command: "pipenv install"
args:
chdir: "{{ project_root }}"
when:
- ('No virtualenv' in pipenv_venv_check_cmd.stderr)
# TODO: open ports on firewall

View File

@ -0,0 +1 @@
an