Skip to content

Commit 116e2b4

Browse files
committed
add back static export, remove references to app
1 parent cfcaebc commit 116e2b4

File tree

10 files changed

+81
-126
lines changed

10 files changed

+81
-126
lines changed

Cargo.lock

Lines changed: 28 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,6 @@ overflow-checks = false
146146
[profile.release]
147147
lto = true
148148
strip = true
149+
150+
[patch.crates-io]
151+
sunfish = { path = "../sunfish" }

crates/www/content/docs_guides/run_the_app_on_your_own_server/post.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"title": "Run the App on Your Own Server."
33
}
44

5-
If you do not want to use the cloud hosted modelfox app at https://app.modelfox.dev, you can run it yourself!
6-
75
To get started, install the ModelFox CLI and run `modelfox app`. This runs the app in a configuration suitable for testing on a single computer. It stores data in the local filesystem and in a local SQLite database.
86

97
To run the app in production, you will need:
@@ -113,6 +111,6 @@ Use the `url` key to specify the URL at which the app is accessible to users. Th
113111

114112
```json
115113
{
116-
"url": "https://app.modelfox.dev"
114+
"url": "https://app-url"
117115
}
118116
```

crates/www/layouts/docs_layout.rs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -245,57 +245,6 @@ impl Component for PageNav {
245245
.selected(self.selected_page == Some(DocsPage::Internals(internal.slug)))
246246
}),
247247
))
248-
.child(
249-
ui::NavSection::new("Languages".to_owned())
250-
.child(
251-
ui::NavItem::new()
252-
.title("C".to_owned())
253-
.href("/docs/languages/c".to_owned())
254-
.selected(false),
255-
)
256-
.child(
257-
ui::NavItem::new()
258-
.title("Elixir".to_owned())
259-
.href("/docs/languages/elixir".to_owned())
260-
.selected(false),
261-
)
262-
.child(
263-
ui::NavItem::new()
264-
.title("Go".to_owned())
265-
.href("/docs/languages/go".to_owned())
266-
.selected(false),
267-
)
268-
.child(
269-
ui::NavItem::new()
270-
.title("JavaScript".to_owned())
271-
.href("/docs/languages/javascript".to_owned())
272-
.selected(false),
273-
)
274-
.child(
275-
ui::NavItem::new()
276-
.title("PHP".to_owned())
277-
.href("/docs/languages/php".to_owned())
278-
.selected(false),
279-
)
280-
.child(
281-
ui::NavItem::new()
282-
.title("Python".to_owned())
283-
.href("/docs/languages/python".to_owned())
284-
.selected(false),
285-
)
286-
.child(
287-
ui::NavItem::new()
288-
.title("Ruby".to_owned())
289-
.href("/docs/languages/ruby".to_owned())
290-
.selected(false),
291-
)
292-
.child(
293-
ui::NavItem::new()
294-
.title("Rust".to_owned())
295-
.href("/docs/languages/rust".to_owned())
296-
.selected(false),
297-
),
298-
)
299248
.into_node()
300249
}
301250
}

