-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial ansible commit * add CLI command for starting and stopping in the background * start draft sidecar upon new deployment * add deploy command for ansible * update documentation with ansible deployment * fix two small type check errors. likely due to new version of pyre * add dependency for types-psutil
- Loading branch information
1 parent
eb3db84
commit c3cc92d
Showing
12 changed files
with
338 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
- name: Deploy updates to Draft | ||
hosts: all | ||
tasks: | ||
# - name: Stop helper sidecar | ||
# command: '{{ ansible_env.HOME }}/draft/.venv/bin/draft stop-helper-sidecar' | ||
- name: Pull new commits from GitHub | ||
git: | ||
repo: 'https://github.com/private-attribution/draft.git' | ||
dest: '{{ ansible_env.HOME }}/draft' | ||
update: yes | ||
- name: Checkout and pull main branch | ||
command: git pull origin main | ||
args: | ||
chdir: '{{ ansible_env.HOME }}/draft' | ||
# - name: Start helper sidecar | ||
# command: '{{ ansible_env.HOME }}/draft/.venv/bin/draft start-helper-sidecar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[myhosts] | ||
ipa-dev | ||
ipa-1 | ||
ipa-2 | ||
ipa-3 | ||
[myhosts:vars] | ||
ansible_python_interpreter=/usr/bin/python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
- name: Setup IPA Helper | ||
hosts: all | ||
tasks: | ||
- name: Print HOME directory | ||
debug: | ||
var: ansible_env.HOME | ||
|
||
- name: Check if Python3.11 is installed | ||
command: python3.11 --version | ||
register: python_installed | ||
failed_when: false | ||
changed_when: false | ||
|
||
- name: Install Python3.11 | ||
yum: | ||
name: python3.11 | ||
state: latest | ||
become: yes | ||
when: python_installed.rc != 0 | ||
|
||
- name: Check if Git is installed | ||
command: git --version | ||
register: git_installed | ||
failed_when: false | ||
changed_when: false | ||
|
||
- name: Install Git | ||
yum: | ||
name: git | ||
state: latest | ||
become: yes | ||
when: git_installed.rc != 0 | ||
|
||
- name: Install pip3 | ||
command: python3.11 -m ensurepip | ||
become: yes | ||
- name: Upgrade pip3 | ||
command: python3.11 -m pip install --upgrade pip | ||
become: yes | ||
|
||
- name: Clone repository if it doesn't exist | ||
git: | ||
repo: 'https://github.com/private-attribution/draft.git' | ||
dest: '{{ ansible_env.HOME }}/draft' | ||
update: no | ||
|
||
- name: Create virtualenv if it doesn't exist | ||
command: python3.11 -m venv .venv | ||
args: | ||
chdir: '{{ ansible_env.HOME }}/draft' | ||
creates: '{{ ansible_env.HOME }}/draft/.venv' | ||
|
||
- name: Install package in editable mode | ||
pip: | ||
name: '{{ ansible_env.HOME }}/draft' | ||
editable: yes | ||
virtualenv: '{{ ansible_env.HOME }}/draft/.venv' | ||
virtualenv_python: python3.11 | ||
|
||
- name: Check if Traefik is installed | ||
command: '{{ ansible_env.HOME }}/draft/traefik version' | ||
register: traefik_installed | ||
failed_when: false | ||
changed_when: false | ||
|
||
- name: Download Traefik | ||
get_url: | ||
url: 'https://github.com/traefik/traefik/releases/download/v2.11.0/traefik_v2.11.0_linux_amd64.tar.gz' | ||
dest: '{{ ansible_env.HOME }}/traefik_v2.11.0_linux_amd64.tar.gz' | ||
checksum: 'sha256:7f31f1cc566bd094f038579fc36e354fd545cf899523eb507c3cfcbbdb8b9552' | ||
when: traefik_installed.rc != 0 | ||
|
||
- name: Ensure extraction directory exists | ||
file: | ||
path: '{{ ansible_env.HOME }}/traefix_extract/' | ||
state: directory | ||
|
||
- name: Extract Traefik | ||
unarchive: | ||
src: '{{ ansible_env.HOME }}/traefik_v2.11.0_linux_amd64.tar.gz' | ||
dest: '{{ ansible_env.HOME }}/traefix_extract/' | ||
remote_src: yes | ||
when: traefik_installed.rc != 0 | ||
|
||
- name: Copy Traefik binary into draft directory | ||
copy: | ||
src: '{{ ansible_env.HOME }}/traefix_extract/traefik' | ||
dest: '{{ ansible_env.HOME }}/draft' | ||
remote_src: yes | ||
|
||
- name: Run draft start-helper-sidecar | ||
command: '{{ ansible_env.HOME }}/draft/.venv/bin/draft start-helper-sidecar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
config_path=$1 | ||
root_path=$2 | ||
root_domain=$3 | ||
sidecar_domain=$4 | ||
helper_port=$5 | ||
sidecar_port=$6 | ||
identity=$7 | ||
|
||
nohup draft run-helper-sidecar --config_path "$config_path" --root_path "$root_path" --root_domain "$root_domain" --sidecar_domain "$sidecar_domain" --helper_port "$helper_port" --sidecar_port "$sidecar_port" --identity "$identity" > .draft/logs/helper_sidecar.log 2>&1 & echo $! > .draft/pids/helper_sidecar.pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
config_path=$1 | ||
root_path=$2 | ||
helper_start_port=$3 | ||
sidecar_start_port=$4 | ||
|
||
nohup draft run-local-dev --config_path "$config_path" --root_path "$root_path" --helper_start_port "$helper_start_port" --sidecar_start_port "$sidecar_start_port" > .draft/logs/local_dev.log 2>&1 & echo $! > .draft/pids/local_dev.pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.