Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.3.0-beta.14 perseus deploy fails consistently #69

Closed
phaleth opened this issue Oct 28, 2021 · 16 comments
Closed

0.3.0-beta.14 perseus deploy fails consistently #69

phaleth opened this issue Oct 28, 2021 · 16 comments

Comments

@phaleth
Copy link
Contributor

phaleth commented Oct 28, 2021

Describe the bug
Ever since 0.3.0-beta.14 is out perseus deploy consistently fails with two different errors on two different machines, locally and on a VPS. Right now, in the same way as described bellow, it's also impossible to deploy previous version 0.3.0-beta.13, which worked before the 0.3.0-beta.14 release. The Dockerfile bellow is standalone and does attempt to deploy the tiny example of this repo.

To Reproduce
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 \
  build-essential curl

# vars
ENV PERSEUS_VERSION=0.3.0-beta.14 \
    WEE_ALLOC_VERSION=0.4

# 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/tiny

# go to src dir
WORKDIR /app/tiny

# install perseus-cli
RUN cargo install perseus-cli --version $PERSEUS_VERSION

# clean app
RUN perseus clean

# specify deps in app config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
  && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml \
  && echo ' \n\
[profile.release] \n\
codegen-units = 1 \n\
opt-level = "s" \n\
lto = true ' >> ./Cargo.toml \
  && cat ./Cargo.toml

# modify and prepend lib.rs
RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs \
  && 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 = \"${PERSEUS_VERSION}\"/" .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/tiny/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Part of docker build output from local machine

...
Step 9/21 : RUN cargo install perseus-cli --version $PERSEUS_VERSION
 ---> Running in 48b225eaec3e
 Downloading crates ...
  Downloaded perseus-cli v0.3.0-beta.14
    Updating crates.io index
  Installing perseus-cli v0.3.0-beta.14
 Downloading crates ...
  Downloaded strsim v0.10.0
  Downloaded textwrap v0.14.2
  Downloaded clap v3.0.0-beta.5
  Downloaded proc-macro-hack v0.5.19
  Downloaded fmterr v0.1.1
  Downloaded glob v0.3.0
  Downloaded anyhow v1.0.44
  Downloaded include_dir_impl v0.6.2
  Downloaded clap_derive v3.0.0-beta.5
  Downloaded console v0.14.1
  Downloaded include_dir v0.6.2
  Downloaded number_prefix v0.4.0
  Downloaded cargo_toml v0.9.2
  Downloaded os_str_bytes v4.2.0
  Downloaded indicatif v0.17.0-beta.1
  Downloaded fs_extra v1.2.0
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling version_check v0.9.3
   Compiling libc v0.2.105
   Compiling serde v1.0.130
   Compiling anyhow v1.0.44
   Compiling memchr v2.4.1
   Compiling proc-macro-hack v0.5.19
   Compiling autocfg v1.0.1
   Compiling regex-syntax v0.6.25
   Compiling unicode-segmentation v1.8.0
   Compiling ryu v1.0.5
   Compiling lazy_static v1.4.0
   Compiling serde_derive v1.0.130
   Compiling unicode-width v0.1.9
   Compiling hashbrown v0.11.2
   Compiling serde_json v1.0.68
   Compiling once_cell v1.8.0
   Compiling itoa v0.4.8
   Compiling strsim v0.10.0
   Compiling termcolor v1.1.2
   Compiling number_prefix v0.4.0
   Compiling bitflags v1.3.2
   Compiling glob v0.3.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 textwrap v0.14.2
   Compiling indexmap v1.7.0
   Compiling heck v0.3.3
   Compiling regex v1.5.4
   Compiling os_str_bytes v4.2.0
   Compiling quote v1.0.10
   Compiling terminal_size v0.1.17
   Compiling atty v0.2.14
   Compiling console v0.15.0
   Compiling console v0.14.1
   Compiling indicatif v0.17.0-beta.1
   Compiling toml v0.5.8
   Compiling thiserror-impl v1.0.30
   Compiling clap_derive v3.0.0-beta.5
   Compiling include_dir_impl v0.6.2
   Compiling include_dir v0.6.2
   Compiling thiserror v1.0.30
   Compiling clap v3.0.0-beta.5
   Compiling cargo_toml v0.9.2
   Compiling perseus-cli v0.3.0-beta.14
    Finished release [optimized] target(s) in 1m 04s
  Installing /usr/local/cargo/bin/perseus
   Installed package `perseus-cli v0.3.0-beta.14` (executable `perseus`)
Removing intermediate container 48b225eaec3e
 ---> 54bf07daf838
Step 10/21 : RUN perseus clean
 ---> Running in 276dcb6cc379
Removing intermediate container 276dcb6cc379
 ---> e63df3b90eaf
Step 11/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml   && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml   && echo ' \n[profile.release] \ncodegen-units = 1 \nopt-level = "s" \nlto = true ' >> ./Cargo.toml   && cat ./Cargo.toml
 ---> Running in ff387002e768
[package]
name = "perseus-example-tiny"
version = "0.3.0-beta.14"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
wee_alloc = "0.4"
perseus = "0.3.0-beta.14"
sycamore = "0.6"
 
[profile.release] 
codegen-units = 1 
opt-level = "s" 
lto = true 
Removing intermediate container ff387002e768
 ---> b87a86f93ac4
Step 12/21 : RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && echo '#[global_allocator] \nstatic 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
 ---> Running in cd0981669fb5
#[global_allocator] 
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; 

use perseus::{define_app, ErrorPages, Template};
use sycamore::template;
define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    })
}
Removing intermediate container cd0981669fb5
 ---> ad243ddb97cf
Step 13/21 : RUN perseus prep && perseus eject
 ---> Running in 296f9f98d805
Removing intermediate container 296f9f98d805
 ---> b1dcbfb61541
Step 14/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml   && echo ' \n\n[profile.release] \ncodegen-units = 1 \nopt-level = "s" ' >> .perseus/Cargo.toml   && cat .perseus/Cargo.toml
 ---> Running in 368ed86f1eda
# This crate defines the user's app in terms that Wasm can understand, making development significantly simpler.
# IMPORTANT: spacing matters in this file for runtime replacements, do NOT change it!

[package]
name = "perseus-engine"
version = "0.3.0-beta.14"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# We alias here because the package name will change based on whatever's in the user's manifest
app = { package = "perseus-example-tiny", path = "../" }

perseus = "0.3.0-beta.14"
sycamore = { version = "0.6", features = ["ssr"] }
sycamore-router = "0.6"
web-sys = { version = "0.3", features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
console_error_panic_hook = "0.1.6"

# This section is needed for Wasm Pack (which we use instead of Trunk for flexibility)
[lib]
crate-type = ["cdylib", "rlib"]

[workspace] 

[profile.release] 
codegen-units = 1 
opt-level = "s" 
Removing intermediate container 368ed86f1eda
 ---> 711943076fd5
Step 15/21 : RUN perseus deploy
 ---> Running in 37ea51568596
Error: couldn't move `.perseus/pkg/` to `.perseus/dist/pkg/` (run `perseus clean` if this persists)

Caused by:
	Invalid cross-device link (os error 18)
The command '/bin/sh -c perseus deploy' returned a non-zero code: 1

Part of docker build output from VPS

...
Step 9/21 : RUN cargo install perseus-cli --version $PERSEUS_VERSION
 ---> Running in cd545af5bdf3
 Downloading crates ...
  Downloaded perseus-cli v0.3.0-beta.14
    Updating crates.io index
  Installing perseus-cli v0.3.0-beta.14
 Downloading crates ...
  Downloaded cargo_toml v0.9.2
  Downloaded include_dir v0.6.2
  Downloaded fmterr v0.1.1
  Downloaded os_str_bytes v4.2.0
  Downloaded strsim v0.10.0
  Downloaded proc-macro-hack v0.5.19
  Downloaded number_prefix v0.4.0
  Downloaded include_dir_impl v0.6.2
  Downloaded indicatif v0.17.0-beta.1
  Downloaded glob v0.3.0
  Downloaded fs_extra v1.2.0
  Downloaded console v0.14.1
  Downloaded anyhow v1.0.44
  Downloaded clap_derive v3.0.0-beta.5
  Downloaded clap v3.0.0-beta.5
  Downloaded textwrap v0.14.2
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling version_check v0.9.3
   Compiling libc v0.2.105
   Compiling serde v1.0.130
   Compiling anyhow v1.0.44
   Compiling proc-macro-hack v0.5.19
   Compiling autocfg v1.0.1
   Compiling memchr v2.4.1
   Compiling unicode-segmentation v1.8.0
   Compiling ryu v1.0.5
   Compiling unicode-width v0.1.9
   Compiling lazy_static v1.4.0
   Compiling regex-syntax v0.6.25
   Compiling serde_derive v1.0.130
   Compiling once_cell v1.8.0
   Compiling serde_json v1.0.68
   Compiling hashbrown v0.11.2
   Compiling strsim v0.10.0
   Compiling itoa v0.4.8
   Compiling glob v0.3.0
   Compiling number_prefix v0.4.0
   Compiling bitflags v1.3.2
   Compiling termcolor v1.1.2
   Compiling fmterr v0.1.1
   Compiling fs_extra v1.2.0
   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.14
    Finished release [optimized] target(s) in 2m 43s
  Installing /usr/local/cargo/bin/perseus
   Installed package `perseus-cli v0.3.0-beta.14` (executable `perseus`)
Removing intermediate container cd545af5bdf3
 ---> 25f00239fd3c
Step 10/21 : RUN perseus clean
 ---> Running in 9d5e3832deba
Removing intermediate container 9d5e3832deba
 ---> 27b455fc37f8
Step 11/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml   && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml   && echo ' \n[profile.release] \ncodegen-units = 1 \nopt-level = "s" \nlto = true ' >> ./Cargo.toml   && cat ./Cargo.toml
 ---> Running in 81363b9ea235
[package]
name = "perseus-example-tiny"
version = "0.3.0-beta.14"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
wee_alloc = "0.4"
perseus = "0.3.0-beta.14"
sycamore = "0.6"
 
[profile.release] 
codegen-units = 1 
opt-level = "s" 
lto = true 
Removing intermediate container 81363b9ea235
 ---> aa2e155c1003
Step 12/21 : RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && echo '#[global_allocator] \nstatic 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
 ---> Running in 593b24317e72
#[global_allocator] 
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; 

use perseus::{define_app, ErrorPages, Template};
use sycamore::template;
define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    })
}
Removing intermediate container 593b24317e72
 ---> cc3e7f0c4a12
Step 13/21 : RUN perseus prep && perseus eject
 ---> Running in 44ca42cbfb56
Removing intermediate container 44ca42cbfb56
 ---> 6956cf16c8b0
Step 14/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml   && echo ' \n\n[profile.release] \ncodegen-units = 1 \nopt-level = "s" ' >> .perseus/Cargo.toml   && cat .perseus/Cargo.toml
 ---> Running in 36fce3a82248
# This crate defines the user's app in terms that Wasm can understand, making development significantly simpler.
# IMPORTANT: spacing matters in this file for runtime replacements, do NOT change it!

[package]
name = "perseus-engine"
version = "0.3.0-beta.14"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# We alias here because the package name will change based on whatever's in the user's manifest
app = { package = "perseus-example-tiny", path = "../" }