crates/www/layouts/footer.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ impl Component for Footer {
2828
.title("Email".to_owned())
2929
.child("Email Us"),
3030
);
31-
let app = div()
32-
.class("footer-section")
33-
.child(div().class("footer-section-title").child("App"))
34-
.child(
35-
ui::Link::new()
36-
.href("https://app.modelfox.dev".to_owned())
37-
.title("Log In".to_owned())
38-
.child("Log In"),
39-
);
4031
let community = div()
4132
.class("footer-section")
4233
.child(div().class("footer-section-title").child("Community"))
@@ -84,8 +75,7 @@ impl Component for Footer {
8475
.child(logo)
8576
.child(community)
8677
.child(learn)
87-
.child(company)
88-
.child(app);
78+
.child(company);
8979
div()
9080
.class("footer-wrapper")
9181
.child(

crates/www/layouts/layout.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ impl Component for Topbar {
6464
href: "/benchmarks".to_owned(),
6565
title: "Benchmarks".to_owned(),
6666
},
67-
ui::TopbarItem {
68-
element: None,
69-
href: "https://app.modelfox.dev".to_owned(),
70-
title: "Login".to_owned(),
71-
},
7267
ui::TopbarItem {
7368
element: Some(
7469
ui::Button::new()

crates/www/main.rs

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use anyhow::Result;
2+
use clap::*;
3+
use std::path::PathBuf;
24
use std::{net::SocketAddr, sync::Arc};
35
use sunfish::Sunfish;
46
use tracing::error;
@@ -8,26 +10,54 @@ struct Context {
810
sunfish: Sunfish,
911
}
1012

13+
#[derive(Parser)]
14+
enum Args {
15+
#[clap(name = "serve")]
16+
Serve,
17+
#[clap(name = "export")]
18+
Export(ExportArgs),
19+
}
20+
21+
#[derive(Parser)]
22+
struct ExportArgs {
23+
path: PathBuf,
24+
}
25+
1126
#[tokio::main]
1227
async fn main() -> Result<()> {
1328
setup_tracing();
29+
let args = Args::parse();
1430
let sunfish = sunfish::init!();
15-
let host_from_env = if let Ok(host) = std::env::var("HOST") {
16-
Some(host.parse()?)
17-
} else {
18-
None
19-
};
20-
let host = host_from_env.unwrap_or_else(|| "0.0.0.0".parse().unwrap());
21-
let port_from_env = if let Ok(port) = std::env::var("PORT") {
22-
Some(port.parse()?)
23-
} else {
24-
None
25-
};
26-
let port = port_from_env.unwrap_or(8080);
27-
let addr = SocketAddr::new(host, port);
28-
let context = Context { sunfish };
29-
let context = Arc::new(context);
30-
modelfox_serve::serve(addr, context, handle).await?;
31+
match args {
32+
Args::Serve => {
33+
let host_from_env = if let Ok(host) = std::env::var("HOST") {
34+
Some(host.parse()?)
35+
} else {
36+
None
37+
};
38+
let host = host_from_env.unwrap_or_else(|| "0.0.0.0".parse().unwrap());
39+
let port_from_env = if let Ok(port) = std::env::var("PORT") {
40+
Some(port.parse()?)
41+
} else {
42+
None
43+
};
44+
let port = port_from_env.unwrap_or(8080);
45+
let addr = SocketAddr::new(host, port);
46+
let context = Context { sunfish };
47+
let context = Arc::new(context);
48+
modelfox_serve::serve(addr, context, handle).await?;
49+
}
50+
Args::Export(export_args) => {
51+
export(sunfish, export_args.path).await?;
52+
}
53+
}
54+
Ok(())
55+
}
56+
57+
async fn export(sunfish: Sunfish, path: PathBuf) -> Result<()> {
58+
let out_dir = std::path::Path::new(env!("OUT_DIR"));
59+
let dist_path = std::env::current_dir()?.join(path);
60+
sunfish.export(out_dir, &dist_path)?;
3161
Ok(())
3262
}
3363

crates/www/routes/docs/getting_started/inspect/server/page.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl Component for Page {
223223
];
224224
let m1 = ui::Markdown::new(ui::doc!(
225225
r#"
226-
We can learn more about our model with the modelfox app. Run `modelfox app` and open your browser to http://localhost:8080, or use the cloud hosted app at https://app.modelfox.dev.
226+
We can learn more about our model with the modelfox app. Run `modelfox app` and open your browser to http://localhost:8080.
227227
228228
Click the "Create Repo" button to create a new repo. Repos allow you to manage and compare multiple versions of the same model, just like git repos hold multiple versions of the same codebase. Click "Upload Model" to upload the first version of your model.
229229

0 commit comments

Comments
 (0)