Comments (8)
Okay, the contributing docs have been updated, and there's a new Bonnie script for working easily with the docs. Let me know in a discussion/issue (whatever's appropriate) if you have any problems.
from perseus.
Wow. First off, thank you for the detail, that's greatly appreciated! I'll begin investigating this shortly, because I'd be surprised if this isn't a bug.
from perseus.
Okay, I'm about 90% sure this is actually really simple: you need to be in app/pkg
and then execute ./server
from there, because it uses the directory from which you run it as its working directory. Without Docker, I can replicate that behavior on my local system. This is basically the definition of a 'gotcha', and either needs to be fixed or documented copiously!
from perseus.
This should be fixable with std::env::current_exe()
if that's the case. I'll check everything against your Dockerfile in a moment, but if you can also verify that moving into app/pkg
works, that'd be great.
from perseus.
This seems to avoid the errors in the Dockerfile, so I'll release this as beta 11.
from perseus.
Nice. Thank you for making a new beta release so quickly. I posted everything I could cause I'd have never figured out what causes the problem and I'm really glad you did!
Now when deploying with docker, the only thing that was missing was setting the HOST
env var to 0.0.0.0
. Without that the web app isn't accessible from outside of the resulting docker container. Bellow is the updated Dockerfile
. At the 2nd stage it now produces a rather small docker image.
Dockerfile
# get the base image
FROM rust:1.55-slim AS build
# install build dependencies
RUN apt update \
&& apt install -y --no-install-recommends lsb-release apt-transport-https \
git inotify-tools ca-certificates build-essential make gcc curl
# prepare root project dir
WORKDIR /app
# download the target for wasm
RUN rustup target add wasm32-unknown-unknown
# install wasm-pack
RUN cargo install wasm-pack
# retrieve the project dir
RUN curl https://codeload.github.com/arctic-hen7/perseus/tar.gz/main | tar -xz --strip=2 perseus-main/examples/basic
# go to src dir
WORKDIR /app/basic
# remove perseus from repo
RUN rm -rf .perseus/
# install perseus-cli
RUN cargo install perseus-cli --version 0.3.0-beta.11
# adjust perseus version
RUN sed -i s'/perseus = .*/perseus = "0.3.0-beta.11"/' ./Cargo.toml
# deploy app
RUN perseus deploy
# prepare deployment image
FROM debian:bullseye-slim
WORKDIR /app
COPY --from=build /app/basic/pkg /app/
ENV PERSEUS_STANDALONE=true
ENV HOST=0.0.0.0
CMD ["/app/server"]
Output of docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
perseus-basic 2021-10-16 cdef870e7a10 32 seconds ago 91.8MB
<none> <none> d32992ff17eb 18 minutes ago 2.33GB
rust 1.55-slim 1ee58c5365b4 3 days ago 654MB
debian bullseye-slim dd984c2cf05c 4 days ago 80.4MB
Once I manage to add all the optimizations and deploy to a VPS, would you mind if I sent a PR documenting the docker deployment to production? Actually, I've got no idea where and how to start changing the docs, so, that should be interesting.
from perseus.
My pleasure, glad I could help! Ah, I observed that too, but I thought it might be my firewall (which really hates Docker with a passion).
Please go ahead, that'd be great! I'll update the contributing page for adding to the docs, because I don't think there's actually anything about doing so yet...
from perseus.
Great. Thanks for the congributing page update. I'll see if I can understand any of that.
While trying to add bundle.wasm
file size optimizations to the Dockerfile
I ran into another problem I can't seem to be able to solve. Maybe it's cause of the fact that this time I'm deploying to a VPS and not cause of optimizations. Still not sure. I'll prolly post a new issue later today. Thank you.
from perseus.
Related Issues (20)
- Nested static aliases fail with exporting HOT 8
- Cannot deploy a perseus app using beta.19 HOT 2
- Populate `lang` attribute on root `html` element when translator is present. HOT 2
- Incremental generation is broken for a template named index in the beta.19 HOT 4
- Build state function with non-`Clone` state results in suboptimal compiler error HOT 3
- Using the translation feature as well as having global build state causes an error when the user navigates directly to the root page (or any valid page) when not including the locale in the path. HOT 1
- Failed to run `cargo install perseus-cli` without the `--locked` flag HOT 4
- Using the builder pattern `input().bind_value(...)` perseus panics HOT 5
- Using global state in a Capsule as well as a Template leads to unreachable code being reached at build-time HOT 2
- Vectors do not work in `ReactiveState` HOT 4
- [Router] [Bug] When using `.incremental_generation()`, you cannot navigate to a new route on the same page. HOT 3
- When trying to run a perseus app with docker, it gets: `Error: asset './dist/render_conf.json' not found in store` HOT 2
- Fail proceed 'perseus build' after upgraded to v0.4.1 HOT 3
- Build-time state can be user or "segment" specific, and it's actually easy to setup HOT 3
- Missing </body></html> HOT 1
- perseus-cli/0.4.2 crate is missing the tests folder HOT 3
- console_error_panic_hook HOT 2
- State amalgamation with different types HOT 1
- The command `Perseus serve -w` is very slow when listening to a large number of files. HOT 1
- Bootstrap scrollspy support HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from perseus.