Giter VIP home page Giter VIP logo

Comments (6)

arctic-hen7 avatar arctic-hen7 commented on May 14, 2024

This could be a product of multi-threading CLI operations. You can try it in single-threaded mode by setting the PERSEUS_CLI_SEQUENTIAL environment variable to true. It'll take a fair bit longer to compile, but that might avoid the memory issues.

If that doesn't work, then I would suggest local compilation and uploading of the pkg/ directory, though I of course realize that that is far from optimal.

from perseus.

phaleth avatar phaleth commented on May 14, 2024

Thanks for the hint about PERSEUS_CLI_SEQUENTIAL env var. I was gonna try that one today, but today the whole procedure fails repeatedly on the cargo install perseus-cli step, which worked fine yesterday. That particular step also fails locally, not only on the VPS. Maybe cause some of it's dependency changed over night and now it's broken. Not really sure.

Right now I can't confirm PERSEUS_CLI_SEQUENTIAL helps.

...
Step 8/22 : RUN cargo install perseus-cli --version 0.3.0-beta.12
 ---> Running in 072b7522f059
 Downloading crates ...
  Downloaded perseus-cli v0.3.0-beta.12
    Updating crates.io index
  Installing perseus-cli v0.3.0-beta.12
 Downloading crates ...
  Downloaded glob v0.3.0
  Downloaded clap_derive v3.0.0-beta.5
  Downloaded proc-macro-hack v0.5.19
  Downloaded strsim v0.10.0
  Downloaded textwrap v0.14.2
  Downloaded fs_extra v1.2.0
  Downloaded include_dir_impl v0.6.2
  Downloaded include_dir v0.6.2
  Downloaded fmterr v0.1.1
  Downloaded console v0.14.1
  Downloaded clap v3.0.0-beta.5
  Downloaded os_str_bytes v4.2.0
  Downloaded number_prefix v0.4.0
  Downloaded cargo_toml v0.9.2
  Downloaded anyhow v1.0.44
  Downloaded indicatif v0.17.0-beta.1
   Compiling proc-macro2 v1.0.30
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.80
   Compiling version_check v0.9.3
   Compiling libc v0.2.104
   Compiling serde v1.0.130
   Compiling anyhow v1.0.44
   Compiling proc-macro-hack v0.5.19
   Compiling memchr v2.4.1
   Compiling autocfg v1.0.1
   Compiling lazy_static v1.4.0
   Compiling serde_derive v1.0.130
   Compiling ryu v1.0.5
   Compiling unicode-segmentation v1.8.0
   Compiling regex-syntax v0.6.25
   Compiling unicode-width v0.1.9
   Compiling once_cell v1.8.0
   Compiling hashbrown v0.11.2
   Compiling serde_json v1.0.68
   Compiling itoa v0.4.8
   Compiling glob v0.3.0
   Compiling bitflags v1.3.2
   Compiling termcolor v1.1.2
   Compiling number_prefix v0.4.0
   Compiling strsim v0.10.0
   Compiling fs_extra v1.2.0
   Compiling fmterr v0.1.1
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling unicase v2.6.0
   Compiling indexmap v1.7.0
   Compiling heck v0.3.3
   Compiling textwrap v0.14.2
   Compiling regex v1.5.4
   Compiling quote v1.0.10
   Compiling terminal_size v0.1.17
   Compiling atty v0.2.14
   Compiling toml v0.5.8
   Compiling os_str_bytes v4.2.0
   Compiling console v0.15.0
   Compiling console v0.14.1
   Compiling indicatif v0.17.0-beta.1
   Compiling thiserror-impl v1.0.30
   Compiling include_dir_impl v0.6.2
   Compiling clap_derive v3.0.0-beta.5
   Compiling thiserror v1.0.30
   Compiling include_dir v0.6.2
   Compiling clap v3.0.0-beta.5
   Compiling cargo_toml v0.9.2
   Compiling perseus-cli v0.3.0-beta.12
error[E0432]: unresolved import `clap::Clap`
 --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:4:25
  |
4 | use clap::{AppSettings, Clap};
  |                         ^^^^ no `Clap` in the root

error: cannot determine resolution for the derive macro `Clap`
 --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:9:10
  |
9 | #[derive(Clap)]
  |          ^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:10:3
   |
10 | #[clap(version = PERSEUS_VERSION)]
   |   ^^^^

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:11:3
   |
11 | #[clap(setting = AppSettings::ColoredHelp)]
   |   ^^^^

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:13:7
   |
13 |     #[clap(subcommand)]
   |       ^^^^

error: cannot determine resolution for the derive macro `Clap`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:17:10
   |
17 | #[derive(Clap)]
   |          ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the derive macro `Clap`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:33:10
   |
33 | #[derive(Clap)]
   |          ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:36:7
   |
36 |     #[clap(long)]
   |       ^^^^

error: cannot determine resolution for the derive macro `Clap`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:40:10
   |
40 | #[derive(Clap)]
   |          ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:43:7
   |
