You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.2 KiB
52 lines
1.2 KiB
require "open3"
|
|
require "yaml"
|
|
|
|
DOMAIN = ENV.fetch("LOTUS_LAND_STORY_DOMAIN")
|
|
|
|
task bootstrap: "pip:sync"
|
|
|
|
namespace :pip do
|
|
task :sync => "requirements.txt" do
|
|
sh "pip-sync requirements.txt"
|
|
end
|
|
|
|
desc ""
|
|
task :upgrade do
|
|
out, _ = Open3.capture2e("pip-compile --upgrade --resolver=backtracking requirements.in")
|
|
File.write("requirements.txt", out)
|
|
end
|
|
|
|
file "requirements.txt" => "requirements.in" do |t|
|
|
out, _ = Open3.capture2e("pip-compile --resolver=backtracking requirements.in")
|
|
File.write(t.name, out)
|
|
end
|
|
end
|
|
|
|
desc ""
|
|
task terraform: "terraform.tfvars" do
|
|
sh "terraform apply"
|
|
end
|
|
|
|
desc ""
|
|
task ansible: "vars.yml" do
|
|
sh "ansible-playbook main.yml"
|
|
end
|
|
|
|
task "terraform.tfvars" do |t|
|
|
File.write(t.name, "domain = \"#{DOMAIN}\"")
|
|
end
|
|
|
|
task "vars.yml" do |t|
|
|
linode_volume = `terraform output -raw lotus_land_story_volume`
|
|
miniflux_db_password = `op read op://Private/Miniflux/db_password`.strip
|
|
miniflux_password = `op read op://Private/Miniflux/password`.strip
|
|
File.write(t.name, YAML.dump({
|
|
domain: DOMAIN,
|
|
linode_volume:,
|
|
miniflux_db_password:,
|
|
miniflux_password:,
|
|
}.transform_keys(&:to_s)))
|
|
end
|
|
|
|
task default: %i[ terraform ansible ]
|