Skip to content

Commit 88dfcb4

Browse files
committed
refactor: restructure repository into workspace with separated backend and frontend
- Created Cargo workspace structure with backend in src/backend/ - Moved Vue 3 frontend from vue/ to src/frontend/ - Updated build artifacts location from src/backend/static/ to dist/ - Removed redundant root biome.json (frontend has its own) - Updated all Docker paths and build scripts for new structure - Updated documentation to reflect new project layout This prepares the codebase for future Crux framework integration. Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
1 parent 3d7b09b commit 88dfcb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+107
-151
lines changed

.dockerignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
vue/node_modules
2-
vue/dist
3-
vue/.vscode
1+
src/frontend/node_modules
2+
src/frontend/dist
3+
src/frontend/.vscode
4+
target

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ centrifugo
55
*.tar.gz
66
*.env
77
*.http
8-
/static
8+
/dist
99
CLAUDE.md

Cargo.toml

Lines changed: 7 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,13 @@
1-
[package]
1+
[workspace]
2+
resolver = "2"
3+
members = [
4+
"src/backend",
5+
]
6+
7+
[workspace.package]
28
authors = ["omnect@conplement.de"]
3-
description = "WebService providing access to omnect device features."
49
edition = "2024"
510
homepage = "https://www.omnect.io/home"
611
license = "MIT OR Apache-2.0"
7-
name = "omnect-ui"
8-
readme = "README.md"
912
repository = "git@github.com:omnect/omnect-ui.git"
1013
version = "1.1.0"
11-
build = "src/build.rs"
12-
13-
[dependencies]
14-
actix-cors = { version = "0.7", default-features = false }
15-
actix-files = { version = "0.6", default-features = false }
16-
actix-multipart = { version = "0.7", default-features = false, features = [
17-
"tempfile",
18-
"derive"
19-
] }
20-
actix-server = { version = "2.6", default-features = false }
21-
actix-session = { version = "0.11", features = ["cookie-session"] }
22-
actix-web = { version = "4.11", default-features = false, features = [
23-
"macros",
24-
"rustls-0_23",
25-
] }
26-
actix-web-httpauth = { version = "0.8", default-features = false }
27-
anyhow = { version = "1.0", default-features = false }
28-
argon2 = { version = "0.5", default-features = false, features = ["password-hash", "alloc"] }
29-
base64 = { version = "0.22", default-features = false }
30-
env_logger = { version = "0.11", default-features = false }
31-
jwt-simple = { version = "0.12", default-features = false, features = [
32-
"optimal",
33-
] }
34-
log = { version = "0.4", default-features = false }
35-
log-panics = { version = "2.1", default-features = false, features = [
36-
"with-backtrace",
37-
] }
38-
mockall = { version = "0.13", optional = true, default-features = false }
39-
rand_core = { version = "0.9", default-features = false, features = ["std"] }
40-
reqwest = { version = "0.12.23", default-features = false, features = ["json", "rustls-tls"] }
41-
rust-ini = { version = "0.21", default-features = false }
42-
rustls = { version = "0.23", default-features = false, features = [
43-
"aws_lc_rs",
44-
"std",
45-
"tls12",
46-
] }
47-
rustls-pemfile = { version = "2.2", default-features = false, features = [
48-
"std",
49-
] }
50-
semver = { version = "1.0", default-features = false }
51-
serde = { version = "1.0", default-features = false, features = ["derive"] }
52-
serde_json = { version = "1.0", default-features = false, features = [
53-
"raw_value",
54-
] }
55-
serde_repr = { version = "0.1", default-features = false }
56-
serde_valid = { version = "2.0", default-features = false }
57-
tokio = { version = "1.45", default-features = false, features = [
58-
"macros",
59-
"net",
60-
"process",
61-
] }
62-
trait-variant = { version = "0.1", default-features = false }
63-
uuid = { version = "1.17", default-features = false, features = [
64-
"v4",
65-
] }
66-
67-
[features]
68-
mock = ["dep:mockall"]
69-
70-
[dev-dependencies]
71-
actix-http = "3.11"
72-
actix-service = "2.0"
73-
mockall_double = "0.3"
74-
tempfile = "3.20"

