diff --git a/compose.yaml b/compose.yaml index eabfa14..5c071b8 100644 --- a/compose.yaml +++ b/compose.yaml @@ -23,6 +23,7 @@ services: networks: website_net: ipv4_address: "88.88.5.2" + expose: - "8006" @@ -54,6 +55,20 @@ services: ports: - "19001:80" + website: + container_name: "site" + restart: always + build: + context: ./vvsite + dockerfile: Dockerfile + + networks: + website_net: + ipv4_address: "88.88.5.3" + + expose: + - "3000" + networks: website_net: # external: false diff --git a/minishell/minishell_src/bin/minishell b/minishell/minishell_src/bin/minishell new file mode 100755 index 0000000..f832fbd Binary files /dev/null and b/minishell/minishell_src/bin/minishell differ diff --git a/minishell/minishell_src/libft/libft.a b/minishell/minishell_src/libft/libft.a new file mode 100644 index 0000000..1361ee4 Binary files /dev/null and b/minishell/minishell_src/libft/libft.a differ diff --git a/nginx/nginx.conf b/nginx/nginx.conf index b0d9e56..9ae6e72 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -42,12 +42,8 @@ http { root /server; - location / { - index index.html; - } - - location /minishell { - proxy_pass http://88.88.5.2:8006/; + location /minishell/vnc { + proxy_pass http://minishell:8006/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; @@ -55,6 +51,15 @@ http { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } + location / { + proxy_pass http://website:3000/; + proxy_http_version 1.1; + # proxy_set_header Upgrade $http_upgrade; + # proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } #error_page 404 /404.html; diff --git a/run.sh b/run.sh index 87132ae..521cc3c 100755 --- a/run.sh +++ b/run.sh @@ -5,13 +5,18 @@ set -e # Compile the minishell project make -C minishell/minishell_src +# rebuild website +cd vvsite && cargo leptos build +cd .. + # stop containers if running docker compose down -v # remove volumes docker volume prune -f -docker network rm website_website_net -f -docker rmi website-nginx + +docker rmi website-website website-minishell website-nginx -f + # start the containers docker compose up diff --git a/vvsite/Cargo.toml b/vvsite/Cargo.toml index 196b656..be4bb1a 100644 --- a/vvsite/Cargo.toml +++ b/vvsite/Cargo.toml @@ -55,7 +55,7 @@ tailwind-input-file = "assets/tailwind/tailwind.css" # Optional. Env: LEPTOS_ASSETS_DIR. assets-dir = "assets/public" # The IP and port (ex: 127.0.0.1:3000) where the server serves the content. Use it in your server setup. -site-addr = "127.0.0.1:3000" +site-addr = "0.0.0.0:3000" # The port to use for automatic reload monitoring reload-port = 3001 # [Optional] Command to use when running end2end tests. It will run in the end2end dir. diff --git a/vvsite/Dockerfile b/vvsite/Dockerfile new file mode 100644 index 0000000..2035d61 --- /dev/null +++ b/vvsite/Dockerfile @@ -0,0 +1,10 @@ +FROM archlinux + +WORKDIR /website +COPY ./target/site /website/target/site +COPY ./target/debug/vvsite /website/vvsite + +COPY ./Cargo.toml /website/Cargo.toml +RUN chmod +x /website/vvsite + +CMD ["/website/vvsite"] diff --git a/vvsite/src/main.rs b/vvsite/src/main.rs index 014e1e4..7aa7f6b 100644 --- a/vvsite/src/main.rs +++ b/vvsite/src/main.rs @@ -7,7 +7,7 @@ async fn main() -> std::io::Result<()> { use leptos_actix::{generate_route_list, LeptosRoutes}; use vvsite::website::client::app::*; - let conf = get_configuration(None).await.unwrap(); + let conf = get_configuration(Some("Cargo.toml")).await.unwrap(); let addr = conf.leptos_options.site_addr; // Generate the list of routes in your Leptos App let routes = generate_route_list(App); diff --git a/vvsite/src/website/client/pages/minishell.rs b/vvsite/src/website/client/pages/minishell.rs index 716f769..c697e16 100644 --- a/vvsite/src/website/client/pages/minishell.rs +++ b/vvsite/src/website/client/pages/minishell.rs @@ -8,7 +8,7 @@ pub fn MinishellPage() -> impl IntoView{

"The (mini) Shell"

-