perseus = "0.3.0-beta.14"
sycamore = { version = "0.6", features = ["ssr"] }
sycamore-router = "0.6"
web-sys = { version = "0.3", features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
console_error_panic_hook = "0.1.6"

# This section is needed for Wasm Pack (which we use instead of Trunk for flexibility)
[lib]
crate-type = ["cdylib", "rlib"]

[workspace] 

[profile.release] 
codegen-units = 1 
opt-level = "s" 
Removing intermediate container 36fce3a82248
 ---> ae1fa886efa7
Step 15/21 : RUN perseus deploy
 ---> Running in 89e40bbf8aac
    Updating crates.io index
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
 Downloading crates ...
  Downloaded actix-connect v2.0.0
  Downloaded rustc_version v0.3.3
  Downloaded serde_urlencoded v0.7.0
  Downloaded time-macros-impl v0.1.2
  Downloaded tracing-futures v0.2.5
  Downloaded const_fn v0.4.8
  Downloaded opaque-debug v0.3.0
  Downloaded version_check v0.1.5
  Downloaded ucd-trie v0.1.3
  Downloaded trust-dns-proto v0.19.7
  Downloaded pin-project-internal v1.0.8
  Downloaded pin-project-lite v0.1.12
  Downloaded rand v0.7.3
  Downloaded brotli-sys v0.3.2
  Downloaded actix-testing v1.0.1
  Downloaded actix-service v1.0.6
  Downloaded actix-router v0.2.7
  Downloaded bytestring v1.0.0
  Downloaded actix-web v3.3.2
  Downloaded digest v0.9.0
  Downloaded v_escape v0.15.0
  Downloaded pin-project v0.4.28
  Downloaded semver v0.11.0
  Downloaded time-macros v0.1.1
  Downloaded time v0.2.27
  Downloaded v_htmlescape v0.12.0
  Downloaded trust-dns-resolver v0.19.7
  Downloaded pin-project-internal v0.4.28
  Downloaded tokio-util v0.3.1
  Downloaded tokio v0.2.25
  Downloaded standback v0.2.17
  Downloaded perseus-actix-web v0.3.0-beta.14
  Downloaded lru-cache v0.1.2
  Downloaded generic-array v0.14.4
  Downloaded actix-rt v1.1.1
  Downloaded pest v2.1.3
  Downloaded match_cfg v0.1.0
  Downloaded language-tags v0.2.2
  Downloaded block-buffer v0.9.0
  Downloaded convert_case v0.4.0
  Downloaded actix-server v1.0.4
  Downloaded rand_core v0.5.1
  Downloaded semver-parser v0.10.2
  Downloaded brotli2 v0.3.2
  Downloaded derive_more v0.99.16
  Downloaded h2 v0.2.7
  Downloaded bytes v0.5.6
  Downloaded awc v2.0.3
  Downloaded actix-files v0.5.0
  Downloaded ppv-lite86 v0.2.15
  Downloaded pin-project v1.0.8
  Downloaded nom v4.2.3
  Downloaded tracing-core v0.1.21
  Downloaded enum-as-inner v0.3.3
  Downloaded linked-hash-map v0.5.4
  Downloaded getrandom v0.1.16
  Downloaded cookie v0.14.4
  Downloaded base64 v0.13.0
  Downloaded actix-utils v2.0.0
  Downloaded typenum v1.14.0
  Downloaded tracing v0.1.29
  Downloaded buf-min v0.4.0
  Downloaded v_escape_derive v0.8.5
  Downloaded rand_chacha v0.2.2
  Downloaded mio-uds v0.6.8
  Downloaded hostname v0.3.1
  Downloaded fxhash v0.2.1
  Downloaded cpufeatures v0.2.1
  Downloaded copyless v0.1.5
  Downloaded actix-web-codegen v0.4.0
  Downloaded actix-tls v2.0.0
  Downloaded actix-threadpool v0.3.3
  Downloaded actix-macros v0.1.3
  Downloaded threadpool v1.8.1
  Downloaded signal-hook-registry v1.4.0
  Downloaded sha-1 v0.9.8
  Downloaded resolv-conf v0.7.0
  Downloaded actix-codec v0.3.0
  Downloaded actix-http v2.2.1
  Downloaded socket2 v0.3.19
    Blocking waiting for file lock on package cache
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling libc v0.2.105
   Compiling cfg-if v1.0.0
   Compiling version_check v0.9.3
   Compiling autocfg v1.0.1
   Compiling log v0.4.14
   Compiling memchr v2.4.1
   Compiling proc-macro-hack v0.5.19
   Compiling futures-core v0.3.17
   Compiling slab v0.4.5
   Compiling serde_derive v1.0.130
   Compiling futures-sink v0.3.17
   Compiling serde v1.0.130
   Compiling ryu v1.0.5
   Compiling futures-channel v0.3.17
   Compiling pin-project-lite v0.2.7
   Compiling cfg-if v0.1.10
   Compiling futures-task v0.3.17
   Compiling proc-macro-nested v0.1.7
   Compiling itoa v0.4.8
   Compiling smallvec v1.7.0
   Compiling pin-utils v0.1.0
   Compiling futures-io v0.3.17
   Compiling lazy_static v1.4.0
   Compiling serde_json v1.0.68
   Compiling bytes v0.5.6
   Compiling wasm-bindgen-shared v0.2.78
   Compiling pin-project-lite v0.1.12
   Compiling bumpalo v3.8.0
   Compiling parking_lot_core v0.8.5
   Compiling pin-project-internal v0.4.28
   Compiling scopeguard v1.1.0
   Compiling getrandom v0.1.16
   Compiling convert_case v0.4.0
   Compiling bytes v1.1.0
   Compiling static_assertions v1.1.0
   Compiling wasm-bindgen v0.2.78
   Compiling hashbrown v0.11.2
   Compiling async-trait v0.1.51
   Compiling matches v0.1.9
   Compiling fnv v1.0.7
   Compiling percent-encoding v2.1.0
   Compiling tinyvec_macros v0.1.0
   Compiling typenum v1.14.0
   Compiling bitflags v1.3.2
   Compiling copyless v0.1.5
   Compiling either v1.6.1
   Compiling ppv-lite86 v0.2.15
   Compiling unicode-bidi v0.3.7
   Compiling unicode-segmentation v1.8.0
   Compiling const_fn v0.4.8
   Compiling cc v1.0.71
   Compiling match_cfg v0.1.0
   Compiling ident_case v1.0.1
   Compiling strsim v0.10.0
   Compiling quick-error v1.2.3
   Compiling once_cell v1.8.0
   Compiling version_check v0.1.5
   Compiling linked-hash-map v0.5.4
   Compiling crc32fast v1.2.1
   Compiling minimal-lexical v0.1.4
   Compiling encoding_rs v0.8.29
   Compiling utf8-width v0.1.5
   Compiling regex-syntax v0.6.25
   Compiling adler v1.0.2
   Compiling httparse v1.5.1
   Compiling byteorder v1.4.3
   Compiling mime v0.3.16
   Compiling opaque-debug v0.3.0
   Compiling cpufeatures v0.2.1
   Compiling v_escape v0.15.0
   Compiling language-tags v0.2.2
   Compiling base64 v0.13.0
   Compiling wee_alloc v0.4.5
   Compiling fmterr v0.1.1
   Compiling urlencoding v2.1.0
   Compiling v_htmlescape v0.12.0
   Compiling memory_units v0.4.0
   Compiling instant v0.1.12
   Compiling standback v0.2.17
error: could not compile `regex-syntax`

Caused by:
  process didn't exit successfully: `rustc --crate-name regex_syntax --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.6.25/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="unicode"' --cfg 'feature="unicode-age"' --cfg 'feature="unicode-bool"' --cfg 'feature="unicode-case"' --cfg 'feature="unicode-gencat"' --cfg 'feature="unicode-perl"' --cfg 'feature="unicode-script"' --cfg 'feature="unicode-segment"' -C metadata=09d5543a3c98c8ca -C extra-filename=-09d5543a3c98c8ca --out-dir /app/tiny/.perseus/server/target/release/deps -L dependency=/app/tiny/.perseus/server/target/release/deps --cap-lints allow` (signal: 9, SIGKILL: kill)
warning: build failed, waiting for other jobs to finish...
error: build failed
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling autocfg v1.0.1
   Compiling serde_derive v1.0.130
   Compiling serde v1.0.130
   Compiling ryu v1.0.5
   Compiling log v0.4.14
   Compiling wasm-bindgen-shared v0.2.78
   Compiling serde_json v1.0.68
   Compiling cfg-if v1.0.0
   Compiling bumpalo v3.8.0
   Compiling lazy_static v1.4.0
   Compiling version_check v0.9.3
   Compiling itoa v0.4.8
   Compiling memchr v2.4.1
   Compiling wasm-bindgen v0.2.78
   Compiling static_assertions v1.1.0
   Compiling futures-core v0.3.17
   Compiling proc-macro-hack v0.5.19
   Compiling proc-macro-nested v0.1.7
   Compiling futures-task v0.3.17
   Compiling futures-channel v0.3.17
   Compiling libc v0.2.105
   Compiling futures-sink v0.3.17
   Compiling once_cell v1.8.0
   Compiling ident_case v1.0.1
   Compiling fnv v1.0.7
   Compiling hashbrown v0.11.2
   Compiling strsim v0.10.0
   Compiling pin-utils v0.1.0
   Compiling slab v0.4.5
   Compiling futures-io v0.3.17
   Compiling pin-project-lite v0.2.7
   Compiling smallvec v1.7.0
   Compiling minimal-lexical v0.1.4
   Compiling utf8-width v0.1.5
   Compiling async-trait v0.1.51
   Compiling bytes v1.1.0
   Compiling wee_alloc v0.4.5
   Compiling fmterr v0.1.1
   Compiling cfg-if v0.1.10
   Compiling urlencoding v2.1.0
   Compiling memory_units v0.4.0
   Compiling indexmap v1.7.0
   Compiling futures-macro v0.3.17
   Compiling num-traits v0.2.14
   Compiling futures-util v0.3.17
   Compiling num-integer v0.1.44
   Compiling ahash v0.7.6
   Compiling nom v7.0.0
   Compiling lexical-util v0.8.1
   Compiling html-escape v0.2.9
   Compiling http v0.2.5
   Compiling lexical-write-integer v0.8.0
   Compiling lexical-parse-integer v0.8.0
   Compiling quote v1.0.10
   Compiling time v0.1.43
   Compiling lexical-write-float v0.8.2
   Compiling lexical-parse-float v0.8.2
   Compiling lexical-core v0.8.2
   Compiling chrono v0.4.19
   Compiling lexical v6.0.1
   Compiling wasm-bindgen-backend v0.2.78
   Compiling darling_core v0.13.0
error: could not compile `syn`

Caused by:
  process didn't exit successfully: `rustc --crate-name syn --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.81/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="clone-impls"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="extra-traits"' --cfg 'feature="full"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="proc-macro"' --cfg 'feature="quote"' --cfg 'feature="visit"' --cfg 'feature="visit-mut"' -C metadata=9e13baa20de7a851 -C extra-filename=-9e13baa20de7a851 --out-dir /app/tiny/.perseus/target/release/deps -L dependency=/app/tiny/.perseus/target/release/deps --extern proc_macro2=/app/tiny/.perseus/target/release/deps/libproc_macro2-cab6106af7d326c8.rmeta --extern quote=/app/tiny/.perseus/target/release/deps/libquote-06c3e2dc93d8e69e.rmeta --extern unicode_xid=/app/tiny/.perseus/target/release/deps/libunicode_xid-0770809ab462d12c.rmeta --cap-lints allow --cfg syn_no_negative_literal_parse --cfg syn_disable_nightly_tests` (signal: 9, SIGKILL: kill)
warning: build failed, waiting for other jobs to finish...
error: build failed
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
ERROR: Service 'perseus' failed to build : The command '/bin/sh -c perseus deploy' returned a non-zero code: 1

Expected behavior
perseus deploy to perform successfully at least for the version 0.3.0-beta.14.

Screenshots
None.

Environment (please complete the following information):

  • Perseus Version: 0.3.0-beta.14
  • Sycamore Version: 0.6.0
  • OS: both docker hosts run debian 10
  • Browser: Not relevant
  • Browser Version: Not relevant

Additional context
The Dockerfile above isn't using the perseus-size-opt plugin, but instead adds wee_alloc optimizations manually.

@arctic-hen7
Copy link
Member

Okay that's really weird, I'll debug this ASAP. I haven't updated the size optimisations plugin yet for beta 14, but that will happen very soon. Not sure what's going on here though yet...

@arctic-hen7
Copy link
Member

Btw, you don't need to add those size optimizations to the root Cargo.toml, they only need to be in the .perseus/Cargo.toml. Your app's crate is imported by the engine as a library, so it makes no difference.

@arctic-hen7
Copy link
Member

I genuinely have no clue what is happening here yet, but could you try without size optimizations as well and see what happens then?

@phaleth
Copy link
Contributor Author

phaleth commented Oct 29, 2021

I think the issue with 0.3.0-beta.14 is OS related. Right now I'm on a totally different computer with LMDE4 OS which, under the hood, is a debian 10 once again.

On this computer I ran 3 build tests. Results with Dockerfile for each are bellow. Note that the third test is for Perseus 0.3.0-beta.13.

1st Deployment test
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 \
  build-essential curl

# vars
ENV PERSEUS_VERSION=0.3.0-beta.14 \
    WEE_ALLOC_VERSION=0.4

# 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/tiny

# go to src dir
WORKDIR /app/tiny

# install perseus-cli
RUN cargo install perseus-cli --version $PERSEUS_VERSION

# clean app
RUN perseus clean

# specify deps in app config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
  && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml \
  && cat ./Cargo.toml

# modify and prepend lib.rs
RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs \
  && 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 = \"${PERSEUS_VERSION}\"/" .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/tiny/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Docker build output

...
Step 9/21 : RUN cargo install perseus-cli --version $PERSEUS_VERSION
 ---> Running in 6d83d5500ebc
 Downloading crates ...
  Downloaded perseus-cli v0.3.0-beta.14
    Updating crates.io index
  Installing perseus-cli v0.3.0-beta.14
 Downloading crates ...
  Downloaded include_dir_impl v0.6.2
  Downloaded clap_derive v3.0.0-beta.5
  Downloaded number_prefix v0.4.0
  Downloaded os_str_bytes v4.2.0
  Downloaded strsim v0.10.0
  Downloaded cargo_toml v0.9.2
  Downloaded fs_extra v1.2.0
  Downloaded console v0.14.1
  Downloaded fmterr v0.1.1
  Downloaded indicatif v0.17.0-beta.1
  Downloaded clap v3.0.0-beta.5
  Downloaded textwrap v0.14.2
  Downloaded proc-macro-hack v0.5.19
  Downloaded glob v0.3.0
  Downloaded anyhow v1.0.44
  Downloaded include_dir v0.6.2
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling version_check v0.9.3
   Compiling syn v1.0.81
   Compiling libc v0.2.105
   Compiling serde v1.0.130
   Compiling proc-macro-hack v0.5.19
   Compiling memchr v2.4.1
   Compiling anyhow v1.0.44
   Compiling autocfg v1.0.1
   Compiling serde_derive v1.0.130
   Compiling unicode-segmentation v1.8.0
   Compiling ryu v1.0.5
   Compiling unicode-width v0.1.9
   Compiling regex-syntax v0.6.25
   Compiling lazy_static v1.4.0
   Compiling hashbrown v0.11.2
   Compiling serde_json v1.0.68
   Compiling once_cell v1.8.0
   Compiling strsim v0.10.0
   Compiling itoa v0.4.8
   Compiling glob v0.3.0
   Compiling termcolor v1.1.2
   Compiling number_prefix v0.4.0
   Compiling bitflags v1.3.2
   Compiling fmterr v0.1.1
   Compiling fs_extra v1.2.0
   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 include_dir_impl v0.6.2
   Compiling thiserror-impl v1.0.30
   Compiling clap_derive v3.0.0-beta.5
   Compiling include_dir v0.6.2
   Compiling cargo_toml v0.9.2
   Compiling thiserror v1.0.30
   Compiling clap v3.0.0-beta.5
   Compiling perseus-cli v0.3.0-beta.14
    Finished release [optimized] target(s) in 5m 00s
  Installing /usr/local/cargo/bin/perseus
   Installed package `perseus-cli v0.3.0-beta.14` (executable `perseus`)
Removing intermediate container 6d83d5500ebc
 ---> 42b874c43d72
Step 10/21 : RUN perseus clean
 ---> Running in 8276537efeea
Removing intermediate container 8276537efeea
 ---> 759b86aac382
Step 11/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml   && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml   && cat ./Cargo.toml
 ---> Running in e356e35ab68d
[package]
name = "perseus-example-tiny"
version = "0.3.0-beta.14"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
wee_alloc = "0.4"
perseus = "0.3.0-beta.14"
sycamore = "0.6"
Removing intermediate container e356e35ab68d
 ---> 1d966e205357
Step 12/21 : RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && echo '#[global_allocator] \nstatic 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
 ---> Running in 440c8673f35d
#[global_allocator] 
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; 

use perseus::{define_app, ErrorPages, Template};
use sycamore::template;
define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    })
}
Removing intermediate container 440c8673f35d
 ---> 1da6baef2497