43 |     #[clap(long)]
   |       ^^^^

error: cannot determine resolution for the derive macro `Clap`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:47:10
   |
47 | #[derive(Clap)]
   |          ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:50:7
   |
50 |     #[clap(long)]
   |       ^^^^

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:53:7
   |
53 |     #[clap(long)]
   |       ^^^^

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:56:7
   |
56 |     #[clap(long)]
   |       ^^^^

error: cannot determine resolution for the derive macro `Clap`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:60:10
   |
60 | #[derive(Clap)]
   |          ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:63:7
   |
63 |     #[clap(short, long)]
   |       ^^^^

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:66:7
   |
66 |     #[clap(short, long)]
   |       ^^^^

error: cannot determine resolution for the derive macro `Clap`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:70:10
   |
70 | #[derive(Clap)]
   |          ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:73:7
   |
73 |     #[clap(short, long, default_value = "pkg")]
   |       ^^^^

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:76:7
   |
76 |     #[clap(short, long)]
   |       ^^^^

error: cannot determine resolution for the derive macro `Clap`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:80:10
   |
80 | #[derive(Clap)]
   |          ^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:83:7
   |
83 |     #[clap(long)]
   |       ^^^^

error: cannot find attribute `clap` in this scope
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-cli-0.3.0-beta.12/src/parse.rs:86:7
   |
86 |     #[clap(long)]
   |       ^^^^

For more information about this error, try `rustc --explain E0432`.
error: could not compile `perseus-cli` due to 23 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `perseus-cli v0.3.0-beta.12`, intermediate artifacts can be found at `/tmp/cargo-install1dqwJE`

Caused by:
  build failed
ERROR: Service 'perseus' failed to build : The command '/bin/sh -c cargo install perseus-cli --version 0.3.0-beta.12' returned a non-zero code: 101

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 14, 2024

Okay I'm experiencing this on CI as well, I'm opening a new issue now.

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 14, 2024

Hmm, that issue seems to be to do with a major change in the clap API in the beta version that the CLI uses, so this is solved now, I'm making a new release now and yanking beta 12.

from perseus.

phaleth avatar phaleth commented on May 14, 2024

Ok, @arctic-hen7, thank you for the quick fix of that clap dependency issue.

So, as far as the memory issue goes I've tried everything I could think of including of course adding the ENV PERSEUS_CLI_SEQUENTIAL=true and nothing helped.

Later today I thought I should look into Sycamore's docs, cause I vaguely remembered something about Netlify there, which as I figured totally relates to the low memory problem I have on the VPS. The key thing here was to remove the lto = true. Without that config the Dockerfile builds on the VPS successfully.

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 src dir
RUN curl https://codeload.github.com/arctic-hen7/perseus/tar.gz/main | tar -xz --strip=2 perseus-main/examples/showcase

# go to src dir
WORKDIR /app/showcase

# install perseus-cli
RUN cargo install perseus-cli --version 0.3.0-beta.13

# clean app
RUN perseus clean

# adjust app config
RUN sed -i s'/perseus = .*/perseus = "0.3.0-beta.13"/' ./Cargo.toml \
  && sed -i '/\[dependencies\]/a wee_alloc = "0.4"' ./Cargo.toml

# append app config
RUN echo ' \n\
[profile.release] \n\
codegen-units = 1 \n\
opt-level = "s" \n\
lto = true ' >> ./Cargo.toml \
  && cat ./Cargo.toml

# prepend lib.rs
RUN echo '#[global_allocator] \n\
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; \n\
' | cat - ./src/lib.rs > ./src/lib.rs.tmp \
  && mv ./src/lib.rs.tmp ./src/lib.rs \
  && cat ./src/lib.rs

# prep and eject app
RUN perseus prep && perseus eject

# adjust and append perseus config
RUN sed -i s'/perseus = .*/perseus = "0.3.0-beta.13"/' .perseus/Cargo.toml \
  && echo ' \n\n\
[profile.release] \n\
codegen-units = 1 \n\
opt-level = "s" ' >> .perseus/Cargo.toml \
  && cat .perseus/Cargo.toml

# deploy app
RUN perseus deploy

# prepare deployment image
FROM bitnami/minideb:buster

WORKDIR /app

COPY --from=build /app/showcase/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Docker images

REPOSITORY                     TAG                                  IMAGE ID       CREATED          SIZE
perseus_basic_perseus          latest                               e49fba7445b8   19 minutes ago   77MB
<none>                         <none>                               ad74d20645b0   2 hours ago      2.33GB
rust                           1.55-slim                            1ee58c5365b4   7 days ago       654MB
bitnami/minideb                buster                               6ce7b3755a74   9 days ago       67.5MB

Screenshot of the deployed showcase example
optimized-on-server

from perseus.

arctic-hen7 avatar arctic-hen7 commented on May 14, 2024

Ah! That's also mentioned here under 'read this if something blows up in your face'! The size optimizations plugins I'm building at the moment (which will avoid the need to eject to apply these) will include that warning up front.

from perseus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.