I have a Nomad job that I have defined for a MySQL database instance. I have a dump file that I would like to use when the new instance is deployed. The following template
stanza has worked well with other database files:
template {
change_mode = "noop"
destination = "${NOMAD_SECRETS_DIR}/init/database.sql"
data = file("./source/database-dump.sql")
}
However, I am migrating a database which has characters which are not in the UTF-8 character set. This results in the following message:
Error in function call; Call to function "file" failed:
contents of ./source/database-dump.sql are not valid UTF-8;
use the filebase64 function to obtain the Base64 encoded contents
or the other file functions (e.g. filemd5, filesha256) to obtain file hashing results instead.
If I take the advice from the error message:
template {
change_mode = "noop"
destination = "${NOMAD_SECRETS_DIR}/init/database.sql"
data = filebase64("./source/database-dump.sql")
}
The resulting message is:
Call to unknown function; There is no function named "filebase64".`
I have tried recreating the MySQL dump file using UTF-8, but nomad-pack
still complains.
Any ideas how I can get nomad-pack
to read the file?