Step 13/21 : RUN perseus prep && perseus eject
 ---> Running in c185db7adc71
Removing intermediate container c185db7adc71
 ---> bf4ad85b25a3
Step 14/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml   && echo ' \n\n[profile.release] \ncodegen-units = 1 \nopt-level = "s" ' >> .perseus/Cargo.toml   && cat .perseus/Cargo.toml
 ---> Running in 2b385fa587f1
# This crate defines the user's app in terms that Wasm can understand, making development significantly simpler.
# IMPORTANT: spacing matters in this file for runtime replacements, do NOT change it!

[package]
name = "perseus-engine"
version = "0.3.0-beta.14"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# We alias here because the package name will change based on whatever's in the user's manifest
app = { package = "perseus-example-tiny", path = "../" }

perseus = "0.3.0-beta.14"
sycamore = { version = "0.6", features = ["ssr"] }
sycamore-router = "0.6"
web-sys = { version = "0.3", features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
console_error_panic_hook = "0.1.6"

# This section is needed for Wasm Pack (which we use instead of Trunk for flexibility)
[lib]
crate-type = ["cdylib", "rlib"]

[workspace] 

[profile.release] 
codegen-units = 1 
opt-level = "s" 
Removing intermediate container 2b385fa587f1
 ---> 8a3f1673a18d
Step 15/21 : RUN perseus deploy
 ---> Running in 5d58d3c6a7b8
Error: couldn't move `.perseus/pkg/` to `.perseus/dist/pkg/` (run `perseus clean` if this persists)

Caused by:
	Invalid cross-device link (os error 18)
The command '/bin/sh -c perseus deploy' returned a non-zero code: 1

2nd Deployment test
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 \
  build-essential curl

# vars
ENV PERSEUS_VERSION=0.3.0-beta.14

# 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/tiny

# go to src dir
WORKDIR /app/tiny

# install perseus-cli
RUN cargo install perseus-cli --version $PERSEUS_VERSION

# clean app
RUN perseus clean

# specify deps in app config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
  && cat ./Cargo.toml

# modify and prepend lib.rs
RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./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 = \"${PERSEUS_VERSION}\"/" .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/tiny/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Docker build output

...
Step 9/21 : RUN cargo install perseus-cli --version $PERSEUS_VERSION
 ---> Running in dba48af18922
 Downloading crates ...
  Downloaded perseus-cli v0.3.0-beta.14
    Updating crates.io index
  Installing perseus-cli v0.3.0-beta.14
 Downloading crates ...
  Downloaded console v0.14.1
  Downloaded fs_extra v1.2.0
  Downloaded strsim v0.10.0
  Downloaded indicatif v0.17.0-beta.1
  Downloaded clap v3.0.0-beta.5
  Downloaded cargo_toml v0.9.2
  Downloaded anyhow v1.0.44
  Downloaded os_str_bytes v4.2.0
  Downloaded number_prefix v0.4.0
  Downloaded textwrap v0.14.2
  Downloaded proc-macro-hack v0.5.19
  Downloaded clap_derive v3.0.0-beta.5
  Downloaded glob v0.3.0
  Downloaded include_dir_impl v0.6.2
  Downloaded fmterr v0.1.1
  Downloaded include_dir v0.6.2
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling version_check v0.9.3
   Compiling libc v0.2.105
   Compiling serde v1.0.130
   Compiling proc-macro-hack v0.5.19
   Compiling anyhow v1.0.44
   Compiling autocfg v1.0.1
   Compiling memchr v2.4.1
   Compiling unicode-segmentation v1.8.0
   Compiling ryu v1.0.5
   Compiling serde_derive v1.0.130
   Compiling regex-syntax v0.6.25
   Compiling lazy_static v1.4.0
   Compiling unicode-width v0.1.9
   Compiling serde_json v1.0.68
   Compiling once_cell v1.8.0
   Compiling hashbrown v0.11.2
   Compiling termcolor v1.1.2
   Compiling itoa v0.4.8
   Compiling number_prefix v0.4.0
   Compiling strsim v0.10.0
   Compiling bitflags v1.3.2
   Compiling glob v0.3.0
   Compiling fmterr v0.1.1
   Compiling fs_extra v1.2.0
   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 include_dir_impl v0.6.2
   Compiling thiserror-impl v1.0.30
   Compiling clap_derive v3.0.0-beta.5
   Compiling include_dir v0.6.2
   Compiling thiserror v1.0.30
   Compiling clap v3.0.0-beta.5
   Compiling cargo_toml v0.9.2
   Compiling perseus-cli v0.3.0-beta.14
    Finished release [optimized] target(s) in 7m 24s
  Installing /usr/local/cargo/bin/perseus
   Installed package `perseus-cli v0.3.0-beta.14` (executable `perseus`)
Removing intermediate container dba48af18922
 ---> 1d229f245f2d
Step 10/21 : RUN perseus clean
 ---> Running in e6b34dae74d4
Removing intermediate container e6b34dae74d4
 ---> fcab3999574d
Step 11/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml   && cat ./Cargo.toml
 ---> Running in 99da3d87bd97
[package]
name = "perseus-example-tiny"
version = "0.3.0-beta.14"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
perseus = "0.3.0-beta.14"
sycamore = "0.6"
Removing intermediate container 99da3d87bd97
 ---> 2bcc3d47c4fe
Step 12/21 : RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && cat ./src/lib.rs
 ---> Running in 173eb3f2262e
use perseus::{define_app, ErrorPages, Template};
use sycamore::template;
define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    })
}
Removing intermediate container 173eb3f2262e
 ---> 49b0ca56ef8c
Step 13/21 : RUN perseus prep && perseus eject
 ---> Running in b917c7b5e644
Removing intermediate container b917c7b5e644
 ---> 84af82b07e83
Step 14/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml   && cat .perseus/Cargo.toml
 ---> Running in 3b9b6b2174ab
# This crate defines the user's app in terms that Wasm can understand, making development significantly simpler.
# IMPORTANT: spacing matters in this file for runtime replacements, do NOT change it!

[package]
name = "perseus-engine"
version = "0.3.0-beta.14"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# We alias here because the package name will change based on whatever's in the user's manifest
app = { package = "perseus-example-tiny", path = "../" }

perseus = "0.3.0-beta.14"
sycamore = { version = "0.6", features = ["ssr"] }
sycamore-router = "0.6"
web-sys = { version = "0.3", features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
console_error_panic_hook = "0.1.6"

# This section is needed for Wasm Pack (which we use instead of Trunk for flexibility)
[lib]
crate-type = ["cdylib", "rlib"]

[workspace]Removing intermediate container 3b9b6b2174ab
 ---> aab1cc44d562
Step 15/21 : RUN perseus deploy
 ---> Running in 4e8513023820
Error: couldn't move `.perseus/pkg/` to `.perseus/dist/pkg/` (run `perseus clean` if this persists)

Caused by:
	Invalid cross-device link (os error 18)
The command '/bin/sh -c perseus deploy' returned a non-zero code: 1

3rd Deployment test
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 \
  build-essential curl

# vars
ENV PERSEUS_VERSION=0.3.0-beta.13

# 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/tiny

# go to src dir
WORKDIR /app/tiny

# install perseus-cli
RUN cargo install perseus-cli --version $PERSEUS_VERSION

# clean app
RUN perseus clean

# specify deps in app config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
  && cat ./Cargo.toml

# modify and prepend lib.rs
RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./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 = \"${PERSEUS_VERSION}\"/" .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/tiny/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Docker build output

...
Step 9/21 : RUN cargo install perseus-cli --version $PERSEUS_VERSION
 ---> Running in f60ae83aa53f
 Downloading crates ...
  Downloaded perseus-cli v0.3.0-beta.13
    Updating crates.io index
  Installing perseus-cli v0.3.0-beta.13
 Downloading crates ...
  Downloaded cargo_toml v0.9.2
  Downloaded include_dir v0.6.2
  Downloaded fs_extra v1.2.0
  Downloaded anyhow v1.0.44
  Downloaded glob v0.3.0
  Downloaded number_prefix v0.4.0
  Downloaded strsim v0.10.0
  Downloaded textwrap v0.14.2
  Downloaded os_str_bytes v4.2.0
  Downloaded include_dir_impl v0.6.2
  Downloaded proc-macro-hack v0.5.19
  Downloaded clap_derive v3.0.0-beta.5
  Downloaded indicatif v0.17.0-beta.1
  Downloaded console v0.14.1
  Downloaded clap v3.0.0-beta.5
  Downloaded fmterr v0.1.1
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling version_check v0.9.3
   Compiling syn v1.0.81
   Compiling libc v0.2.105
   Compiling serde v1.0.130
   Compiling proc-macro-hack v0.5.19
   Compiling anyhow v1.0.44
   Compiling memchr v2.4.1
   Compiling autocfg v1.0.1
   Compiling serde_derive v1.0.130
   Compiling unicode-width v0.1.9
   Compiling ryu v1.0.5
   Compiling unicode-segmentation v1.8.0
   Compiling regex-syntax v0.6.25
   Compiling lazy_static v1.4.0
   Compiling hashbrown v0.11.2
   Compiling serde_json v1.0.68
   Compiling once_cell v1.8.0
   Compiling itoa v0.4.8
   Compiling number_prefix v0.4.0
   Compiling glob v0.3.0
   Compiling termcolor v1.1.2
   Compiling bitflags v1.3.2
   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 textwrap v0.14.2
   Compiling heck v0.3.3
   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 include_dir_impl v0.6.2
   Compiling thiserror-impl v1.0.30
   Compiling clap_derive v3.0.0-beta.5
   Compiling include_dir v0.6.2
   Compiling cargo_toml v0.9.2
   Compiling thiserror v1.0.30
   Compiling clap v3.0.0-beta.5
   Compiling perseus-cli v0.3.0-beta.13
    Finished release [optimized] target(s) in 5m 44s
  Installing /usr/local/cargo/bin/perseus
   Installed package `perseus-cli v0.3.0-beta.13` (executable `perseus`)
Removing intermediate container f60ae83aa53f
 ---> d1c838333cbe
Step 10/21 : RUN perseus clean
 ---> Running in db120e69c4df
Removing intermediate container db120e69c4df
 ---> bd03e1889dcc
Step 11/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml   && cat ./Cargo.toml
 ---> Running in 2f07d11c1468
[package]
name = "perseus-example-tiny"
version = "0.3.0-beta.14"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
perseus = "0.3.0-beta.13"
sycamore = "0.6"
Removing intermediate container 2f07d11c1468
 ---> d25865ed3043
Step 12/21 : RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && cat ./src/lib.rs
 ---> Running in 2d2ad2696609
use perseus::{define_app, ErrorPages, Template};
use sycamore::template;
define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    })
}
Removing intermediate container 2d2ad2696609
 ---> ca732bec2609
