saschagrunert / webapp.rs

A web application completely written in Rust. ๐ŸŒ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clarify build environment

rich-murphey opened this issue ยท comments

I thought it might be helpful for newcomers, for some of the packages required for building or installing this project to be enumerated.

Note that this is on Debian, which doesn't seem to have podman in the repos, so I substituted docker.

Also, in the Makefile, $(PWD) did not seem to work, so I substituted $(shell pwd).

Here are steps that build and deploy the project on current Debian.

install docker on Debian

sudo apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

install rust

wget https://sh.rustup.rs -O rustup-init
sudo sh rustup-init -y

install cargo-web

sudo apt-get install -y pkg-config libssl-dev
sudo cargo install cargo-web

build the project

cd /opt
git clone https://github.com/saschagrunert/webapp.rs.git
cd webapp.rs
sed -si 's/$(PWD)/$(shell pwd)/' Makefile
sed -si 's/^CONTAINER_RUNTIME.*/CONTAINER_RUNTIME=docker/' Makefile

modify app URL and docker conn as needed

sed -i 's|^url.|url = "http://127.0.0.1:8888"|' Config.toml
sed -i 's/^host.
/host = "127.0.0.1"/' Config.toml
sed -i 's/^username./username = "webapp"/' Config.toml
sed -i 's/^password.
/password = "abcd1234"/' Config.toml
sed -i 's/^database.*/database = "webapp"/' Config.toml
make all

deploy the web app

sudo apt install -y postgresql-client
cargo install diesel_cli --no-default-features --features "postgres"
sudo make deploy
make run-app
docker ps -a

Also, note that the build should be done on a local filesystem so that it can be mapped as a volume in a container.

I'd be glad to help put this in a project wiki page if needed.

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.74. Please mark this comment with ๐Ÿ‘ or ๐Ÿ‘Ž to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Hey @rich-murphey, thank you for the contribution. ๐Ÿ™ Are you willed to open up a PR to add these information to the README (or a dedicated file)?

Yes, I'll submit a PR for the README. If you have any other preferences, just let me know.

Sounds good, thanks. :)

This project is a rusty Gem of github. Thanks SO much for publishing this. Coming from a non-programming background this is a bit overwhelming but the programming appears to be extremely refined and thus, it is a massive learning experience! My only wish is more documentation and explanation of the 'moving parts' herin. Thanks for making this available and refining to close-perfection.

This project is a rusty Gem of github. Thanks SO much for publishing this. Coming from a non-programming background this is a bit overwhelming but the programming appears to be extremely refined and thus, it is a massive learning experience! My only wish is more documentation and explanation of the 'moving parts' herin. Thanks for making this available and refining to close-perfection.

Thank you thatโ€™s so nice! :)

   Compiling webapp-frontend v1.0.0 (/opt/webapp.rs/frontend)
error: failed to run custom build command for `webapp-frontend v1.0.0 (/opt/webapp.rs/frontend)`

--- stderr
Error: Error { inner: ErrorInner { kind: Wanted { expected: "newline", found: "an equals" }, line: Some(1), col: 29, at: Some(38), message: "", key: [] } }

error: build failed
make: *** [Makefile:53: build-frontend] Error 101

receiving following error when following this guide in latest debian

commented

@rich-murphey some additions... Maybe that changed since 2019, but this info is clearly missing.

make all still failed for me because these commands were missing:

  • sudo apt-get install libpq-dev (or you get linker error for not finding the postgresql lib)
  • cargo install wasm-pack (got /bin/sh: 2: wasm-pack: not found
  • npm install --global rollup (got /bin/sh: 2: rollup: not found)
  • sudo apt-get install npm (in case you didn't have npm, js package mananger)

Please correct where needed ๐Ÿ˜‰