Dockerfile

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ ARG DISTROLESS_IMAGE=gcr.io/distroless/base-debian12:nonroot
44

55
FROM oven/bun AS vue-install
66
RUN mkdir -p /tmp
7-
COPY vue/package.json /tmp
8-
COPY vue/bun.lock /tmp
7+
COPY src/frontend/package.json /tmp
8+
COPY src/frontend/bun.lock /tmp
99
RUN cd /tmp && bun install --frozen-lockfile
1010

1111
FROM oven/bun AS vue-build
1212
WORKDIR /usr/src/app
13-
COPY vue .
13+
COPY src/frontend .
1414
COPY --from=vue-install /tmp/node_modules node_modules
1515
RUN bun run build
1616

@@ -34,22 +34,18 @@ RUN curl -sSLf https://centrifugal.dev/install.sh | sh
3434

3535
COPY --from=distroless /var/lib/dpkg/status.d /distroless_pkgs
3636

37-
RUN cargo new /work/omnect-ui
37+
COPY Cargo.lock ./Cargo.lock
38+
COPY Cargo.toml ./Cargo.toml
39+
COPY src ./src
3840

39-
COPY Cargo.lock ./omnect-ui/Cargo.lock
40-
COPY Cargo.toml ./omnect-ui/Cargo.toml
41-
COPY src/build.rs ./omnect-ui/src/build.rs
41+
RUN --mount=type=cache,target=/usr/local/cargo/registry cargo build ${OMNECT_UI_BUILD_ARG} --release -p omnect-ui --target-dir ./build
4242

43-
RUN --mount=type=cache,target=/usr/local/cargo/registry cd omnect-ui && cargo build ${OMNECT_UI_BUILD_ARG} --release --target-dir ./build
44-
45-
COPY src ./omnect-ui/src/
46-
COPY .git ./omnect-ui/.git
43+
COPY .git ./.git
4744
RUN --mount=type=cache,target=/usr/local/cargo/registry <<EOF
4845
set -e
4946
# update timestamps to force a new build
50-
touch /work/omnect-ui/src/main.rs
51-
cd omnect-ui/
52-
cargo build ${OMNECT_UI_BUILD_ARG} --release --target-dir ./build
47+
touch /work/src/backend/src/main.rs
48+
cargo build ${OMNECT_UI_BUILD_ARG} --release -p omnect-ui --target-dir ./build
5349
EOF
5450

5551
SHELL ["/bin/bash", "-c"]
@@ -58,7 +54,7 @@ RUN <<EOT
5854

5955
mkdir -p /copy/status.d
6056

61-
executable=(omnect-ui/build/release/omnect-ui)
57+
executable=(build/release/omnect-ui)
6258

6359
mkdir -p /copy/$(dirname "${executable}")
6460
cp "${executable}" /copy/"${executable}"
@@ -99,13 +95,13 @@ RUN mkdir /cert
9995

10096
FROM ${DISTROLESS_IMAGE} AS base
10197
COPY --from=builder --chown=10000:10000 /cert /cert
102-
COPY --from=builder /work/omnect-ui/build/release/omnect-ui /
98+
COPY --from=builder /work/build/release/omnect-ui /
10399
COPY --from=builder /work/centrifugo /
104100
COPY --from=builder /copy/lib/ /lib/
105101
COPY --from=builder /copy/status.d /var/lib/dpkg/status.d
106-
COPY --from=vue-build /usr/src/app/dist /static/
102+
COPY --from=vue-build /usr/src/app/dist /dist/
107103

108104
WORKDIR "/"
109-
COPY config/centrifugo_config.json /
105+
COPY src/backend/config/centrifugo_config.json /
110106