Step 13/21 : RUN perseus prep && perseus eject
 ---> Running in fe63468bb46e
Removing intermediate container fe63468bb46e
 ---> a658a2ccbe00
Step 14/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml   && cat .perseus/Cargo.toml
 ---> Running in 7ef5af209c78
# This crate defines the user's app in terms that Wasm can understand, making development significantly simpler.
# IMPORTANT: spacing matters in this file for runtime replacements, do NOT change it!

[package]
name = "perseus-engine"
version = "0.3.0-beta.13"
edition = "2018"
default-run = "perseus-builder"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# We alias here because the package name will change based on whatever's in the user's manifest
app = { package = "perseus-example-tiny", path = "../" }

perseus = "0.3.0-beta.13"
sycamore = { version = "0.6", features = ["ssr"] }
sycamore-router = "0.6"
web-sys = { version = "0.3", features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"] }
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1" # Possibly don't need?
console_error_panic_hook = "0.1.6"
urlencoding = "2.1"
futures = "0.3"
fs_extra = "1"
lazy_static = "1"

# This section is needed for Wasm Pack (which we use instead of Trunk for flexibility)
[lib]
crate-type = ["cdylib", "rlib"]

# We define a binary for building, serving, and doing both
[[bin]]
name = "perseus-builder"
path = "src/bin/build.rs"

[[bin]]
name = "perseus-exporter"
path = "src/bin/export.rs"

[[bin]]
name = "perseus-tinker" # Yes, the noun is 'tinker', not 'tinkerer'
path = "src/bin/tinker.rs"

[workspace]
members = [ "server" ]Removing intermediate container 7ef5af209c78
 ---> 402e31cdda20
Step 15/21 : RUN perseus deploy
 ---> Running in 8bb9ce287d87
    Updating crates.io index
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
 Downloading crates ...
  Downloaded darling_core v0.13.0
  Downloaded bytes v1.1.0
  Downloaded async-trait v0.1.51
  Downloaded darling v0.13.0
  Downloaded ahash v0.7.6
  Downloaded darling_macro v0.13.0
  Downloaded lexical v6.0.1
  Downloaded js-sys v0.3.55
  Downloaded futures-sink v0.3.17
  Downloaded futures v0.3.17
  Downloaded perseus-macro v0.3.0-beta.14
  Downloaded pin-utils v0.1.0
  Downloaded lexical-util v0.8.1
  Downloaded static_assertions v1.1.0
  Downloaded utf8-width v0.1.5
  Downloaded urlencoding v2.1.0
  Downloaded sycamore-router v0.6.3
  Downloaded wasm-bindgen-shared v0.2.78
  Downloaded wasm-bindgen-macro v0.2.78
  Downloaded wasm-bindgen-futures v0.4.28
  Downloaded sycamore-router-macro v0.6.3
  Downloaded sycamore-reactive v0.6.3
  Downloaded sycamore v0.6.3
  Downloaded sycamore-macro v0.6.3
  Downloaded minimal-lexical v0.1.4
  Downloaded lexical-write-integer v0.8.0
  Downloaded lexical-write-float v0.8.2
  Downloaded futures-util v0.3.17
  Downloaded web-sys v0.3.55
  Downloaded proc-macro-nested v0.1.7
  Downloaded wasm-bindgen v0.2.78
  Downloaded futures-task v0.3.17
  Downloaded lexical-parse-integer v0.8.0
  Downloaded wasm-bindgen-macro-support v0.2.78
  Downloaded wasm-bindgen-backend v0.2.78
  Downloaded nom v7.0.0
  Downloaded bumpalo v3.8.0
  Downloaded lexical-parse-float v0.8.2
  Downloaded perseus v0.3.0-beta.14
  Downloaded lexical-core v0.8.2
  Downloaded pin-project-lite v0.2.7
  Downloaded ident_case v1.0.1
  Downloaded futures-channel v0.3.17
  Downloaded html-escape v0.2.9
  Downloaded futures-macro v0.3.17
  Downloaded futures-core v0.3.17
  Downloaded console_error_panic_hook v0.1.7
  Downloaded futures-executor v0.3.17
  Downloaded futures-io v0.3.17
  Downloaded http v0.2.5
    Blocking waiting for file lock on package cache
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling autocfg v1.0.1
   Compiling serde v1.0.130
   Compiling serde_derive v1.0.130
   Compiling ryu v1.0.5
   Compiling log v0.4.14
   Compiling wasm-bindgen-shared v0.2.78
   Compiling serde_json v1.0.68
   Compiling cfg-if v1.0.0
   Compiling lazy_static v1.4.0
   Compiling bumpalo v3.8.0
   Compiling version_check v0.9.3
   Compiling memchr v2.4.1
   Compiling itoa v0.4.8
   Compiling static_assertions v1.1.0
   Compiling libc v0.2.105
   Compiling wasm-bindgen v0.2.78
   Compiling proc-macro-hack v0.5.19
   Compiling futures-core v0.3.17
   Compiling futures-task v0.3.17
   Compiling futures-channel v0.3.17
   Compiling proc-macro-nested v0.1.7
   Compiling strsim v0.10.0
   Compiling once_cell v1.8.0
   Compiling hashbrown v0.11.2
   Compiling futures-sink v0.3.17
   Compiling ident_case v1.0.1
   Compiling fnv v1.0.7
   Compiling smallvec v1.7.0
   Compiling futures-io v0.3.17
   Compiling pin-project-lite v0.2.7
   Compiling minimal-lexical v0.1.4
   Compiling pin-utils v0.1.0
   Compiling utf8-width v0.1.5
   Compiling slab v0.4.5
   Compiling async-trait v0.1.51
   Compiling bytes v1.1.0
   Compiling urlencoding v2.1.0
   Compiling fmterr v0.1.1
   Compiling fs_extra v1.2.0
   Compiling indexmap v1.7.0
   Compiling futures-macro v0.3.17
   Compiling futures-util v0.3.17
   Compiling num-traits v0.2.14
   Compiling num-integer v0.1.44
   Compiling ahash v0.7.6
   Compiling nom v7.0.0
   Compiling lexical-util v0.8.1
   Compiling html-escape v0.2.9
   Compiling http v0.2.5
   Compiling lexical-parse-integer v0.8.0
   Compiling lexical-write-integer v0.8.0
   Compiling quote v1.0.10
   Compiling getrandom v0.2.3
   Compiling time v0.1.43
   Compiling lexical-parse-float v0.8.2
   Compiling lexical-write-float v0.8.2
   Compiling lexical-core v0.8.2
   Compiling chrono v0.4.19
   Compiling lexical v6.0.1
   Compiling wasm-bindgen-backend v0.2.78
   Compiling darling_core v0.13.0
   Compiling wasm-bindgen-macro-support v0.2.78
   Compiling sycamore-macro v0.6.3
   Compiling sycamore-router-macro v0.6.3
   Compiling thiserror-impl v1.0.30
   Compiling wasm-bindgen-macro v0.2.78
   Compiling darling_macro v0.13.0
   Compiling thiserror v1.0.30
   Compiling darling v0.13.0
   Compiling futures-executor v0.3.17
   Compiling futures v0.3.17
   Compiling perseus-macro v0.3.0-beta.14
   Compiling js-sys v0.3.55
   Compiling console_error_panic_hook v0.1.7
   Compiling web-sys v0.3.55
   Compiling wasm-bindgen-futures v0.4.28
   Compiling sycamore-reactive v0.6.3
   Compiling sycamore v0.6.3
   Compiling sycamore-router v0.6.3
   Compiling perseus v0.3.0-beta.14
   Compiling perseus-example-tiny v0.3.0-beta.14 (/app/tiny)
   Compiling perseus-engine v0.3.0-beta.13 (/app/tiny/.perseus)
error[E0432]: unresolved imports `perseus::Locales`, `perseus::TemplateMap`
 --> src/app.rs:8:30
  |
8 |     ErrorPages, GenericNode, Locales, TemplateMap,
  |                              ^^^^^^^  ^^^^^^^^^^^ no `TemplateMap` in the root
  |                              |
  |                              no `Locales` in the root
  |
help: a similar name exists in the module
  |
8 |     ErrorPages, GenericNode, locales, TemplateMap,
  |                              ^^^^^^^
help: a similar name exists in the module
  |
8 |     ErrorPages, GenericNode, Locales, Template,
  |                                       ^^^^^^^^

error[E0432]: unresolved imports `perseus::app_shell`, `perseus::detect_locale`, `perseus::ClientTranslationsManager`
 --> src/lib.rs:8:15
  |
8 | use perseus::{app_shell, create_app_route, detect_locale, ClientTranslationsManager, DomNode};
  |               ^^^^^^^^^                    ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |               |                            |              |
  |               |                            |              no `ClientTranslationsManager` in the root
  |               |                            |              help: a similar name exists in the module: `client_translations_manager`
  |               |                            no `detect_locale` in the root
  |               no `app_shell` in the root

error[E0603]: module `error_pages` is private
  --> src/lib.rs:4:14
   |
4  | use perseus::error_pages::ErrorPageData;
   |              ^^^^^^^^^^^ private module
   |
note: the module `error_pages` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.14/src/lib.rs:48:1
   |
48 | mod error_pages;
   | ^^^^^^^^^^^^^^^^

error[E0603]: module `router` is private
  --> src/lib.rs:6:14
   |
6  | use perseus::router::{RouteInfo, RouteVerdict};
   |              ^^^^^^ private module
   |
note: the module `router` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.14/src/lib.rs:56:1
   |
56 | mod router;
   | ^^^^^^^^^^^

error[E0603]: module `shell` is private
  --> src/lib.rs:7:14
   |
7  | use perseus::shell::{checkpoint, get_initial_state, get_render_cfg, InitialState};
   |              ^^^^^ private module
   |
note: the module `shell` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.14/src/lib.rs:58:1
   |
58 | mod shell;
   | ^^^^^^^^^^

Some errors have detailed explanations: E0432, E0603.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `perseus-engine` due to 5 previous errors
    Blocking waiting for file lock on package cache
    Updating crates.io index
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
 Downloading crates ...
  Downloaded actix-codec v0.3.0
  Downloaded lru-cache v0.1.2
  Downloaded match_cfg v0.1.0
  Downloaded opaque-debug v0.3.0
  Downloaded linked-hash-map v0.5.4
  Downloaded nom v4.2.3
  Downloaded perseus-actix-web v0.3.0-beta.14
  Downloaded actix-files v0.5.0
  Downloaded actix-connect v2.0.0
  Downloaded actix-macros v0.1.3
  Downloaded actix-utils v2.0.0
  Downloaded actix-tls v2.0.0
  Downloaded actix-threadpool v0.3.3
  Downloaded actix-router v0.2.7
  Downloaded awc v2.0.3
  Downloaded actix-web v3.3.2
  Downloaded bytestring v1.0.0
  Downloaded semver v0.11.0
  Downloaded block-buffer v0.9.0
  Downloaded time v0.2.27
  Downloaded getrandom v0.1.16
  Downloaded pin-project-internal v0.4.28
  Downloaded hostname v0.3.1
  Downloaded cpufeatures v0.2.1
  Downloaded sha-1 v0.9.8
  Downloaded signal-hook-registry v1.4.0
  Downloaded tracing-futures v0.2.5
  Downloaded h2 v0.2.7
  Downloaded trust-dns-resolver v0.19.7
  Downloaded generic-array v0.14.4
  Downloaded enum-as-inner v0.3.3
  Downloaded actix-rt v1.1.1
  Downloaded digest v0.9.0
  Downloaded cookie v0.14.4
  Downloaded bytes v0.5.6
  Downloaded resolv-conf v0.7.0
  Downloaded rand_core v0.5.1
  Downloaded derive_more v0.99.16
  Downloaded tracing-core v0.1.21
  Downloaded v_escape v0.15.0
  Downloaded version_check v0.1.5
  Downloaded typenum v1.14.0
  Downloaded semver-parser v0.10.2
  Downloaded standback v0.2.17
  Downloaded trust-dns-proto v0.19.7
  Downloaded time-macros-impl v0.1.2
  Downloaded tokio-util v0.3.1
  Downloaded socket2 v0.3.19
  Downloaded threadpool v1.8.1
  Downloaded ppv-lite86 v0.2.15
  Downloaded pin-project-internal v1.0.8
  Downloaded pin-project v1.0.8
  Downloaded tokio v0.2.25
  Downloaded v_htmlescape v0.12.0
  Downloaded tracing v0.1.29
  Downloaded v_escape_derive v0.8.5
  Downloaded actix-testing v1.0.1
  Downloaded language-tags v0.2.2
  Downloaded fxhash v0.2.1
  Downloaded serde_urlencoded v0.7.0
  Downloaded rustc_version v0.3.3
  Downloaded time-macros v0.1.1
  Downloaded mio-uds v0.6.8
  Downloaded base64 v0.13.0
  Downloaded actix-web-codegen v0.4.0
  Downloaded rand_chacha v0.2.2
  Downloaded copyless v0.1.5
  Downloaded actix-server v1.0.4
  Downloaded pin-project-lite v0.1.12
  Downloaded convert_case v0.4.0
  Downloaded const_fn v0.4.8
  Downloaded actix-http v2.2.1
  Downloaded pin-project v0.4.28
  Downloaded pest v2.1.3
  Downloaded brotli-sys v0.3.2
  Downloaded ucd-trie v0.1.3
  Downloaded buf-min v0.4.0
  Downloaded brotli2 v0.3.2
  Downloaded actix-service v1.0.6
  Downloaded rand v0.7.3
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on build directory
   Compiling libc v0.2.105
   Compiling futures-core v0.3.17
   Compiling futures-sink v0.3.17
   Compiling futures-channel v0.3.17
   Compiling bytes v0.5.6
   Compiling cfg-if v0.1.10
   Compiling pin-project-lite v0.1.12
   Compiling parking_lot_core v0.8.5
   Compiling pin-project-internal v0.4.28
   Compiling scopeguard v1.1.0
   Compiling getrandom v0.1.16
   Compiling convert_case v0.4.0
   Compiling matches v0.1.9
   Compiling percent-encoding v2.1.0
   Compiling tinyvec_macros v0.1.0
   Compiling bitflags v1.3.2
   Compiling copyless v0.1.5
   Compiling typenum v1.14.0
   Compiling ppv-lite86 v0.2.15
   Compiling either v1.6.1
   Compiling unicode-segmentation v1.8.0
   Compiling unicode-bidi v0.3.7
   Compiling const_fn v0.4.8
   Compiling match_cfg v0.1.0
   Compiling cc v1.0.71
   Compiling quick-error v1.2.3
   Compiling version_check v0.1.5
   Compiling crc32fast v1.2.1
   Compiling linked-hash-map v0.5.4
   Compiling encoding_rs v0.8.29
   Compiling adler v1.0.2
   Compiling httparse v1.5.1
   Compiling regex-syntax v0.6.25
   Compiling mime v0.3.16
   Compiling opaque-debug v0.3.0
   Compiling byteorder v1.4.3
   Compiling cpufeatures v0.2.1
   Compiling language-tags v0.2.2
   Compiling base64 v0.13.0
   Compiling v_escape v0.15.0
   Compiling v_htmlescape v0.12.0
   Compiling instant v0.1.12
   Compiling standback v0.2.17
   Compiling generic-array v0.14.4
   Compiling unicase v2.6.0
   Compiling time v0.2.27
   Compiling cookie v0.14.4
   Compiling futures-util v0.3.17
   Compiling miniz_oxide v0.4.4
   Compiling log v0.4.14
   Compiling tracing-core v0.1.21
   Compiling buf-min v0.4.0
   Compiling lock_api v0.4.5
   Compiling bytestring v1.0.0
   Compiling form_urlencoded v1.0.1
   Compiling tinyvec v1.5.0
   Compiling heck v0.3.3
   Compiling brotli-sys v0.3.2
   Compiling nom v4.2.3
   Compiling lru-cache v0.1.2
   Compiling fxhash v0.2.1
   Compiling unicode-normalization v0.1.19
   Compiling aho-corasick v0.7.18
   Compiling tracing v0.1.29
   Compiling iovec v0.1.4
   Compiling net2 v0.2.37
   Compiling signal-hook-registry v1.4.0
   Compiling num_cpus v1.13.0
   Compiling getrandom v0.2.3
   Compiling hostname v0.3.1
   Compiling time v0.1.43
   Compiling socket2 v0.3.19
   Compiling idna v0.2.3
   Compiling mime_guess v2.0.3
   Compiling flate2 v1.0.22
   Compiling regex v1.5.4
   Compiling mio v0.6.23
   Compiling threadpool v1.8.1
   Compiling parking_lot v0.11.2
   Compiling rand_core v0.5.1
   Compiling ahash v0.7.6
   Compiling resolv-conf v0.7.0
   Compiling url v2.2.2
   Compiling digest v0.9.0
   Compiling block-buffer v0.9.0
   Compiling derive_more v0.99.16
   Compiling actix-macros v0.1.3
   Compiling time-macros-impl v0.1.2
   Compiling pin-project-internal v1.0.8
   Compiling enum-as-inner v0.3.3
   Compiling v_escape_derive v0.8.5
   Compiling actix-web-codegen v0.4.0
   Compiling chrono v0.4.19
   Compiling brotli2 v0.3.2
   Compiling mio-uds v0.6.8
   Compiling rand_chacha v0.2.2
   Compiling sha-1 v0.9.8
   Compiling pin-project v0.4.28
   Compiling time-macros v0.1.1
   Compiling actix-threadpool v0.3.3
   Compiling pin-project v1.0.8
   Compiling tokio v0.2.25
   Compiling rand v0.7.3
   Compiling serde_urlencoded v0.7.0
   Compiling actix-router v0.2.7
   Compiling tracing-futures v0.2.5
   Compiling futures-executor v0.3.17
   Compiling actix-service v1.0.6
   Compiling tokio-util v0.3.1
   Compiling actix-rt v1.1.1
   Compiling futures v0.3.17
   Compiling actix-codec v0.3.0
   Compiling h2 v0.2.7
   Compiling trust-dns-proto v0.19.7
   Compiling actix-utils v2.0.0
   Compiling trust-dns-resolver v0.19.7
   Compiling actix-server v1.0.4
   Compiling actix-tls v2.0.0
   Compiling sycamore-reactive v0.6.3
   Compiling actix-connect v2.0.0
   Compiling actix-testing v1.0.1
   Compiling sycamore v0.6.3
   Compiling actix-http v2.2.1
   Compiling sycamore-router v0.6.3
   Compiling perseus v0.3.0-beta.14
   Compiling awc v2.0.3
   Compiling perseus-example-tiny v0.3.0-beta.14 (/app/tiny)
   Compiling actix-web v3.3.2
   Compiling perseus-engine v0.3.0-beta.13 (/app/tiny/.perseus)
error: could not compile `perseus-engine` due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
    Blocking waiting for file lock on build directory
   Compiling itoa v0.4.8
   Compiling static_assertions v1.1.0
   Compiling cfg-if v1.0.0
   Compiling futures-sink v0.3.17
   Compiling once_cell v1.8.0
   Compiling hashbrown v0.11.2
   Compiling utf8-width v0.1.5
   Compiling pin-utils v0.1.0
   Compiling futures-io v0.3.17
   Compiling pin-project-lite v0.2.7
   Compiling slab v0.4.5
   Compiling smallvec v1.7.0
   Compiling bytes v1.1.0
   Compiling fnv v1.0.7
   Compiling fmterr v0.1.1
   Compiling urlencoding v2.1.0
   Compiling fs_extra v1.2.0
   Compiling lazy_static v1.4.0
   Compiling ryu v1.0.5
   Compiling serde v1.0.130
   Compiling serde_json v1.0.68
   Compiling memchr v2.4.1
   Compiling lexical-util v0.8.1
   Compiling wasm-bindgen v0.2.78
   Compiling futures-core v0.3.17
   Compiling futures-channel v0.3.17
   Compiling proc-macro-nested v0.1.7
   Compiling futures-task v0.3.17
   Compiling libc v0.2.105
   Compiling html-escape v0.2.9
   Compiling http v0.2.5
   Compiling indexmap v1.7.0
   Compiling num-traits v0.2.14
   Compiling futures-util v0.3.17
   Compiling num-integer v0.1.44
   Compiling ahash v0.7.6
   Compiling lexical-write-integer v0.8.0
   Compiling lexical-parse-integer v0.8.0
   Compiling time v0.1.43
   Compiling lexical-write-float v0.8.2
   Compiling lexical-parse-float v0.8.2
   Compiling lexical-core v0.8.2
   Compiling chrono v0.4.19
   Compiling thiserror v1.0.30
   Compiling lexical v6.0.1
   Compiling futures-executor v0.3.17
   Compiling futures v0.3.17
   Compiling js-sys v0.3.55
   Compiling console_error_panic_hook v0.1.7
   Compiling web-sys v0.3.55
   Compiling wasm-bindgen-futures v0.4.28
   Compiling sycamore-reactive v0.6.3
   Compiling sycamore v0.6.3
   Compiling sycamore-router v0.6.3
   Compiling perseus v0.3.0-beta.14
   Compiling perseus-example-tiny v0.3.0-beta.14 (/app/tiny)
   Compiling perseus-engine v0.3.0-beta.13 (/app/tiny/.perseus)
error[E0432]: unresolved imports `perseus::Locales`, `perseus::TemplateMap`
 --> src/app.rs:8:30
  |
8 |     ErrorPages, GenericNode, Locales, TemplateMap,
  |                              ^^^^^^^  ^^^^^^^^^^^ no `TemplateMap` in the root
  |                              |
  |                              no `Locales` in the root
  |
help: a similar name exists in the module
  |
8 |     ErrorPages, GenericNode, locales, TemplateMap,
  |                              ^^^^^^^
help: a similar name exists in the module
  |
8 |     ErrorPages, GenericNode, Locales, Template,
  |                                       ^^^^^^^^

error[E0432]: unresolved imports `perseus::app_shell`, `perseus::detect_locale`, `perseus::ClientTranslationsManager`
 --> src/lib.rs:8:15
  |
8 | use perseus::{app_shell, create_app_route, detect_locale, ClientTranslationsManager, DomNode};
  |               ^^^^^^^^^                    ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |               |                            |              |
  |               |                            |              no `ClientTranslationsManager` in the root
  |               |                            |              help: a similar name exists in the module: `client_translations_manager`
  |               |                            no `detect_locale` in the root
  |               no `app_shell` in the root

error[E0603]: module `error_pages` is private
  --> src/lib.rs:4:14
   |
4  | use perseus::error_pages::ErrorPageData;
   |              ^^^^^^^^^^^ private module
   |
note: the module `error_pages` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.14/src/lib.rs:48:1
   |
48 | mod error_pages;
   | ^^^^^^^^^^^^^^^^

error[E0603]: module `router` is private
  --> src/lib.rs:6:14
   |
6  | use perseus::router::{RouteInfo, RouteVerdict};
   |              ^^^^^^ private module
   |
note: the module `router` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.14/src/lib.rs:56:1
   |
56 | mod router;
   | ^^^^^^^^^^^

error[E0603]: module `shell` is private
  --> src/lib.rs:7:14
   |
7  | use perseus::shell::{checkpoint, get_initial_state, get_render_cfg, InitialState};
   |              ^^^^^ private module
   |
note: the module `shell` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.14/src/lib.rs:58:1
   |
58 | mod shell;
   | ^^^^^^^^^^

Some errors have detailed explanations: E0432, E0603.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `perseus-engine` due to 5 previous errors
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
The command '/bin/sh -c perseus deploy' returned a non-zero code: 1

@arctic-hen7
Copy link
Member

@phaleth could you try testing beta 13 with the code from the v0.3.0-beta.13 tag? That should solve the issues in the third run (beta 14 introduced a number of breaking changes with regards to export structure) and get everything to the same bug. None of this is occurring for me locally or on CI, so I think you're right that it's OS-specific, and I'm thinking it's probably to do with the fs_extra module, which the CLI uses to move some directories around.

@phaleth
Copy link
Contributor Author

phaleth commented Oct 31, 2021

The tiny example didn't change with the release of 0.3.0-beta.14, but bellow is a new Dockerfile for 0.3.0-beta.13 and the build output anyway. I've only really changed the step 7 with the curl call to download the tiny example code from github.

It's odd that perseus deploy mentions perseus-0.3.0-beta.15 in some of the traces, but I'd not be too worried that an older beta can't be deployed.

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 \
  build-essential curl

# vars
ENV PERSEUS_VERSION=0.3.0-beta.13 \
    WEE_ALLOC_VERSION=0.4

# 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/v0.3.0-beta.13 | tar -xz --strip=2 perseus-0.3.0-beta.13/examples/tiny

# go to src dir
WORKDIR /app/tiny

# install perseus-cli
RUN cargo install perseus-cli --version $PERSEUS_VERSION

# clean app
RUN perseus clean

# specify deps in app config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
  && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml \
  && cat ./Cargo.toml

# modify and prepend lib.rs
RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs \
  && 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 = \"${PERSEUS_VERSION}\"/" .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/tiny/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Docker build output

...
Step 7/21 : RUN curl https://codeload.github.com/arctic-hen7/perseus/tar.gz/v0.3.0-beta.13 | tar -xz --strip=2 perseus-0.3.0-beta.13/examples/tiny
 ---> Running in 995011b27a70
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  328k  100  328k    0     0  1046k      0 --:--:-- --:--:-- --:--:-- 1043k
Removing intermediate container 995011b27a70
 ---> 1a92dc4b61b8
Step 8/21 : WORKDIR /app/tiny
 ---> Running in 25ba93ae6088
Removing intermediate container 25ba93ae6088
 ---> 8354b2d88d1a
Step 9/21 : RUN cargo install perseus-cli --version $PERSEUS_VERSION
 ---> Running in e0daf51424af
 Downloading crates ...
  Downloaded perseus-cli v0.3.0-beta.13
    Updating crates.io index
  Installing perseus-cli v0.3.0-beta.13
 Downloading crates ...
  Downloaded strsim v0.10.0
  Downloaded textwrap v0.14.2
  Downloaded glob v0.3.0
  Downloaded proc-macro-hack v0.5.19
  Downloaded cargo_toml v0.9.2
  Downloaded number_prefix v0.4.0
  Downloaded anyhow v1.0.44
  Downloaded indicatif v0.17.0-beta.1
  Downloaded os_str_bytes v4.2.0
  Downloaded clap_derive v3.0.0-beta.5
  Downloaded fmterr v0.1.1
  Downloaded include_dir_impl v0.6.2
  Downloaded console v0.14.1
  Downloaded fs_extra v1.2.0
  Downloaded include_dir v0.6.2
  Downloaded clap v3.0.0-beta.5
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling version_check v0.9.3
   Compiling libc v0.2.106
   Compiling serde v1.0.130
   Compiling anyhow v1.0.44
   Compiling memchr v2.4.1
   Compiling proc-macro-hack v0.5.19
   Compiling autocfg v1.0.1
   Compiling serde_derive v1.0.130
   Compiling unicode-segmentation v1.8.0
   Compiling lazy_static v1.4.0
   Compiling ryu v1.0.5
   Compiling unicode-width v0.1.9
   Compiling regex-syntax v0.6.25
   Compiling once_cell v1.8.0
   Compiling hashbrown v0.11.2
   Compiling serde_json v1.0.68
   Compiling itoa v0.4.8
   Compiling bitflags v1.3.2
   Compiling glob v0.3.0
   Compiling strsim v0.10.0
   Compiling termcolor v1.1.2
   Compiling number_prefix v0.4.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 textwrap v0.14.2
   Compiling indexmap v1.7.0
   Compiling heck v0.3.3
   Compiling regex v1.5.4
   Compiling os_str_bytes v4.2.0
   Compiling quote v1.0.10
   Compiling terminal_size v0.1.17
   Compiling atty v0.2.14
   Compiling console v0.15.0
   Compiling console v0.14.1
   Compiling indicatif v0.17.0-beta.1
   Compiling toml v0.5.8
   Compiling clap_derive v3.0.0-beta.5
   Compiling thiserror-impl v1.0.30
   Compiling include_dir_impl v0.6.2
   Compiling include_dir v0.6.2
   Compiling thiserror v1.0.30
   Compiling clap v3.0.0-beta.5
   Compiling cargo_toml v0.9.2
   Compiling perseus-cli v0.3.0-beta.13
    Finished release [optimized] target(s) in 1m 03s
  Installing /usr/local/cargo/bin/perseus
   Installed package `perseus-cli v0.3.0-beta.13` (executable `perseus`)
Removing intermediate container e0daf51424af
 ---> ac652d5756a8
Step 10/21 : RUN perseus clean
 ---> Running in 3e05bdec3506
Removing intermediate container 3e05bdec3506
 ---> 9bd8826d0836
Step 11/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml   && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml   && cat ./Cargo.toml
 ---> Running in 22600fb538fd
[package]
name = "perseus-example-tiny"
version = "0.3.0-beta.13"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
wee_alloc = "0.4"
perseus = "0.3.0-beta.13"
sycamore = "0.6"
Removing intermediate container 22600fb538fd
 ---> b5d507c6d708
Step 12/21 : RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && echo '#[global_allocator] \nstatic 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
 ---> Running in 0b5dd15ab15a
#[global_allocator] 
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; 

use perseus::{define_app, ErrorPages, Template};
use sycamore::template;
define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    })
}
Removing intermediate container 0b5dd15ab15a
 ---> 95e6c5461fb5
