feat: fix ci

This commit is contained in:
Kasper Juul Hermansen 2023-04-03 14:56:49 +02:00
parent 9565aa03b8
commit 079a076925
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
9 changed files with 182 additions and 136 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ node_modules/
test-results/
end2end/playwright-report/
playwright/.cache/
.env

161
Cargo.lock generated
View File

@ -73,7 +73,7 @@ checksum = "3b015a331cc64ebd1774ba119538573603427eaace0a1950c423ab971f903796"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -84,7 +84,7 @@ checksum = "b84f9ebcc6c1f5b8cb160f6990096a5c127f423fcb6e1ccc46c370cbdfb75dfc"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -170,7 +170,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -272,7 +272,7 @@ dependencies = [
"async_once",
"cached_proc_macro",
"cached_proc_macro_types",
"futures 0.3.26",
"futures 0.3.28",
"hashbrown 0.13.2",
"instant",
"lazy_static",
@ -291,7 +291,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -338,6 +338,7 @@ dependencies = [
"chrono",
"color-eyre",
"dagger-sdk",
"dotenv",
"eyre",
"tokio",
]
@ -610,7 +611,7 @@ dependencies = [
"proc-macro2",
"quote",
"scratch",
"syn",
"syn 1.0.109",
]
[[package]]
@ -627,14 +628,14 @@ checksum = "0b75aed41bb2e6367cae39e6326ef817a851db13c13e4f3263714ca3cfb8de56"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
name = "dagger-core"
version = "0.2.7"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e41269348f54df20e0a70b80617d074ebc5138f38ea0cd8e7e2879a2032652c0"
checksum = "1c552147e39ff7d59928d747a5020a450657508890dff430fe7ee5ed6a60869a"
dependencies = [
"clap",
"dirs",
@ -657,15 +658,15 @@ dependencies = [
[[package]]
name = "dagger-sdk"
version = "0.2.15"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "729d4b46f4a24dda5177c1a66ea8cffb18a2f08a83b085d086ff2b2caeff535e"
checksum = "79832c02f529359e731381419910894158d1d0e8101c578e207c43ace433efe9"
dependencies = [
"base64 0.21.0",
"dagger-core",
"derive_builder",
"eyre",
"futures 0.3.26",
"futures 0.3.28",
"gql_client",
"serde",
"serde_json",
@ -693,7 +694,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
"syn",
"syn 1.0.109",
]
[[package]]
@ -704,7 +705,7 @@ checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685"
dependencies = [
"darling_core",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -725,7 +726,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -735,7 +736,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
dependencies = [
"derive_builder_core",
"syn",
"syn 1.0.109",
]
[[package]]
@ -783,6 +784,12 @@ dependencies = [
"uuid",
]
[[package]]
name = "dotenv"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
[[package]]
name = "drain_filter_polyfill"
version = "0.1.3"
@ -804,7 +811,7 @@ dependencies = [
"enum-ordinalize",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -833,7 +840,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustc_version",
"syn",
"syn 1.0.109",
]
[[package]]
@ -948,9 +955,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678"
[[package]]
name = "futures"
version = "0.3.26"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84"
checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
dependencies = [
"futures-channel",
"futures-core",
@ -963,9 +970,9 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.26"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
dependencies = [
"futures-core",
"futures-sink",
@ -973,9 +980,9 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.26"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
[[package]]
name = "futures-cpupool"
@ -989,9 +996,9 @@ dependencies = [
[[package]]
name = "futures-executor"
version = "0.3.26"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e"
checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
dependencies = [
"futures-core",
"futures-task",
@ -1000,38 +1007,38 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.26"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531"
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
[[package]]
name = "futures-macro"
version = "0.3.26"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.13",
]
[[package]]
name = "futures-sink"
version = "0.3.26"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
[[package]]
name = "futures-task"
version = "0.3.26"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
[[package]]
name = "futures-util"
version = "0.3.26"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
dependencies = [
"futures-channel",
"futures-core",
@ -1064,7 +1071,7 @@ checksum = "c85fd34848b1f708e6344a4af6f7bfc05172ae20ce4b35c8e417efffb4f306aa"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -1118,7 +1125,7 @@ source = "git+https://github.com/kjuulh/gitevents.git?branch=main#6193de8778bdef
dependencies = [
"async-trait",
"eyre",
"futures 0.3.26",
"futures 0.3.28",
"git2",
"tokio",
"tokio-cron-scheduler",
@ -1218,7 +1225,7 @@ dependencies = [
"quote",
"serde",
"serde_json",
"syn",
"syn 1.0.109",
]
[[package]]
@ -1229,7 +1236,7 @@ checksum = "d52fc9cde811f44b15ec0692b31e56a3067f6f431c5ace712f286e47c1dacc98"
dependencies = [
"graphql_client_codegen",
"proc-macro2",
"syn",
"syn 1.0.109",
]
[[package]]
@ -1593,7 +1600,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57ef98bf3bea1540177c891d4c941758b280ba32b7117d742c407a7af73cc1af"
dependencies = [
"axum",
"futures 0.3.26",
"futures 0.3.28",
"http",
"hyper",
"leptos",
@ -1629,7 +1636,7 @@ dependencies = [
"cfg-if",
"drain_filter_polyfill",
"educe",
"futures 0.3.26",
"futures 0.3.28",
"html-escape",
"indexmap",
"itertools",
@ -1653,7 +1660,7 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "805c23be5155d8a9e2b1dbd5a2e6b11b3a545ab65142cb215e4348d4cd5813e3"
dependencies = [
"futures 0.3.26",
"futures 0.3.28",
"leptos",
"leptos_config",
"leptos_meta",
@ -1677,7 +1684,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"syn-rsx",
"uuid",
]
@ -1704,7 +1711,7 @@ checksum = "b6324377186e976f10a3059f425333f3b42fb8142d2400138ffbe9bd2e6d3bcd"
dependencies = [
"base64 0.21.0",
"cfg-if",
"futures 0.3.26",
"futures 0.3.28",
"js-sys",
"serde",
"serde-wasm-bindgen",
@ -1762,7 +1769,7 @@ dependencies = [
"serde",
"serde_json",
"serde_urlencoded",
"syn",
"syn 1.0.109",
"thiserror",
]
@ -1988,7 +1995,7 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -2067,7 +2074,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -2204,7 +2211,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -2235,7 +2242,7 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -2273,7 +2280,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebcd279d20a4a0a2404a33056388e950504d891c855c7975b9a8fef75f3bf04"
dependencies = [
"proc-macro2",
"syn",
"syn 1.0.109",
]
[[package]]
@ -2285,7 +2292,7 @@ dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"version_check",
]
@ -2302,18 +2309,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.51"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.23"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
dependencies = [
"proc-macro2",
]
@ -2556,7 +2563,7 @@ checksum = "1ef476a5790f0f6decbc66726b6e5d63680ed518283e64c7df415989d880954f"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -2720,7 +2727,7 @@ dependencies = [
]
[[package]]
name = "ssr_modes_axum"
name = "ssr_modes"
version = "0.1.0"
dependencies = [
"axum",
@ -2765,6 +2772,17 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn-rsx"
version = "0.9.0"
@ -2773,7 +2791,7 @@ checksum = "0b7b0f81c7d3e9bbe4b3005599a3e0b0bbb27bd3514f2b0567b478cc548c3736"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"thiserror",
]
@ -2833,7 +2851,7 @@ checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -2903,14 +2921,13 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.26.0"
version = "1.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001"
dependencies = [
"autocfg",
"bytes 1.4.0",
"libc",
"memchr",
"mio",
"num_cpus",
"parking_lot",
@ -2938,13 +2955,13 @@ dependencies = [
[[package]]
name = "tokio-macros"
version = "1.8.2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.13",
]
[[package]]
@ -3054,7 +3071,7 @@ checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -3139,7 +3156,7 @@ checksum = "258bc1c4f8e2e73a977812ab339d503e6feeb92700f6d07a6de4d321522d5c08"
dependencies = [
"lazy_static",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -3156,7 +3173,7 @@ checksum = "6179333b981641242a768f30f371c9baccbfcc03749627000c500ab88bf4528b"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -3323,7 +3340,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"wasm-bindgen-shared",
]
@ -3357,7 +3374,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]

View File

@ -11,7 +11,7 @@ chrono = { version = "0.4.23", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
[package]
name = "ssr_modes_axum"
name = "ssr_modes"
version = "0.1.0"
edition = "2021"

View File

@ -6,8 +6,9 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dagger-sdk = "0.2.15"
dagger-sdk = "0.2.19"
eyre = "0.6.8"
color-eyre = "0.6.2"
tokio = { version = "1.26.0", features = ["full"] }
tokio = { version = "1.27.0", features = ["full"] }
chrono.workspace = true
dotenv = "0.15.0"

View File

@ -1,5 +1,6 @@
#[tokio::main]
async fn main() -> eyre::Result<()> {
let _ = dotenv::dotenv();
let rust_image = "rustlang/rust:nightly";
let client = dagger_sdk::connect().await?;
@ -14,12 +15,18 @@ async fn main() -> eyre::Result<()> {
let minio_url = "https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-unknown-linux-musl.tar.gz";
let sccache_download_cache = client.cache_volume("sccache_download");
let cargo_cache = client.cache_volume("cargo_cache");
// Main container
let rust_base = client
.container()
.from(rust_image)
.with_exec(vec!["apt-get", "update"])
.with_exec(vec!["apt-get", "install", "--yes", "libpq-dev", "wget"])
.with_exec(vec!["mkdir", "-p", "/src/downloads"])
.with_workdir("/src/downloads")
.with_mounted_cache("/src/downloads", sccache_download_cache.id().await?)
.with_exec(vec!["wget", minio_url])
.with_exec(vec![
"tar",
@ -44,6 +51,8 @@ async fn main() -> eyre::Result<()> {
.with_env_variable("SCCACHE_BUCKET", "sccache")
.with_env_variable("SCCACHE_REGION", "auto")
.with_env_variable("SCCACHE_ENDPOINT", "https://api-minio.front.kjuulh.io")
.with_mounted_cache("~/.cargo", cargo_cache.id().await?)
.with_exec(vec!["rustup", "target", "add", "wasm32-unknown-unknown"])
.with_exec(vec!["cargo", "install", "cargo-chef"])
.with_exec(vec!["cargo", "install", "cargo-leptos"])
.with_workdir("/app");
@ -53,8 +62,10 @@ async fn main() -> eyre::Result<()> {
eyre::bail!("could not build base");
}
let target_cache = client.cache_volume("target_cache");
let rust_prepare = rust_base
.with_mounted_directory(".", workdir.id().await?)
.with_mounted_cache("target", target_cache.id().await?)
.with_exec(vec![
"cargo",
"chef",
@ -68,6 +79,8 @@ async fn main() -> eyre::Result<()> {
eyre::bail!("could not build prepare");
}
let target_rust_cache = client.cache_volume("target_rust_cache");
let rust_cacher = rust_base
.with_exec(vec!["apt", "update"])
.with_exec(vec![
@ -83,7 +96,7 @@ async fn main() -> eyre::Result<()> {
"/recipe.json",
rust_prepare.file("./recipe.json").id().await?,
)
.with_mounted_directory(".", workdir.id().await?)
.with_mounted_cache("target", target_rust_cache.id().await?)
.with_exec(vec![
"cargo",
"chef",
@ -91,36 +104,40 @@ async fn main() -> eyre::Result<()> {
"--release",
"--recipe-path",
"/recipe.json",
]);
])
.with_mounted_directory(".", workdir.id().await?);
let exit_code = rust_cacher.exit_code().await?;
if exit_code != 0 {
eyre::bail!("could not build cacher");
}
let rust_builder = rust_base
let nodejs_cacher = client.cache_volume("node");
// something
let rust_pre_builder = rust_cacher
.with_exec(vec!["mkdir", "-p", "node"])
.with_mounted_cache("node", nodejs_cacher.id().await?)
.with_exec(vec![
"curl",
"-sL",
"https://deb.nodesource.com/setup_12.x",
"-o",
"/node_12.txt",
"node/node_12.txt",
])
.with_exec(vec!["chmod", "+x", "/node_12.txt"])
.with_exec(vec!["bash", "-c", "/node_12.txt"])
.with_exec(vec!["chmod", "+x", "node/node_12.txt"])
.with_exec(vec!["bash", "-c", "node/node_12.txt"])
.with_exec(vec!["apt-get", "update"])
.with_exec(vec!["apt-get", "install", "nodejs"])
.with_mounted_directory(".", workdir.id().await?)
.with_directory(
"/app/target",
rust_cacher.directory("/app/target").id().await?,
)
.with_directory(
"/usr/local/cargo",
rust_cacher.directory("/usr/local/cargo").id().await?,
)
.with_exec(vec!["rustup", "target", "add", "wasm32-unknown-unknown"])
.with_exec(vec!["npm", "install", "-g", "sass"])
.with_exec(vec!["npm", "install", "-g", "sass"]);
let exit_code = rust_pre_builder.exit_code().await?;
if exit_code != 0 {
eyre::bail!("could not build rust_pre_builder");
}
let rust_builder = rust_pre_builder
.with_env_variable("LEPTOS_BROWSERQUERY", "defaults")
.with_exec(vec!["cargo", "leptos", "build", "--release"]);
@ -131,16 +148,49 @@ async fn main() -> eyre::Result<()> {
let tag = chrono::Utc::now().timestamp();
let prod_image = "gcr.io/distroless/cc-debian11";
let prod_image = "debian:bullseye";
let prod = client
.container()
.from(prod_image)
.with_exec(vec!["apt", "update"])
.with_exec(vec!["apt", "install", "-y", "zlib1g", "git"])
.with_workdir("/app")
.with_directory("/app", rust_builder.directory("/app/target").id().await?)
.with_env_variable("LEPTOS_SITE_ADDRESS", "0.0.0.0:3000")
.with_entrypoint(vec!["/app/server/release/ssr_mode_axum"]);
.with_file(
"/app/ssr_modes",
rust_builder
.file("/app/target/server/release/ssr_modes")
.id()
.await?,
)
.with_directory(
"/app/site",
rust_builder.directory("/app/target/site").id().await?,
)
.with_env_variable("LEPTOS_OUTPUT_NAME", "ssr_modes")
.with_env_variable("LEPTOS_SITE_ROOT", "site")
.with_env_variable("LEPTOS_SITE_PKG_DIR", "pkg")
.with_env_variable("LEPTOS_SITE_ADDR", "0.0.0.0:3000")
.with_env_variable("LEPTOS_RELOAD_PORT", "3001")
.with_entrypoint(vec!["/app/ssr_modes"]);
prod.publish(format!("docker.io/kasperhermansen/bitebuds:{tag}"))
let image_tag = format!("docker.io/kasperhermansen/bitebuds:{tag}");
prod.publish(&image_tag).await?;
let update_deployment = client
.container()
.from("kasperhermansen/update-deployment:1680472594")
.with_env_variable("GIT_USERNAME", "kjuulh")
.with_env_variable("GIT_PASSWORD", std::env::var("GIT_PASSWORD").unwrap())
.with_exec(vec![
"update-deployment",
"--repo",
"https://git.front.kjuulh.io/kjuulh/bitebuds-deployment.git",
"--service",
"bitebuds",
"--image",
&image_tag,
])
.exit_code()
.await?;
Ok(())

View File

@ -80,6 +80,7 @@ struct InnerEventStore {
url: Option<String>,
pub path: PathBuf,
events: Arc<tokio::sync::RwLock<Vec<Event>>>,
url_path: Option<String>,
}
#[derive(Clone)]
@ -92,9 +93,13 @@ impl EventStore {
let article_repo_url = std::env::var("BITE_ARTICLE_REPO_URL")
.map(|a| (a != "").then(|| a))
.unwrap_or(None);
let article_repo_path = std::env::var("BITE_ARTICLE_REPO_PATH")
.map(|a| (a != "").then(|| a))
.unwrap_or(None);
Self {
inner: Arc::new(InnerEventStore {
url: article_repo_url,
url_path: article_repo_path,
path,
events: Default::default(),
}),
@ -127,7 +132,7 @@ impl EventStore {
async move {
tracing::info!("updating articles");
let mut event_path = req.git.path.clone();
event_path.push("articles/events");
event_path.push(inner.url_path.as_ref().unwrap());
tracing::debug!(
path = event_path.display().to_string(),
@ -199,6 +204,7 @@ impl Default for EventStore {
url: Default::default(),
path: PathBuf::from("articles"),
events: Default::default(),
url_path: Some("articles/events".into()),
}),
}
}

View File

@ -20,7 +20,7 @@ cfg_if! {
.await
.map_err(|e| ServerFnError::ServerError(e.to_string()))?
.iter()
.filter(|d| d.time.gt(&chrono::Utc::now().date_naive()))
.filter(|d| d.time.ge(&chrono::Utc::now().date_naive()))
.map(|data| data.clone().into())
.collect();

View File

@ -4,21 +4,22 @@ async fn main() {
use axum::{extract::Extension, routing::post, Router};
use leptos::*;
use leptos_axum::{generate_route_list, LeptosRoutes};
use ssr_modes_axum::app::*;
use ssr_modes_axum::fallback::file_and_error_handler;
use ssr_modes::app::*;
use ssr_modes::fallback::file_and_error_handler;
use std::sync::Arc;
use tracing::metadata::LevelFilter;
use tracing_subscriber::EnvFilter;
std::env::set_var(
"BITE_ARTICLE_REPO_URL",
"git@git.front.kjuulh.io:kjuulh/articles.git",
"git@git.front.kjuulh.io:kjuulh/obsidian.git",
);
std::env::set_var("BITE_ARTICLE_REPO_PATH", "areas/food/events");
tracing_subscriber::fmt()
.with_max_level(LevelFilter::TRACE)
.with_env_filter(EnvFilter::from_default_env())
.init();
ssr_modes_axum::api::events::boostrap().await.unwrap();
ssr_modes::api::events::boostrap().await.unwrap();
let conf = get_configuration(None).await.unwrap();
let addr = conf.leptos_options.site_addr;
@ -26,7 +27,7 @@ async fn main() {
// Generate the list of routes in your Leptos App
let routes = generate_route_list(|cx| view! { cx, <App/> }).await;
ssr_modes_axum::api::register();
ssr_modes::api::register();
let app = Router::new()
.route("/api/*fn_name", post(leptos_axum::handle_server_fns))

View File

@ -655,22 +655,6 @@ video {
flex-grow: 1;
}
@keyframes bounce {
0%, 100% {
transform: translateY(-25%);
animation-timing-function: cubic-bezier(0.8,0,1,1);
}
50% {
transform: none;
animation-timing-function: cubic-bezier(0,0,0.2,1);
}
}
.animate-bounce {
animation: bounce 1s infinite;
}
@keyframes pulse {
50% {
opacity: .5;
@ -769,20 +753,6 @@ video {
border-top-right-radius: 1rem;
}
.border {
border-width: 1px;
}
.border-gray-400 {
--tw-border-opacity: 1;
border-color: rgb(156 163 175 / var(--tw-border-opacity));
}
.border-gray-300 {
--tw-border-opacity: 1;
border-color: rgb(209 213 219 / var(--tw-border-opacity));
}
.bg-gray-200 {
--tw-bg-opacity: 1;
background-color: rgb(229 231 235 / var(--tw-bg-opacity));