111107
ENTRYPOINT [ "/omnect-ui" ]

biome.json

Lines changed: 0 additions & 54 deletions
This file was deleted.

build-and-run-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# file used for local development
22

33
# local build and run
4-
omnect_ui_version=$(toml get --raw Cargo.toml package.version)
4+
omnect_ui_version=$(toml get --raw Cargo.toml workspace.package.version)
55
omnect_ui_port="1977"
66
centrifugo_port="8000"
77

build-arm64-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# file used for local development
22

33
# local arm64 build
4-
omnect_ui_version=$(toml get --raw Cargo.toml package.version)
4+
omnect_ui_version=$(toml get --raw Cargo.toml workspace.package.version)
55

66
docker buildx build \
77
--platform linux/arm64 \

src/backend/Cargo.toml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[package]
2+
name = "omnect-ui"
3+
description = "WebService providing access to omnect device features."
4+
readme = "../../README.md"
5+
build = "src/build.rs"
6+
7+
authors.workspace = true
8+
edition.workspace = true
9+
homepage.workspace = true
10+
license.workspace = true
11+
repository.workspace = true
12+
version.workspace = true
13+
14+
[dependencies]
15+
actix-cors = { version = "0.7", default-features = false }
16+
actix-files = { version = "0.6", default-features = false }
17+
actix-multipart = { version = "0.7", default-features = false, features = [
18+
"tempfile",
19+
"derive"
20+
] }
21+
actix-server = { version = "2.6", default-features = false }
22+
actix-session = { version = "0.11", features = ["cookie-session"] }
23+
actix-web = { version = "4.11", default-features = false, features = [
24+
"macros",
25+
"rustls-0_23",
26+
] }
27+
actix-web-httpauth = { version = "0.8", default-features = false }
28+
anyhow = { version = "1.0", default-features = false }
29+
argon2 = { version = "0.5", default-features = false, features = ["password-hash", "alloc"] }
30+
base64 = { version = "0.22", default-features = false }
31+
env_logger = { version = "0.11", default-features = false }
32+
jwt-simple = { version = "0.12", default-features = false, features = [
33+
"optimal",
34+
] }
35+
log = { version = "0.4", default-features = false }
36+
log-panics = { version = "2.1", default-features = false, features = [
37+
"with-backtrace",
38+
] }
39+
mockall = { version = "0.13", optional = true, default-features = false }
40+
rand_core = { version = "0.9", default-features = false, features = ["std"] }
41+
reqwest = { version = "0.12.23", default-features = false, features = ["json", "rustls-tls"] }
42+
rust-ini = { version = "0.21", default-features = false }
43+
rustls = { version = "0.23", default-features = false, features = [
44+
"aws_lc_rs",
45+
"std",
46+
"tls12",
47+
] }
48+
rustls-pemfile = { version = "2.2", default-features = false, features = [
49+
"std",
50+
] }
51+
semver = { version = "1.0", default-features = false }
52+
serde = { version = "1.0", default-features = false, features = ["derive"] }
53+
serde_json = { version = "1.0", default-features = false, features = [
54+
"raw_value",
55+
] }
56+
serde_repr = { version = "0.1", default-features = false }
57+
serde_valid = { version = "2.0", default-features = false }
58+
tokio = { version = "1.45", default-features = false, features = [
59+
"macros",
60+
"net",
61+
"process",
62+
] }
63+
trait-variant = { version = "0.1", default-features = false }
64+
uuid = { version = "1.17", default-features = false, features = [
65+
"v4",
66+
] }
67+
68+
[features]
69+
mock = ["dep:mockall"]
70+
71+
[dev-dependencies]
72+
actix-http = "3.11"
73+
actix-service = "2.0"
74+
mockall_double = "0.3"
75+
tempfile = "3.20"
File renamed without changes.

0 commit comments

Comments
 (0)