Step 13/21 : RUN perseus prep && perseus eject
 ---> Running in b15866543bbc
Removing intermediate container b15866543bbc
 ---> 6256e5f2d0e8
Step 14/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml   && echo ' \n\n[profile.release] \ncodegen-units = 1 \nopt-level = "s" ' >> .perseus/Cargo.toml   && cat .perseus/Cargo.toml
 ---> Running in fbc3dc78c581
# This crate defines the user's app in terms that Wasm can understand, making development significantly simpler.
# IMPORTANT: spacing matters in this file for runtime replacements, do NOT change it!

[package]
name = "perseus-engine"
version = "0.3.0-beta.13"
edition = "2018"
default-run = "perseus-builder"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# We alias here because the package name will change based on whatever's in the user's manifest
app = { package = "perseus-example-tiny", path = "../" }

perseus = "0.3.0-beta.13"
sycamore = { version = "0.6", features = ["ssr"] }
sycamore-router = "0.6"
web-sys = { version = "0.3", features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"] }
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1" # Possibly don't need?
console_error_panic_hook = "0.1.6"
urlencoding = "2.1"
futures = "0.3"
fs_extra = "1"
lazy_static = "1"

# This section is needed for Wasm Pack (which we use instead of Trunk for flexibility)
[lib]
crate-type = ["cdylib", "rlib"]

# We define a binary for building, serving, and doing both
[[bin]]
name = "perseus-builder"
path = "src/bin/build.rs"

[[bin]]
name = "perseus-exporter"
path = "src/bin/export.rs"

[[bin]]
name = "perseus-tinker" # Yes, the noun is 'tinker', not 'tinkerer'
path = "src/bin/tinker.rs"

[workspace]
members = [ "server" ] 

[profile.release] 
codegen-units = 1 
opt-level = "s" 
Removing intermediate container fbc3dc78c581
 ---> cf4f5b9d200d
Step 15/21 : RUN perseus deploy
 ---> Running in ae4a39f9fde8
    Blocking waiting for file lock on package cache
    Updating crates.io index
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling autocfg v1.0.1
   Compiling ryu v1.0.5
   Compiling serde v1.0.130
   Compiling serde_derive v1.0.130
   Compiling serde_json v1.0.68
   Compiling log v0.4.14
   Compiling wasm-bindgen-shared v0.2.78
   Compiling cfg-if v1.0.0
   Compiling bumpalo v3.8.0
   Compiling lazy_static v1.4.0
   Compiling libc v0.2.106
   Compiling version_check v0.9.3
   Compiling itoa v0.4.8
   Compiling memchr v2.4.1
   Compiling static_assertions v1.1.0
   Compiling wasm-bindgen v0.2.78
   Compiling proc-macro-hack v0.5.19
   Compiling futures-core v0.3.17
   Compiling futures-channel v0.3.17
   Compiling proc-macro-nested v0.1.7
   Compiling futures-task v0.3.17
   Compiling ident_case v1.0.1
   Compiling hashbrown v0.11.2
   Compiling strsim v0.10.0
   Compiling once_cell v1.8.0
   Compiling fnv v1.0.7
   Compiling futures-sink v0.3.17
   Compiling slab v0.4.5
   Compiling futures-io v0.3.17
   Compiling minimal-lexical v0.1.4
   Compiling utf8-width v0.1.5
   Compiling pin-utils v0.1.0
   Compiling smallvec v1.7.0
   Compiling pin-project-lite v0.2.7
   Compiling async-trait v0.1.51
   Compiling bytes v1.1.0
   Compiling wee_alloc v0.4.5
   Compiling urlencoding v2.1.0
   Compiling fmterr v0.1.1
   Compiling memory_units v0.4.0
   Compiling cfg-if v0.1.10
   Compiling fs_extra v1.2.0
   Compiling indexmap v1.7.0
   Compiling futures-macro v0.3.17
   Compiling futures-util v0.3.17
   Compiling num-traits v0.2.14
   Compiling num-integer v0.1.44
   Compiling lexical-util v0.8.1
   Compiling ahash v0.7.6
   Compiling nom v7.0.0
   Compiling html-escape v0.2.9
   Compiling http v0.2.5
   Compiling lexical-parse-integer v0.8.0
   Compiling lexical-write-integer v0.8.0
   Compiling quote v1.0.10
   Compiling lexical-parse-float v0.8.2
   Compiling lexical-write-float v0.8.2
   Compiling getrandom v0.2.3
   Compiling time v0.1.43
   Compiling lexical-core v0.8.2
   Compiling lexical v6.0.1
   Compiling chrono v0.4.19
   Compiling wasm-bindgen-backend v0.2.78
   Compiling darling_core v0.13.0
   Compiling wasm-bindgen-macro-support v0.2.78
   Compiling sycamore-macro v0.6.3
   Compiling sycamore-router-macro v0.6.3
   Compiling thiserror-impl v1.0.30
   Compiling wasm-bindgen-macro v0.2.78
   Compiling darling_macro v0.13.0
   Compiling thiserror v1.0.30
   Compiling darling v0.13.0
   Compiling futures-executor v0.3.17
   Compiling futures v0.3.17
   Compiling perseus-macro v0.3.0-beta.15
   Compiling js-sys v0.3.55
   Compiling console_error_panic_hook v0.1.7
   Compiling web-sys v0.3.55
   Compiling wasm-bindgen-futures v0.4.28
   Compiling sycamore-reactive v0.6.3
   Compiling sycamore v0.6.3
   Compiling sycamore-router v0.6.3
   Compiling perseus v0.3.0-beta.15
   Compiling perseus-example-tiny v0.3.0-beta.13 (/app/tiny)
   Compiling perseus-engine v0.3.0-beta.13 (/app/tiny/.perseus)
error[E0432]: unresolved imports `perseus::Locales`, `perseus::TemplateMap`
 --> src/app.rs:8:30
  |
8 |     ErrorPages, GenericNode, Locales, TemplateMap,
  |                              ^^^^^^^  ^^^^^^^^^^^ no `TemplateMap` in the root
  |                              |
  |                              no `Locales` in the root
  |
help: a similar name exists in the module
  |
8 |     ErrorPages, GenericNode, locales, TemplateMap,
  |                              ^^^^^^^
help: a similar name exists in the module
  |
8 |     ErrorPages, GenericNode, Locales, Template,
  |                                       ^^^^^^^^

error[E0432]: unresolved imports `perseus::app_shell`, `perseus::detect_locale`, `perseus::ClientTranslationsManager`
 --> src/lib.rs:8:15
  |
8 | use perseus::{app_shell, create_app_route, detect_locale, ClientTranslationsManager, DomNode};
  |               ^^^^^^^^^                    ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |               |                            |              |
  |               |                            |              no `ClientTranslationsManager` in the root
  |               |                            |              help: a similar name exists in the module: `client_translations_manager`
  |               |                            no `detect_locale` in the root
  |               no `app_shell` in the root

error[E0603]: module `error_pages` is private
  --> src/lib.rs:4:14
   |
4  | use perseus::error_pages::ErrorPageData;
   |              ^^^^^^^^^^^ private module
   |
note: the module `error_pages` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.15/src/lib.rs:48:1
   |
48 | mod error_pages;
   | ^^^^^^^^^^^^^^^^

error[E0603]: module `router` is private
  --> src/lib.rs:6:14
   |
6  | use perseus::router::{RouteInfo, RouteVerdict};
   |              ^^^^^^ private module
   |
note: the module `router` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.15/src/lib.rs:56:1
   |
56 | mod router;
   | ^^^^^^^^^^^

error[E0603]: module `shell` is private
  --> src/lib.rs:7:14
   |
7  | use perseus::shell::{checkpoint, get_initial_state, get_render_cfg, InitialState};
   |              ^^^^^ private module
   |
note: the module `shell` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.15/src/lib.rs:58:1
   |
58 | mod shell;
   | ^^^^^^^^^^

Some errors have detailed explanations: E0432, E0603.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `perseus-engine` due to 5 previous errors
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
    Blocking waiting for file lock on build directory
   Compiling itoa v0.4.8
   Compiling static_assertions v1.1.0
   Compiling cfg-if v1.0.0
   Compiling hashbrown v0.11.2
   Compiling futures-sink v0.3.17
   Compiling once_cell v1.8.0
   Compiling pin-project-lite v0.2.7
   Compiling pin-utils v0.1.0
   Compiling utf8-width v0.1.5
   Compiling futures-io v0.3.17
   Compiling slab v0.4.5
   Compiling smallvec v1.7.0
   Compiling bytes v1.1.0
   Compiling fnv v1.0.7
   Compiling urlencoding v2.1.0
   Compiling fmterr v0.1.1
   Compiling memory_units v0.4.0
   Compiling cfg-if v0.1.10
   Compiling lazy_static v1.4.0
   Compiling fs_extra v1.2.0
   Compiling ryu v1.0.5
   Compiling serde v1.0.130
   Compiling serde_json v1.0.68
   Compiling memchr v2.4.1
   Compiling wasm-bindgen v0.2.78
   Compiling futures-core v0.3.17
   Compiling futures-channel v0.3.17
   Compiling futures-task v0.3.17
   Compiling proc-macro-nested v0.1.7
   Compiling libc v0.2.106
   Compiling lexical-util v0.8.1
   Compiling wee_alloc v0.4.5
   Compiling html-escape v0.2.9
   Compiling indexmap v1.7.0
   Compiling num-traits v0.2.14
   Compiling futures-util v0.3.17
   Compiling num-integer v0.1.44
   Compiling ahash v0.7.6
   Compiling http v0.2.5
   Compiling lexical-write-integer v0.8.0
   Compiling lexical-parse-integer v0.8.0
   Compiling time v0.1.43
   Compiling thiserror v1.0.30
   Compiling lexical-write-float v0.8.2
   Compiling lexical-parse-float v0.8.2
   Compiling lexical-core v0.8.2
   Compiling chrono v0.4.19
   Compiling lexical v6.0.1
   Compiling futures-executor v0.3.17
   Compiling futures v0.3.17
   Compiling js-sys v0.3.55
   Compiling console_error_panic_hook v0.1.7
   Compiling web-sys v0.3.55
   Compiling wasm-bindgen-futures v0.4.28
   Compiling sycamore-reactive v0.6.3
   Compiling sycamore v0.6.3
   Compiling sycamore-router v0.6.3
   Compiling perseus v0.3.0-beta.15
   Compiling perseus-example-tiny v0.3.0-beta.13 (/app/tiny)
   Compiling perseus-engine v0.3.0-beta.13 (/app/tiny/.perseus)
error[E0432]: unresolved imports `perseus::Locales`, `perseus::TemplateMap`
 --> src/app.rs:8:30
  |
8 |     ErrorPages, GenericNode, Locales, TemplateMap,
  |                              ^^^^^^^  ^^^^^^^^^^^ no `TemplateMap` in the root
  |                              |
  |                              no `Locales` in the root
  |
help: a similar name exists in the module
  |
8 |     ErrorPages, GenericNode, locales, TemplateMap,
  |                              ^^^^^^^
help: a similar name exists in the module
  |
8 |     ErrorPages, GenericNode, Locales, Template,
  |                                       ^^^^^^^^

error[E0432]: unresolved imports `perseus::app_shell`, `perseus::detect_locale`, `perseus::ClientTranslationsManager`
 --> src/lib.rs:8:15
  |
8 | use perseus::{app_shell, create_app_route, detect_locale, ClientTranslationsManager, DomNode};
  |               ^^^^^^^^^                    ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^
  |               |                            |              |
  |               |                            |              no `ClientTranslationsManager` in the root
  |               |                            |              help: a similar name exists in the module: `client_translations_manager`
  |               |                            no `detect_locale` in the root
  |               no `app_shell` in the root

error[E0603]: module `error_pages` is private
  --> src/lib.rs:4:14
   |
4  | use perseus::error_pages::ErrorPageData;
   |              ^^^^^^^^^^^ private module
   |
note: the module `error_pages` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.15/src/lib.rs:48:1
   |
48 | mod error_pages;
   | ^^^^^^^^^^^^^^^^

error[E0603]: module `router` is private
  --> src/lib.rs:6:14
   |
6  | use perseus::router::{RouteInfo, RouteVerdict};
   |              ^^^^^^ private module
   |
note: the module `router` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.15/src/lib.rs:56:1
   |
56 | mod router;
   | ^^^^^^^^^^^

error[E0603]: module `shell` is private
  --> src/lib.rs:7:14
   |
7  | use perseus::shell::{checkpoint, get_initial_state, get_render_cfg, InitialState};
   |              ^^^^^ private module
   |
note: the module `shell` is defined here
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/perseus-0.3.0-beta.15/src/lib.rs:58:1
   |
58 | mod shell;
   | ^^^^^^^^^^

Some errors have detailed explanations: E0432, E0603.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `perseus-engine` due to 5 previous errors
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
The command '/bin/sh -c perseus deploy' returned a non-zero code: 1

@arctic-hen7
Copy link
Member

There were changes to the engine and the define_app! macro, so that's probably causing the older beta problem.

@phaleth
Copy link
Contributor Author

phaleth commented Nov 6, 2021

The error has changed a bit. Instead of Invalid cross-device link (os error 18) it now says No such file or directory (os error 2). Tested with 0.3.0-beta.16.

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 \
  build-essential curl

# vars
ENV PERSEUS_VERSION=0.3.0-beta.16 \
    WEE_ALLOC_VERSION=0.4

# 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/v${PERSEUS_VERSION} | tar -xz --strip=2 perseus-${PERSEUS_VERSION}/examples/tiny

# go to src dir
WORKDIR /app/tiny

# install perseus-cli
RUN cargo install perseus-cli --version $PERSEUS_VERSION

# clean app
RUN perseus clean

# specify deps in app config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
  && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml \
  && cat ./Cargo.toml

# modify and prepend lib.rs
RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs \
  && 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 = \"${PERSEUS_VERSION}\"/" .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/tiny/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Docker build output

...
Step 7/21 : RUN curl https://codeload.github.com/arctic-hen7/perseus/tar.gz/v${PERSEUS_VERSION} | tar -xz --strip=2 perseus-${PERSEUS_VERSION}/examples/tiny
 ---> Running in ee558711a0ad
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  338k    0  338k    0     0   929k      0 --:--:-- --:--:-- --:--:--  927k
Removing intermediate container ee558711a0ad
 ---> 612f4bca26e0
Step 8/21 : WORKDIR /app/tiny
 ---> Running in 7397c96c1ee1
Removing intermediate container 7397c96c1ee1
 ---> c83c94edf373
Step 9/21 : RUN cargo install perseus-cli --version $PERSEUS_VERSION
 ---> Running in 4ccd22216adf
 Downloading crates ...
  Downloaded perseus-cli v0.3.0-beta.16
    Updating crates.io index
  Installing perseus-cli v0.3.0-beta.16
 Downloading crates ...
  Downloaded indicatif v0.17.0-beta.1
  Downloaded number_prefix v0.4.0
  Downloaded proc-macro-hack v0.5.19
  Downloaded os_str_bytes v4.2.0
  Downloaded clap v3.0.0-beta.5
  Downloaded fmterr v0.1.1
  Downloaded console v0.14.1
  Downloaded cargo_toml v0.9.2
  Downloaded textwrap v0.14.2
  Downloaded include_dir v0.6.2
  Downloaded anyhow v1.0.45
  Downloaded strsim v0.10.0
  Downloaded include_dir_impl v0.6.2
  Downloaded glob v0.3.0
  Downloaded clap_derive v3.0.0-beta.5
  Downloaded fs_extra v1.2.0
   Compiling proc-macro2 v1.0.32
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.81
   Compiling version_check v0.9.3
   Compiling libc v0.2.106
   Compiling serde v1.0.130
   Compiling anyhow v1.0.45
   Compiling memchr v2.4.1
   Compiling autocfg v1.0.1
   Compiling proc-macro-hack v0.5.19
   Compiling unicode-width v0.1.9
   Compiling ryu v1.0.5
   Compiling unicode-segmentation v1.8.0
   Compiling lazy_static v1.4.0
   Compiling regex-syntax v0.6.25
   Compiling serde_derive v1.0.130
   Compiling hashbrown v0.11.2
   Compiling serde_json v1.0.69
   Compiling once_cell v1.8.0
   Compiling termcolor v1.1.2
   Compiling number_prefix v0.4.0
   Compiling itoa v0.4.8
   Compiling strsim v0.10.0
   Compiling bitflags v1.3.2
   Compiling glob v0.3.0
   Compiling fmterr v0.1.1
   Compiling fs_extra v1.2.0
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling unicase v2.6.0
   Compiling textwrap v0.14.2
   Compiling indexmap v1.7.0
   Compiling heck v0.3.3
   Compiling regex v1.5.4
   Compiling os_str_bytes v4.2.0
   Compiling quote v1.0.10
   Compiling terminal_size v0.1.17
   Compiling atty v0.2.14
   Compiling console v0.15.0
   Compiling console v0.14.1
   Compiling indicatif v0.17.0-beta.1
   Compiling toml v0.5.8
   Compiling include_dir_impl v0.6.2
   Compiling clap_derive v3.0.0-beta.5
   Compiling thiserror-impl v1.0.30
   Compiling include_dir v0.6.2
   Compiling thiserror v1.0.30
   Compiling clap v3.0.0-beta.5
   Compiling cargo_toml v0.9.2
   Compiling perseus-cli v0.3.0-beta.16
    Finished release [optimized] target(s) in 1m 02s
  Installing /usr/local/cargo/bin/perseus
   Installed package `perseus-cli v0.3.0-beta.16` (executable `perseus`)
Removing intermediate container 4ccd22216adf
 ---> e7fac4648ec7
Step 10/21 : RUN perseus clean
 ---> Running in c22f9cba4853
Removing intermediate container c22f9cba4853
 ---> e790258c98d4
Step 11/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml   && sed -i "/\[dependencies\]/a wee_alloc = \"${WEE_ALLOC_VERSION}\"" ./Cargo.toml   && cat ./Cargo.toml
 ---> Running in 6b33973105ee
[package]
name = "perseus-example-tiny"
version = "0.3.0-beta.16"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
wee_alloc = "0.4"
perseus = "0.3.0-beta.16"
sycamore = "0.6"
Removing intermediate container 6b33973105ee
 ---> 17e0a58e788d
Step 12/21 : RUN sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs   && echo '#[global_allocator] \nstatic 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
 ---> Running in 529b2ffaf7c9
#[global_allocator] 
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; 

use perseus::{define_app, ErrorPages, Template};
use sycamore::template;
define_app! {
    templates: [
        Template::<G>::new("index").template(|_| {
            template! {
                p { "世界您好 !" }
            }
        })
    ],
    error_pages: ErrorPages::new(|url, status, err, _| {
        template! {
            p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) }
        }
    })
}
Removing intermediate container 529b2ffaf7c9
 ---> 744577a660be
