-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add terraform and ansible files as well as generation commands
- Loading branch information
Showing
34 changed files
with
826 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
defmodule DeployEx do | ||
end |
This file was deleted.
Oops, something went wrong.
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,45 @@ | ||
defmodule DeployExHelpers do | ||
def app_name, do: Mix.Project.get() |> Module.split |> hd | ||
def underscored_app_name, do: Macro.underscore(app_name) | ||
|
||
def check_in_umbrella do | ||
if Mix.Project.umbrella?() do | ||
:ok | ||
else | ||
{:error, ErrorMessage.bad_request("must be in umbrella root")} | ||
end | ||
end | ||
|
||
def priv_file(priv_subdirectory) do | ||
:deploy_ex | ||
|> :code.priv_dir | ||
|> Path.join(priv_subdirectory) | ||
end | ||
|
||
def write_file(file_path, contents, opts) do | ||
if opts[:message] do | ||
if opts[:force] || Mix.Generator.overwrite?(file_path, contents) do | ||
File.write!(file_path, contents) | ||
|
||
if !opts[:quiet] do | ||
Mix.shell().info(opts[:message]) | ||
end | ||
end | ||
else | ||
Mix.Generator.create_file(file_path, contents, opts) | ||
end | ||
end | ||
|
||
def check_file_exists!(file_path) do | ||
if !File.exists?(file_path) do | ||
raise to_string(IO.ANSI.format([ | ||
:red, "Cannot find ", | ||
:bright, "#{file_path}", :reset | ||
])) | ||
end | ||
end | ||
|
||
def upper_title_case(string) do | ||
string |> String.split("_") |> Enum.map_join(" ", &String.capitalize/1) | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
%{ | ||
"error_message": {:hex, :error_message, "0.2.1", "81ecf0b5384d0643d6256526409b06faca62aedfd256a755b52b36e16f2ab725", [:mix], [{:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.13", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "36c500b5dcfb4a2fb671d912fe8bb9e90e3f058a18d4712c0698e8d81de23340"}, | ||
"jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, | ||
"mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"}, | ||
"plug": {:hex, :plug, "1.13.6", "187beb6b67c6cec50503e940f0434ea4692b19384d47e5fdfd701e93cadb4cc2", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "02b9c6b9955bce92c829f31d6284bf53c591ca63c4fb9ff81dfd0418667a34ff"}, | ||
"plug_crypto": {:hex, :plug_crypto, "1.2.3", "8f77d13aeb32bfd9e654cb68f0af517b371fb34c56c9f2b58fe3df1235c1251a", [:mix], [], "hexpm", "b5672099c6ad5c202c45f5a403f21a3411247f164e4a8fab056e5cd8a290f4a2"}, | ||
"telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, | ||
} |
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 @@ | ||
[defaults] | ||
remote_user = admin | ||
inventory = ./hosts | ||
deprecation_warnings = False | ||
|
||
[inventory] | ||
enable_plugins = yaml |
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,15 @@ | ||
all: | ||
children: | ||
|
||
learn_elixir_assignment_marker: | ||
hosts: | ||
52.89.6.55: | ||
|
||
learn_elixir_lander: | ||
hosts: | ||
52.12.176.114: | ||
|
||
learn_elixir_tasks: | ||
hosts: | ||
54.244.125.38: | ||
|
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 @@ | ||
all:<% import Mix.Tasks.Ansible.Build %> | ||
children: | ||
<%= for {host_name, host_ips} <- @host_name_ips do %> | ||
<%= host_name %>: | ||
hosts: | ||
<%= for host_ip <- host_ips do %><%= host_ip %>: | ||
<% end %><% end %> |
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,41 @@ | ||
- name: awscli | ||
block: | ||
- name: Check if awscli is installed | ||
stat: | ||
path: /usr/local/bin/aws | ||
register: awscli_exe | ||
|
||
- name: Check if awscli is updated to {{ awscli_version }} | ||
shell: aws --version | cut -d ' ' -f 1 | cut -d '/' -f 2 | ||
register: awscli_current_version | ||
when: awscli_exe.stat.exists | ||
changed_when: false | ||
|
||
- name: Install unzip | ||
apt: | ||
name: unzip | ||
# update_cache: true | ||
|
||
- name: Download awscli installer | ||
unarchive: | ||
src: https://awscli.amazonaws.com/awscli-exe-linux-x86_64-{{ awscli_version }}.zip | ||
dest: /tmp | ||
remote_src: true | ||
when: (not awscli_exe.stat.exists) or (awscli_current_version.stdout != awscli_version) | ||
|
||
- name: Install awscli {{ awscli_version }} | ||
command: ./aws/install --update | ||
args: | ||
chdir: /tmp | ||
when: (not awscli_exe.stat.exists) or (awscli_current_version.stdout != awscli_version) | ||
|
||
- name: Install boto3 | ||
pip: | ||
name: boto3 | ||
executable: pip3 | ||
|
||
- name: Cleanup awscli installer | ||
file: | ||
path: /tmp/aws | ||
state: absent | ||
become: true |
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,2 @@ | ||
* soft nofile 20000000 | ||
* hard nofile 20000000 |
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,2 @@ | ||
defrt=`ip route | grep "^default" | head -1` | ||
ip route change $defrt initcwnd 10 |
Oops, something went wrong.