Compare commits

...

4 Commits

Author SHA1 Message Date
Eric S. Londres b474a19508
run application by default in docker build 2022-08-17 21:09:22 -04:00
Eric S. Londres f77c8f528d
wow, you can actually run this now! 2022-08-17 21:04:08 -04:00
Eric S. Londres 05f517b3be
more work on packer build script (not complete yet) 2022-08-17 20:16:29 -04:00
Eric S. Londres bb2e50fa74
create packer build file 2022-08-17 19:57:16 -04:00
2 changed files with 73 additions and 0 deletions

27
meta/build.pkr.hcl Normal file
View File

@ -0,0 +1,27 @@
# builds a container running egalaxyd
# make sure you have the "podman" packer plugin installed, ie: `packer plugins install github.com/Polpetta/podman`
source "docker" "egalaxyd" {
image = "elixir:1.13.4-otp-25-alpine"
commit = true
changes = [
"WORKDIR /root",
"EXPOSE 1965 3000",
"ENTRYPOINT /root/bin/egalaxyd start"
]
}
build {
sources = ["source.docker.egalaxyd"]
provisioner "shell" {
script = "install.sh"
}
post-processors {
post-processor "docker-tag" {
repository = "egalaxyd"
tags = ["0.4.4"]
}
}
}

46
meta/install.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/sh -e
# This script installs egalaxyd from source on an Alpine Linux host using default configuration options.
# It is expected that Erlang and Elixir are already installed and available on the host.
apk update
apk upgrade
apk add git
# Change to the home directory
cd
# Clone the egalaxyd repository
git clone --depth 1 --branch 0.4.4 https://git.sr.ht/~slondr/egalaxyd egalaxyd
cd egalaxyd
export MIX_ENV=prod
# Ensure we have hex installed (to pull dependencies)
mix local.hex --force
# Install dependencies
mix deps.get
# Compile the application so it is ready to
mix release
# By default the above command will produce a runnable script in the _build directory. However, that script can be
# unwieldy to run as it's both (a) in a deeply-nested subdirectory and (b) dependent on files from the toplevel
# existing in the working directory. To make this less cumbersome, we extract the tarball into ~ and copy over the
# relevant files.
cd ~
cp egalaxyd/_build/prod/egalaxyd-0.4.4.tar.gz ./
gunzip egalaxyd-0.4.4.tar.gz
tar -xf egalaxyd-0.4.4.tar
# egalaxyd excepts a private key named (by default) "server.key" and a certificate named "server.crt"
printf "TODO: Come up with a way for like, users to customize SSL settings easily\n" 1>&2
apk add openssl
openssl genrsa -out server.key 2048 # private key
openssl req -new -key server.key -out server.csr -subj '/C=SU/ST=FakeLocation/CN=mydomain.example.com' # sign req
openssl x509 -req -days 7 -in server.csr -signkey server.key -out server.crt
# Copy over the default Toml configuration file from the git source. Ideally this would have been part of the
# tarball, but that is WIP at the moment
cp egalaxyd/geminex.toml ./