Step 13/21 : RUN perseus prep && perseus eject
 ---> Running in 01438a80d5a5
Removing intermediate container 01438a80d5a5
 ---> 15f2ed151e09
Step 14/21 : RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml   && echo ' \n\n[profile.release] \ncodegen-units = 1 \nopt-level = "s" ' >> .perseus/Cargo.toml   && cat .perseus/Cargo.toml
 ---> Running in 38f80be4fbe8
# This crate defines the user's app in terms that Wasm can understand, making development significantly simpler.
# IMPORTANT: spacing matters in this file for runtime replacements, do NOT change it!

[package]
name = "perseus-engine"
version = "0.3.0-beta.16"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# We alias here because the package name will change based on whatever's in the user's manifest
app = { package = "perseus-example-tiny", path = "../" }

perseus = "0.3.0-beta.16"
sycamore = { version = "0.6", features = ["ssr"] }
sycamore-router = "0.6"
web-sys = { version = "0.3", features = ["Event", "Headers", "Request", "RequestInit", "RequestMode", "Response", "ReadableStream", "Window"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
console_error_panic_hook = "0.1.6"

# This section is needed for Wasm Pack (which we use instead of Trunk for flexibility)
[lib]
crate-type = ["cdylib", "rlib"]

[workspace] 

[profile.release] 
codegen-units = 1 
opt-level = "s" 
Removing intermediate container 38f80be4fbe8
 ---> 04d041f58bdb
Step 15/21 : RUN perseus deploy
 ---> Running in 203d6d23e888
Error: couldn't remove and replace internal build artifact directory 'Some("/app/tiny/.perseus/dist/static")' (run `perseus clean` if this persists)

Caused by:
	No such file or directory (os error 2)
The command '/bin/sh -c perseus deploy' returned a non-zero code: 1

@arctic-hen7
Copy link
Member

Okay, I can replicate this in Docker. I'm trying now without Docker to see if I can diagnose this further...

arctic-hen7 added a commit that referenced this issue Nov 6, 2021
@arctic-hen7
Copy link
Member

This actually looks like a Docker problem, because I can get everything to work perfectly outside it. The error we're getting in Docker is caused by the delete_artifacts() call inside the CLI failing (which happens practically immediately after you run perseus deploy, nothing is actually being built). There are only two ways that can happen: if it failed to delete the .perseus/static directory, or if it failed to recreate the .perseus/static directory. The former shouldn't be possible (at least not with an error that there was no such file or directory) because it will only delete the directory if it actually exists. So, assuming that's true, the error stems from not being able to create the directory, and the source error implies that one of the parent directories doesn't exist. The most likely one is that we're trying to create .perseus/static, but .perseus/ doesn't exist. Funny thing is, it gets created directly before that, so this is extremely odd.

I think my next step in trying to fix this will be to replace the create_dir() call with create_dir_all(), which also creates any missing parent directories. I'm not sure yet exactly why the problem is occurring, but, if my reasoning above is correct, that should solve it. I've just published a new branch for this called fix-69, so we can get everything for that from https://codeload.github.com now, but I'll need to compile the binary from the repo directly and then inline that into the Docker build. I'll do that tomorrow.

@phaleth
Copy link
Contributor Author

phaleth commented Nov 6, 2021

Hmm, thanks for looking into that. I guess the .perseus/ dir exists cause of the perseus prep call happening upfront. Bellow I added command to list files in the .perseus/ dir right before perseus deploy. There is no .perseus/static/ or the .perseus/dist/ which the error mentions. So, I guess your conclusion is correct and the dist is the parent dir that needs to be created.

I'm really glad this is not a debian host related issue.

...
Step 15/22 : RUN ls -la .perseus/
 ---> Running in 77b687db663f
total 36
drwxr-xr-x 1 root root 4096 Nov  6 06:43 .
drwxrwxr-x 1 root root 4096 Nov  6 06:43 ..
-rw-r--r-- 1 root root   67 Nov  6 06:43 .ejected
-rw-r--r-- 1 root root   14 Nov  6 06:43 .gitignore
-rw-r--r-- 1 root root 1071 Nov  6 06:43 Cargo.toml
-rw-r--r-- 1 root root 1025 Nov  6 06:43 Cargo.toml.old
drwxr-xr-x 3 root root 4096 Nov  6 06:43 builder
drwxr-xr-x 3 root root 4096 Nov  6 06:43 server
drwxr-xr-x 2 root root 4096 Nov  6 06:43 src
Removing intermediate container 77b687db663f
 ---> fa805f1425f8
Step 16/22 : RUN perseus deploy
 ---> Running in 539569802f2d
Error: couldn't remove and replace internal build artifact directory 'Some("/app/tiny/.perseus/dist/static")' (run `perseus clean` if this persists)

Caused by:
	No such file or directory (os error 2)

@arctic-hen7
Copy link
Member

Okay! It took me a few segmentation faults and version incompatibilities, but I have this working with a minimal Dockerfile based on the fix-69 branch. I've temporarily added the .perseus/ directory into GitHub so that I could install it into Docker with cargo (which avoids libc version incompatibilities), and it appears that my fix works! Here's the Dockerfile for now, though note that this will stop working once I remove the temporary build artifacts from the repo.

FROM rust:1.55-slim AS build
RUN apt update \
  && apt install -y --no-install-recommends lsb-release apt-transport-https \
  build-essential curl
ENV PERSEUS_VERSION=fix-69
ENV PERSEUS_URL=https://github.com/arctic-hen7/perseus
WORKDIR /app
RUN rustup target add wasm32-unknown-unknown
RUN cargo install wasm-pack
RUN curl https://codeload.github.com/arctic-hen7/perseus/tar.gz/${PERSEUS_VERSION} | tar -xz --strip=2 perseus-${PERSEUS_VERSION}/examples/tiny
WORKDIR /app/tiny
RUN cargo install perseus-cli --git https://github.com/arctic-hen7/perseus --branch fix-69
RUN sed -i s"/perseus = .*/perseus = { git = \"https:\/\/github.com\/arctic-hen7\/perseus\", branch = \"fix-69\" }/" ./Cargo.toml
RUN perseus prep
RUN sed -i s"/perseus = .*/perseus = { git = \"https:\/\/github.com\/arctic-hen7\/perseus\", branch = \"fix-69\" }/" ./.perseus/Cargo.toml
RUN sed -i s"/{ version = \".*16\"/{ git = \"https:\/\/github.com\/arctic-hen7\/perseus\", branch = \"fix-69\"/" ./.perseus/server/Cargo.toml
RUN sed -i s"/perseus-actix-web = .*/perseus-actix-web = { git = \"https:\/\/github.com\/arctic-hen7\/perseus\", branch = \"fix-69\" }/" ./.perseus/server/Cargo.toml
RUN sed -i s"/{ version = \".*16\"/{ git = \"https:\/\/github.com\/arctic-hen7\/perseus\", branch = \"fix-69\"/" ./.perseus/builder/Cargo.toml
RUN perseus deploy

FROM bitnami/minideb:buster
WORKDIR /app
COPY --from=build /app/tiny/pkg /app/
ENV PERSEUS_STANDALONE=true
ENV HOST=0.0.0.0
CMD ["./server"]

I'll release beta 17 with this fix imminently.

@arctic-hen7
Copy link
Member

arctic-hen7 commented Nov 7, 2021

Okay, I've released beta 17, and this Dockerfile now works perfectly (no more insane version replacements needed!):

FROM rust:1.55-slim AS build
RUN apt update \
  && apt install -y --no-install-recommends lsb-release apt-transport-https \
  build-essential curl
ENV PERSEUS_VERSION=0.3.0-beta.17
WORKDIR /app
RUN rustup target add wasm32-unknown-unknown
RUN cargo install wasm-pack
RUN curl https://codeload.github.com/arctic-hen7/perseus/tar.gz/v${PERSEUS_VERSION} | tar -xz --strip=2 perseus-${PERSEUS_VERSION}/examples/tiny
WORKDIR /app/tiny
RUN cargo install perseus-cli --version ${PERSEUS_VERSION}
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml
RUN perseus deploy

FROM bitnami/minideb:buster
WORKDIR /app
COPY --from=build /app/tiny/pkg /app/
ENV PERSEUS_STANDALONE=true
ENV HOST=0.0.0.0
CMD ["./server"]

@phaleth, now that I've eliminated that error, could you please confirm that the original error about cross-device links isn't coming back for you (I can't replicate that on my local system or in Docker)?

@phaleth
Copy link
Contributor Author

phaleth commented Nov 7, 2021

The Invalid cross-device link (os error 18) error is no longer an issue since 0.3.0-beta.16.

WIth 0.3.0-beta.17 release you have managed to fix the other No such file or directory (os error 2) error and now I'm able to deploy with docker successfully. Thank you for trying the docker deployment yourself and fixing the error.

Now, all I did was to bump up the PERSEUS_VERSION in the Dockerfile I last posted above and the perseus deploy step performed successfully. Problems aren't all gone yet as I've only managed to deploy Perseus locally and not on the VM due to low memory. I might open a new issue on that one.

Thanks for explaining a bit more about how to deploy specific branch above.

Most importantly, what I wanna mention here, now that I've deployed the tiny is that the server side bundle isn't affected by size optimizations anymore, which is remarkable. The server side bundle sits at 11 MB and overall the tiny example loads noticeably faster in the web browser as shown on images bellow.

user@debian:~$ docker exec -it perseus-tiny ls -lha
total 11M
drwxr-xr-x 1 root root 4.0K Nov  7 08:14 .
drwxr-xr-x 1 root root 4.0K Nov  7 08:35 ..
drwxr-xr-x 5 root root 4.0K Nov  7 08:14 dist
-rw-rw-r-- 1 root root  279 Nov  7 08:14 index.html
-rwxr-xr-x 1 root root  11M Nov  7 08:14 server

Prior optimized tiny example deployment with 0.3.0-beta.8
image

Current optimized tiny example deployment with 0.3.0-beta.17
image

@phaleth
Copy link
Contributor Author

phaleth commented Nov 7, 2021

@arctic-hen7, setting up the PERSEUS_CLI_SEQUENTIAL env var that you mentioned in one of the previous issues helps avoiding the out of memory issue on the perseus deploy call.

Bellow is a Dockerfile that uses the perseus-size-opt plugin, also the server dir listing and the screenshot of the publicly deployed simple example.

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 \
  build-essential curl

# vars
ENV PERSEUS_VERSION=0.3.0-beta.17 \
    PERSEUS_SIZE_OPT_VERSION=0.1.2

# 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-size-opt/tar.gz/main | tar -xz --strip=2 perseus-size-opt-main/examples/simple

# go to src dir
WORKDIR /app/simple

# install perseus-cli
RUN cargo install perseus-cli --version $PERSEUS_VERSION

# clean and prep app
RUN perseus clean && perseus prep

# specify deps in app config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
  && sed -i s"/perseus-size-opt = .*/perseus-size-opt = \"${PERSEUS_SIZE_OPT_VERSION}\"/" ./Cargo.toml \
  && cat ./Cargo.toml

# modify lib.rs
RUN sed -i s'/SizeOpts::default()/SizeOpts { wee_alloc: true, lto: false, opt_level: "s".to_string(), codegen_units: 1, }/' ./src/lib.rs \
  && sed -i s'/"Hello World!"/"世界您好 !"/' ./src/lib.rs \
  && cat ./src/lib.rs

# run plugin(s) to adjust app
RUN perseus tinker \
  && cat .perseus/Cargo.toml \
  && cat ./src/lib.rs

# single-threaded perseus CLI mode
ENV PERSEUS_CLI_SEQUENTIAL=true

# deploy app
RUN perseus deploy

# prepare deployment image
FROM bitnami/minideb:buster

WORKDIR /app

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

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]
user@debian-cpx11:~/perseus_example$ docker exec -it perseus_example_perseus_1 ls -lha
total 12M
drwxr-xr-x 1 root root 4.0K Nov  7 10:25 .
drwxr-xr-x 1 root root 4.0K Nov  7 10:25 ..
drwxr-xr-x 5 root root 4.0K Nov  7 10:25 dist
-rw-rw-r-- 1 root root  281 Nov  7 10:25 index.html
-rwxr-xr-x 1 root root  12M Nov  7 10:25 server

fdsgfddfdg

@arctic-hen7
Copy link
Member

Fantastic! Yeah, the optimisations I've introduced over the last few beta versions have separated the client and server bundles completely, so optimisations for the two are now independent. I also eliminated some server side code leakage from the client bundle, so I'm glad that's all working now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants