Skip to content
Snippets Groups Projects
Commit 58b37af5 authored by Riccardo Boero's avatar Riccardo Boero :innocent:
Browse files

Fix dependencies, move results contianer code to OrchestratorRegistry

parent c5af467a
No related branches found
No related tags found
No related merge requests found
# This file is machine-generated - editing it directly is not advised
julia_version = "1.11.0"
julia_version = "1.11.1"
manifest_format = "2.0"
project_hash = "613a3ab9060f4be97b3abd7bc64dae597686a44f"
project_hash = "bc643919572a39ab88c9b019a12df86e9ce5afc3"
[[deps.ANSIColoredPrinters]]
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
......@@ -126,9 +126,9 @@ version = "1.6.0"
[[deps.ExceptionUnwrapping]]
deps = ["Test"]
git-tree-sha1 = "dcb08a0d93ec0b1cdc4af184b26b591e9695423a"
git-tree-sha1 = "d36f682e590a83d63d1c7dbd287573764682d12a"
uuid = "460bff9d-24e4-43bc-9d9f-a8973cb893f4"
version = "0.1.10"
version = "0.1.11"
[[deps.Expat_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
......@@ -158,10 +158,10 @@ uuid = "f8c6e375-362e-5223-8a59-34ff63f689eb"
version = "2.36.1+2"
[[deps.HTTP]]
deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"]
git-tree-sha1 = "d1d712be3164d61d1fb98e7ce9bcbc6cc06b45ed"
deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "PrecompileTools", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"]
git-tree-sha1 = "ae350b8225575cc3ea385d4131c81594f86dfe4f"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "1.10.8"
version = "1.10.12"
[[deps.IOCapture]]
deps = ["Logging", "Random"]
......@@ -216,11 +216,11 @@ version = "0.21.4"
[[deps.JuliaDockerClient]]
deps = ["Base64", "Documenter", "HTTP", "JSON", "Sockets", "Test"]
git-tree-sha1 = "e6326771e04b90a86ee26285cf792715f6ff3e88"
git-tree-sha1 = "fc8d2c9ffa3d5328bd2c2505bf4e3f84f54a2326"
repo-rev = "main"
repo-url = "https://git.nilu.no/fact/utils/JuliaDockerClient.jl.git"
uuid = "a780814a-4c69-448d-b4b8-c460781333f9"
version = "0.1.1"
version = "0.1.2"
[[deps.LaTeXStrings]]
git-tree-sha1 = "50901ebc375ed41dbf8058da26f9de442febbbec"
......@@ -294,9 +294,9 @@ version = "1.11.0"
[[deps.LoggingExtras]]
deps = ["Dates", "Logging"]
git-tree-sha1 = "c1dd6d7978c12545b4179fb6153b9250c96b0075"
git-tree-sha1 = "f02b56007b064fbfddb4c9cd60161b6dd0f40df3"
uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36"
version = "1.0.3"
version = "1.1.0"
[[deps.MariaDB_Connector_C_jll]]
deps = ["Artifacts", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "Pkg", "Zlib_jll"]
......@@ -378,6 +378,14 @@ git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1"
uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e"
version = "0.5.5+0"
[[deps.OrchestratorRegistry]]
deps = ["HTTP", "JuliaDockerClient"]
git-tree-sha1 = "c5aeec8e437199262c5d20d68bc2ef851fc993d9"
repo-rev = "main"
repo-url = "https://git.nilu.no/fact/utils/OrchestratorRegistry.jl.git"
uuid = "b9d03754-910a-4bb6-b2d8-aec5d72e1905"
version = "0.1.0"
[[deps.OrderedCollections]]
git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
......
......@@ -10,9 +10,11 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuliaDockerClient = "a780814a-4c69-448d-b4b8-c460781333f9"
MySQL = "39abe10b-433b-5dbd-92d4-e302a9df00cd"
OrchestratorRegistry = "b9d03754-910a-4bb6-b2d8-aec5d72e1905"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[compat]
JuliaDockerClient = "0.1.1"
JuliaDockerClient = "0.1.2"
OrchestratorRegistry = "0.1.0"
......@@ -33,11 +33,8 @@ The module exports various functions from included scripts. Key functionalities
module FACT_unified_data_IO
using MySQL, JSON, DataFrames, UUIDs, Dates, SHA
using JuliaDockerClient
using OrchestratorRegistry
include("utils/docker.jl")
export get_results_container, stop_container_update_image
include("utils/db.jl")
export get_connection, close_connection
......
"""
get_results_container(registry_url::String="registry.git.nilu.no", username::String="FACT_token", password::String="glpat-1zG-TQx___xLsPjj2vsG", host::String="localhost", port::Int=3330, DBuser::String="root", DBpassword::String="devops")
Retrieve connection details and create a Docker container for the FACT Results service.
# Arguments
- `auth_token::String`: Authentication token required for operations that interact with the Docker registry.
- `host::String`: The hostname or IP address of the MySQL database server (default is "localhost").
- `port::Int`: The port number for the MySQL database server (default is 3330).
- `DBuser::String`: The username for authenticating with the MySQL database (default is "root").
- `DBpassword::String`: The password for authenticating with the MySQL database (default is "devops").
# Returns
- A dictionary containing the connection details for the MySQL database, including the hostname, port, username, and password.
This function performs the following steps:
1. Logs in to the specified Docker registry using the provided username and password.
2. Creates a Docker container for the FACT Results service with the specified configuration.
3. Returns a dictionary with the MySQL database connection details for further use.
"""
function get_results_container(auth_token::String; host::String="127.0.0.1", port::Int=3330, DBuser::String="root", DBpassword::String="devops")
# Create a dictionary representing the container configuration
results_container_config = Dict(
"Image" => "registry.git.nilu.no/fact/output/factdatasetio/fact_results:latest",
"Tty" => true,
"AttachStdin" => true,
"AttachStdout" => true,
"AttachStderr" => true,
"Env" => ["MARIADB_DATABASE=FACT_results", "MYSQL_ROOT_PASSWORD=$DBpassword"],
"HostConfig" => Dict(
"PortBindings" => Dict(
"3306/tcp" => [Dict("HostPort" => "$port")]
)
)
)
# create container
create_container(results_container_config, "fact_results", auth_token=auth_token)
# return connection details
conn_config = Dict(
"host" => host,
"port" => port,
"user" => DBuser,
"password" => DBpassword
)
return conn_config
end
"""
stop_container_update_image(auth_token::String)
Stops a running Docker container, commits the container's current state to a new Docker image, and then pushes this image to a Docker registry. Additionally, it tags the newly committed image with a unique identifier (UUID) before pushing it again.
This function is specifically tailored for managing Docker images related to the FACT project, ensuring that the latest state of the `fact_results` container is saved and available in the registry for future use.
# Arguments
- `auth_token::String`: Authentication token required for operations that interact with the Docker registry.
# Steps Performed
1. Stops the `fact_results` container.
2. Commits the stopped container's state to a new image named `registry.git.nilu.no/fact/output/factdatasetio/fact_results` with the `latest` tag.
3. Pushes the `latest` tagged image to the registry.
4. Generates a new UUID, tags the `latest` image with this UUID, and pushes this uniquely tagged image to the registry.
# Example
auth_token = "your_auth_token_here"
stop_container_update_image(auth_token)
This will stop the `fact_results` container, commit its state as a new image with both the `latest` tag and a unique UUID tag, and then push these images to the specified Docker registry.
"""
function stop_container_update_image(auth_token::String)
# stop container
stop_container("fact_results", auth_token=auth_token)
# commit container
commit_container("fact_results", "registry.git.nilu.no/fact/output/factdatasetio/fact_results", "latest", auth_token=auth_token)
# push image
push_image("registry.git.nilu.no/fact/output/factdatasetio/fact_results:latest", auth_token=auth_token)
# tag image as UUID
UUID = string(UUIDs.uuid4())
tag_image("registry.git.nilu.no/fact/output/factdatasetio/fact_results", "latest", "registry.git.nilu.no/fact/output/factdatasetio/fact_results", "$UUID", auth_token=auth_token)
# push image
push_image("registry.git.nilu.no/fact/output/factdatasetio/fact_results:$UUID", auth_token=auth_token)
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment