Switch from Make to Rake

This commit is contained in:
jdormit 2024-02-11 23:24:45 -05:00
parent c7e87a871f
commit ca0bc6e5c8
9 changed files with 76 additions and 36 deletions

2
.envrc
View File

@ -1,4 +1,6 @@
use rbenv
PATH_add bin
PATH_add bundler-bin
# export TF_VAR_do_token=$(pass jdormit-infra-do-token)
# export DIGITALOCEAN_API_TOKEN=$(pass jdormit-infra-do-token)

2
.gitignore vendored
View File

@ -3,3 +3,5 @@
*/**/.terraform
*.tfstate*
*/**/tmp/
.bundle
bundler-bin/*

1
.ruby-version Normal file
View File

@ -0,0 +1 @@
3.3.0

9
Gemfile Normal file
View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "rake"
gem "erb", "~> 4.0"

18
Gemfile.lock Normal file
View File

@ -0,0 +1,18 @@
GEM
remote: https://rubygems.org/
specs:
cgi (0.4.1)
erb (4.0.4)
cgi (>= 0.3.3)
rake (13.1.0)
PLATFORMS
ruby
x86_64-darwin-23
DEPENDENCIES
erb (~> 4.0)
rake
BUNDLED WITH
2.5.6

View File

@ -1,28 +0,0 @@
.PHONY: reissue-certs
packer-manifest.json: gitea.json \
scripts/dependencies.sh \
scripts/volume.sh \
files/gitea.service \
files/app.ini \
files/certbot-renew.service \
files/certbot-renew.timer \
scripts/gitea.sh \
files/gitea-nginx.conf \
scripts/nginx.sh \
tmp/do.ini
packer build gitea.json
files/app.ini: templates/app.ini.template
sigil -p -f templates/app.ini.template > files/app.ini
tmp/do.ini: templates/do.ini.template tmp
sigil -p -f templates/do.ini.template > tmp/do.ini
chmod 600 tmp/do.ini
tmp:
mkdir tmp
reissue-certs:
rm -rf certbot
make

View File

@ -0,0 +1,36 @@
require "erb"
task :default => ["packer-manifest.json"]
file "packer-manifest.json" => [
"gitea.json",
"scripts/dependencies.sh",
"scripts/volume.sh",
"files/gitea.service",
"files/app.ini",
"files/certbot-renew.service",
"files/certbot-renew.timer",
"scripts/gitea.sh",
"files/gitea-nginx.conf",
"scripts/nginx.sh",
"tmp/do.ini"
] do |t|
sh "packer build gitea.json"
end
file "files/app.ini" => ["templates/app.ini.template"] do |t|
template = ERB.new(File.read(t.source))
File.write(t.name, template.result)
end
file "tmp/do.ini" => ["templates/do.ini.template", "tmp"] do |t|
template = ERB.new(File.read(t.source))
File.write(t.name, template.result)
chmod 0600, "tmp/do.ini"
end
directory "tmp"
def env(var)
ENV[var] || raise("Variable #{var} not found")
end

View File

@ -3,12 +3,12 @@ RUN_USER = git
RUN_MODE = prod
[oauth2]
JWT_SECRET = ${GITEA_JWT_SECRET:?}
JWT_SECRET = <%= env('GITEA_JWT_SECRET') %>
[security]
INSTALL_LOCK = true
INTERNAL_TOKEN = ${GITEA_INTERNAL_TOKEN:?}
SECRET_KEY = ${GITEA_SECRET_KEY:?}
INTERNAL_TOKEN = <%= env('GITEA_INTERNAL_TOKEN') %>
SECRET_KEY = <%= env('GITEA_SECRET_KEY') %>
[database]
DB_TYPE = sqlite3
@ -35,7 +35,7 @@ DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /mnt/gitea/lfs
LFS_JWT_SECRET = ${GITEA_LFS_JWT_SECRET:?}
LFS_JWT_SECRET = <%= env('GITEA_LFS_JWT_SECRET') %>
OFFLINE_MODE = false
[mailer]
@ -43,7 +43,7 @@ ENABLED = true
HOST = smtp.mailgun.org:587
FROM = Jeremy Dormitzer's Git Forge <noreply@git.jeremydormitzer.com>
USER = noreply@mg.git.jeremydormitzer.com
PASSWD = ${GITEA_MAILGUN_PASSWORD:?}
PASSWD = <%= env('GITEA_MAILGUN_PASSWORD') %>
[service]
REGISTER_EMAIL_CONFIRM = true

View File

@ -1 +1 @@
dns_digitalocean_token = ${DIGITALOCEAN_API_TOKEN:?}
dns_digitalocean_token = <%= env('DIGITALOCEAN_API_TOKEN') %>