I'm trying to run a script that requires the cargo subcommand cargo set-version --workspace --bump="${2:-}".
How do I install it?
Google results only returned cargo install set-cargo-version but that is actually a different crate, not the one I need here, as I found out after installing.
Searching for set-version on cargo.io I discovered that the crate cargo-edit installs the subcommand cargo set-version.
Installation works as follows:
cargo install cargo-edit
As #Shirshak55 mentioned: cargo-edit provides cargo add, cargo rm, cargo upgrade, cargo set-version
I've tried to install it locally yarn add -D standard-version package and use it for release versioning and changeLog.md generation, But when I run yarn release which is standard-version, it will generate changeLog and does the version updating, but there are two problems:
error: pathspec 'CHANGELOG.md' did not match any file(s) known to git
λ yarn release
yarn run v1.17.3
$ standard-version
√ bumping version in package.json from 0.6.3 to 0.6.4
√ outputting changes to CHANGELOG.md
√ committing package.json and CHANGELOG.md
error: pathspec 'CHANGELOG.md' did not match any file(s) known to git
Command failed: git commit CHANGELOG.md package.json -m chore(release): 0.6.4
error: pathspec 'CHANGELOG.md' did not match any file(s) known to git
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
repeating previous release commit messages in the new release changelog
What is the problem and how should I fix this?
You should change your file changelog.md to CHANGELOG.md, the issue related to naming convention
I had searched this issue for a while and currently I don't see any solutions so far. My current approach is to replace new content with old content in the file. Hope it helps.
Wekan is an open-source Kanban Board which used to be easy to install using nodejs (given that you already set up your MongoDB). I am stumbling upon the actual installation steps of the guide to install Wekan on Ubuntu 16.04:
Download the latest version wekan source code using the wget command and extract it.
wget https://github.com/wekan/wekan/releases/download/v0.63/wekan-0.63.tar.gz
tar xf wekan-0.63.tar.gz
And you will get a new directory named bundle. Go to that directory and install the Wekan dependencies using the npm command as shown below.
cd bundle/programs/server
npm install
Figuring out the last stable version is easy, there are new stable versions nearly every day (as of March 2019), which somehow seem to contradict the common definition.
More importantly, the directory bundle/programs/server does not exist, only server, but it does not contain a main.js which would be necessary to run
node main.js
Other resources considered:
I did of course check the official documentation, but it looks not up-to-date. The page https://github.com/wekan/wekan/wiki/Install-and-Update is redirecting to a rather untidy page which does no longer talk about a standalone installation.
I prefer a minimal installation and not a solution using snap like described at computingforgeeks
There is also an unanswered question about a more specific installation around: Installing Wekan via Sandstorm on cPanel which follows a similar approach.
The latest releases on the Wekan page are actually no ready-to-use node builds.
Wekan is built using Meteor and you will need Meteor to create the build. This is because you could also build it using Meteor against other architectures than os.linux.x86_64.
So here is how to build the latest release as of today on your dev-machine to then deploy it:
Build it yourself
[1.] Install Meteor
curl https://install.meteor.com/ | sh
[2.] Download and extract the latest Wekan
wget https://github.com/wekan/wekan/archive/v2.48.tar.gz
tar xf wekan-2.48.tar.gz
cd wekan-2.48
[3.] Install Wekan Dependencies
./rebuild-wekan.sh
# use option 1
[4.] Install dependency Meteor packages
Now it gets dirty. Somehow the required packages are not included in the release (an issue should be opened at GH). You need to install them yourself:
# create packages dir
mkdir -p packages
cd packages
# clone packages
git clone git#github.com:wekan/wekan-ldap.git
git clone git#github.com:wekan/meteor-accounts-cas.git
git clone git#github.com:wekan/wekan-scrollbar.git
# install repo and extract packages
git clone git#github.com:wekan/meteor-accounts-oidc.git
mv meteor-accounts-oidc/packages/switch_accounts-oidc ./
mv meteor-accounts-oidc/packages/switch_oidc ./
rm -rf meteor-accounts-oidc/
cd ../
[5.] Build against your architecure
meteor build ../build --architecute os.linux.x86_64
# go grab a coffee... yes even with nvme SSD...
Once the build is ready you can go ../build and check out the wekan-2.48.tar.gz which now contains your built bundle including the described folders and files.
Use this bundle to deploy as described in the documentation.
Summary
This describes only how to create the build yourself and I am not giving any guarantee that the build package will run when deployed to your target environment.
I think there is either some issue with the way the releases are attached on GH or they explicitly want to keep it open against which arch you want to build.
In any case I would open an issue with demand for a more clear documentation and a description for reproduction of the errors your mentioned.
Further readings
https://guide.meteor.com/deployment.html#custom-deployment
Got this error during travis-cli builds ...
I checked the commit numbers ( Travis & Github ) they are not synchronised .. I hit the button (sync' but same issue no synchro ..
Is there a way to delete then reset my Tavis account ?
......
Preparing to unpack .../google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (62.0.3202.89-1) over (60.0.3112.113-1) ...
Setting up google-chrome-stable (62.0.3202.89-1) ...
Processing triggers for mime-support (3.54ubuntu1.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
travis_fold:end:install_chrome
[0K$ export PATH=./node_modules/.bin:$PATH
[33;1mUpdating nvm[0m
travis_fold:start:nvm.install
[0Ktravis_time:start:02fde630
[0K$ nvm install 8.5.1
Version '8.5.1' not found - try `nvm ls-remote` to browse available versions.
travis_time:end:02fde630:start=1510438925841600553,finish=1510438926083046237,duration=241445684
[0K[31;1mFailed to install 8.5.1. Remote repository may not be reachable.[0m
Using locally available version 8.5.1, if applicable.
$ nvm use 8.5.1
N/A: version "8.5.1 -> N/A" is not yet installed.
You need to run "nvm install 8.5.1" to install it before using it.
[31;1mUnable to use 8.5.1[0m
[31;1mThe command "false" failed and exited with 1 during .[0m
Your build has been stopped.
.travis.ylml
language: node_js
node_js:
- "8.9.1"
sudo: false
dist: trusty
addons:
chrome: stable
cache:
yarn: true
directories:
- node_modules
install:
- yarn
script:
- yarn test
Wrong commit sync between Travis & Github ... resolved by merging & rebase the Github commits
Is there a way to tell Cargo to install and build all my dependencies, but not attempt to build my application?
I thought cargo install would do that, but it actually goes all the way to building my app too. I want to get to a state where cargo build would find all dependencies ready to use, but without touching the /src directory.
What I'm really trying to accomplish:
I'm trying to build a Docker image for a Rust application, where I'd like to do the following steps:
Build time (docker build .):
import a docker image with rust tooling installed
add my Cargo.toml and Cargo.lock files
download and build all dependencies
add my source directory to the image
build my source code
Run time (docker run ...):
run the application
I've tried the following Dockerfile, but the indicated step builds my application as well (which of course fails since the source directory isn't there yet):
FROM jimmycuadra/rust
ADD Cargo.toml /source
ADD Cargo.lock /source
RUN cargo install # <-- failure here
ADD src /source/src
RUN cargo build
ENTRYPOINT cargo run
The reason I want to separate the install dependencies step from actually building my application, is that if I don't change the dependencies, I want Docker to be able use a cached image with all dependencies already installed and built. Thus, I can't ADD /src /source/src until after installing the dependecies, as that would invalidate the cached image when I change my own code.
There is no native support for building just the dependencies in Cargo, as far as I know. There is an open issue for it. I wouldn't be surprised if you could submit something to Cargo to accomplish it though, or perhaps create a third-party Cargo addon. I've wanted this functionality for cargo doc as well, when my own code is too broken to compile ;-)
However, the Rust playground that I maintain does accomplish your end goal. There's a base Docker container that installs Rustup and copies in a Cargo.toml with all of the crates available for the playground. The build steps create a blank project (with a dummy src/lib.rs), then calls cargo build and cargo build --release to compile the crates:
RUN cd / && \
cargo new playground
WORKDIR /playground
ADD Cargo.toml /playground/Cargo.toml
RUN cargo build
RUN cargo build --release
RUN rm src/*.rs
All of the downloaded crates are stored in the Docker image's $HOME/.cargo directory and all of the built crates are stored in the applications target/{debug,release} directories.
Later on, the real source files are copied into the container and cargo build / cargo run can be executed again, using the now-compiled crates.
If you were building an executable project, you'd want to copy in the Cargo.lock as well.
If you add a dummy main or lib file, you can use cargo build to just pull down the dependencies. I'm currently using this solution for my Docker based project:
COPY Cargo.toml .
RUN mkdir src \
&& echo "// dummy file" > src/lib.rs \
&& cargo build
I'm using --volumes, so I'm done at this point. The host volumes come in and blow away the dummy file, and cargo uses the cached dependencies when I go to build the source later. This solution will work just as well if you want to add a COPY (or ADD) later and use the cached dependencies though.
Based on a GitHub comment
FROM rust:1.37
WORKDIR /usr/src
# Create blank project
RUN USER=root cargo new PROJ
# We want dependencies cached, so copy those first.
COPY Cargo.toml /usr/src/PROJ/
COPY Cargo.lock /usr/src/PROJ/
WORKDIR /usr/src/PROJ
# This is a dummy build to get the dependencies cached.
RUN cargo build --release
# Now copy in the rest of the sources
COPY MyPROJECT/src /usr/src/PROJ/src/
# This is the actual build.
RUN cargo build --release \
&& mv target/release/appname /bin \
&& rm -rf /usr/src/PROJ
WORKDIR /
EXPOSE 8888
CMD ["/bin/appname"]
The cargo-chef tool is designed to solve this problem. Here's an example from the README on how you can use it in the Dockerfile:
FROM lukemathwalker/cargo-chef as planner
WORKDIR app
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM lukemathwalker/cargo-chef as cacher
WORKDIR app
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
FROM rust as builder
WORKDIR app
COPY . .
# Copy over the cached dependencies
COPY --from=cacher /app/target target
COPY --from=cacher $CARGO_HOME $CARGO_HOME
RUN cargo build --release --bin app
FROM rust as runtime
WORKDIR app
COPY --from=builder /app/target/release/app /usr/local/bin
ENTRYPOINT ["/usr/local/bin/app"]
I just wanted to post this here so others will see it going forward. There's an experimental tool for Docker I've just started using called cargo-wharf (https://github.com/denzp/cargo-wharf/tree/master/cargo-wharf-frontend). It's a Docker BuildKit frontend that caches built cargo dependencies for you. If you only change one of your source files, that's the only thing that gets rebuilt when you call docker build. You use it by annotating your Cargo.toml file, then directing Docker to your Cargo.toml instead of a Dockerfile. Go check it out, it's exactly what I wanted. (I am in no way affiliated with the project.)
It can be done via cargo init, cargo build, and cargo install. For example, for a project called foo, define the following Dockerfile:
FROM rust:slim-bullseye
# Build dependencies only.
RUN cargo init foo
COPY Cargo.toml foo/
RUN cargo build --release; \
rm -rf foo
# Install `foo`.
COPY . .
RUN echo "// force Cargo cache invalidation" >> foo/src/main.rs; \
cargo install --path foo
CMD ["foo"]
Here, cargo init creates the placeholder files that Cargo expects, cargo build builds the dependencies which were specified in the Cargo.toml, and cargo install creates the foo binary. For some reason, the Docker kept building the default project created by cargo init foo. This problem is resolved above by forcing an update for main.rs by appending // force Cargo cache invalidation.
To avoid slow builds due to large build contexts and large layers, make sure that unimportant folders such as target are ignored via .dockerignore. For example, define the following .dockerignore:
**/*.lock
LICENSE
README.md
target