Sawtooth supply chain application setup failed - hyperledger

Step 1/11 : FROM hyperledger/sawtooth-shell:nightly
ERROR: Service 'shell' failed to build: manifest for hyperledger/sawtooth-shell:nightly not found
I am trying to build the supply chain application on linux environment but the build is failing.

The Hyperledger Sawtooth Supply Chain has been modified for the nightly build, 1.2, which is not released yet. What I do is revert to the version that supports the current Sawtooth release, Sawtooth 1.1:
git clone https://github.com/hyperledger/sawtooth-supply-chain
cd sawtooth-supply-chain
git diff 50c404c >bionic.patch
patch --dry-run -R -p1 <bionic.patch
patch -R -p1 <bionic.patch
sudo docker-compose up
Another solution that I have seen but have not tried, are a few Dockerfile tweeks:
diff --git a/shell/Dockerfile b/shell/Dockerfile
index 7ea0caba..b57c2db1 100644
--- a/shell/Dockerfile
+++ b/shell/Dockerfile
## -13,10 +13,10 ##
# limitations under the License.
# ------------------------------------------------------------------------------
-FROM hyperledger/sawtooth-shell:nightly
+FROM hyperledger/sawtooth-shell:bumper-nightly
# Install Python, Node.js, and Ubuntu dependencies
-RUN echo "deb http://repo.sawtooth.me/ubuntu/1.0/stable bionic universe" >> /etc/apt/sources.list \
+RUN echo "deb http://repo.sawtooth.me/ubuntu/1.0/nightly xenial universe" >> /etc/apt/sources.list \
&& (apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 44FC67F19B2466EA \
|| apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 44FC67F19B2466EA) \
&& apt-get update \
You can also ask these questions on the Sawtooth Supply Chain chat channel (free registration with The Linux Foundation):
https://chat.hyperledger.org/channel/sawtooth-supply-chain

Related

GCSFuse installation in Docker in GCloud failing

I'm running a command that worked until yesterday, and works locally on my local Docker, to install gcsfuse version 0.28.1:
E: Version '0.28.1' for 'gcsfuse' was not found
I tried it on the google cloud console too, and got the same error there.
Any suggestions or pointers?
Here's the original command:
export GCSFUSE_REPO=gcsfuse-lsb_release -c -s
&& echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
&& apt-get update && apt-get install -y gcsfuse=0.28.1 \
I tried the below commands on Google Cloud Shell as per this document reference and I was able to install GCSFuse successfully.
Add the gcsfuse distribution URL as a package source and import its public key using :
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
Update the list of packages available and install gcsfuse using :
sudo apt-get update
sudo apt-get install gcsfuse
(Ubuntu before wily only) Add yourself to the fuse group, then log out and back in using :
sudo usermod -a -G fuse $USER
exit
I also found a line in this document which says “The following instructions set up apt-get to see updates to gcsfuse, and are supported for the bionic, artful, zesty, yakkety, xenial, and trusty releases of Ubuntu, and the jessie and stretch releases of Debian. (Run lsb_release -c to find your release codename.) Users of older releases should follow the instructions for other distributions below.
So you should also try and find the release codename first. If you are a user of an older release then these commands might not work for you. For that, follow the instructions/commands of installing older distributions, which is clearly differentiated and specified in this document link
I am not sure if it was your formatting but it looks like it was missing the release variable in your commands. Please try with the commands below:
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s` && \
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
apt-get update -y && \
apt-get install -y gcsfuse=0.28.1 -V
If it does not work, here is the repo with all gcsfuse releases:
https://github.com/GoogleCloudPlatform/gcsfuse/releases/tag/v0.28.1

How to accept the license agreement when building rti-connext-dds-5.3.1 with docker build?

I am building an image from a Dockerfile that needs to install the package rti-connext-dds-5.3.1. (It's one of the dependencies when building ROS2 on Linux).
The problem with that package is that it displays a license agreement that must be scrolled-down and then accepted by entering "yes" on the prompt. I cannot seem to set up the Dockerfile commands to auto-scroll and/or auto-accept this license agreement:
Pressing the Enter or Space key does not scroll the license down, it just displays blank lines. Pressing any other key/s just prints it out to the console. At this point, the build is stuck, and it can't proceed.
Here is the Dockerfile:
FROM ubuntu:bionic
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y apt-utils debconf-utils gnupg2 lsb-release && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116 && \
echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros2-latest.list && \
apt-get update && \
apt-get install -y rti-connext-dds-5.3.1
WORKDIR /home
I already tried:
Setting DEBIAN_FRONTEND=noninteractive different ways based on the answers from Is it possible to answer dialog questions when installing under docker?
Setting DEBIAN_FRONTEND=teletype based on How to accept license agreement during docker build?
Using debconf-set-selections based on apt-get install without debconf prompt
# echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
# echo "rti-connext-dds-5.3.1 rti-connext-dds-5.3.1/license string y" | debconf-set-selections && \
# echo "rti-connext-dds-5.3.1 rti-connext-dds-5.3.1/license string yes" | debconf-set-selections && \
Piping the yes command (this is worse, as I can't even abort with Ctrl+C)
# apt-get install -y -q rti-connext-dds-5.3.1
# yes "yes" | apt-get install -y -q rti-connext-dds-5.3.1
How do I auto-scroll and/or auto-accept the license during installation?
You can use the env variable "RTI_NC_LICENSE_ACCEPTED=yes". Your dockerfile will look something like this:
FROM ubuntu:bionic
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y apt-utils debconf-utils gnupg2 lsb-release && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116 && \
echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros2-latest.list && \
apt-get update
RUN RTI_NC_LICENSE_ACCEPTED=yes apt-get install rti-connext-dds-5.3.1
WORKDIR /home
This is a valid answer but def not the best one. I'm currently using the trial version of DDS which does NOT allow you to automatically accept the license. So my work around was to do the following:
First I installed the expect command which allows you to write scripts that will interact and say hit enter 21 times and then the letter y etc.
Additionally there is a command called autoexpect that will generate a script for you. So my steps are:
Launch a basic container and copy over rti_connext_dds-6.0.1-eval-x64Linux4gcc7.3.0.run - or mount the file locally
Run autoexpect ./rti_connext_dds-6.0.1-eval-x64Linux4gcc7.3.0.run which will generate script1.exp.
Now build an actual container that copies over the install file as well as the expect script and do the following:
ARG RTI_INSTALL_FILE=rti_connext_dds-6.0.1-eval-x64Linux4gcc7.3.0.run
RUN chmod +x /rti/${RTI_INSTALL_FILE} && expect /rti/script.exp
The best path - of course - is to do what was suggested above - however - to know more about docker expect is a great little hack

Unable to start a Validator Node in Hyperledger Sawtooth. Docker unable to validate certificate

I am trying the command docker-compose up to start the Validator Node in my Hyperledger Sawtooth setup on my Ubuntu machine.
I am running this command behind my company's proxy.
When I use the command docker-compose up, I get the following output:
Building validator
Step 1/15 : FROM ubuntu:xenial
---> 4a689991aa24
Step 2/15 : RUN echo "deb http://repo.sawtooth.me/ubuntu/ci xenial universe" >> /etc/apt/sources.list && (apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD || apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 8AA7AF1F1091A5FD) && apt-get update
---> Using cache
---> 59b3dd0413ec
Step 3/15 : RUN apt-get install -y -q --allow-downgrades git python3 python3-stdeb
---> Using cache
---> fa792ef3800a
Step 4/15 : RUN apt-get install -y -q --allow-downgrades python3-grpcio python3-grpcio-tools python3-protobuf
---> Using cache
---> b21e9522d61d
Step 5/15 : RUN apt-get install -y -q --allow-downgrades python3-cbor python3-colorlog python3-cryptography>=1.7.1 python3-dev python3-lmdb python3-netifaces=0.10.4-0.1build2 python3-pyformance python3-secp256k1 python3-toml python3-yaml python3-zmq unzip
---> Using cache
---> bff0f3b39a0a
Step 6/15 : RUN curl -OLsS https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip && unzip protoc-3.5.1-linux-x86_64.zip -d protoc3 && rm protoc-3.5.1-linux-x86_64.zip
---> Running in 37e4dd702373
curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
ERROR: Service 'validator' failed to build: The command '/bin/sh -c curl -OLsS https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip && unzip protoc-3.5.1-linux-x86_64.zip -d protoc3 && rm protoc-3.5.1-linux-x86_64.zip' returned a non-zero code: 60
It says that the server verification failed and stops at step(6/15).
How do I fix this?
You need to install the key for the repository.
For the stable repository, use:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8AA7AF1F1091A5FD
$ sudo add-apt-repository 'deb [arch=amd64] http://repo.sawtooth.me/ubuntu/bumper/stable xenial universe'
For the nightly, development repository use:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 44FC67F19B2466EA
$ sudo apt-add-repository 'deb [arch=amd64] http://repo.sawtooth.me/ubuntu/nightly xenial universe'

How to install oracle-java8-installer on docker debian:jessie

I am trying to install java 8 through oracle-java8-installer on a debian:jessie docker container. The following is my Dockerfile:
FROM debian:jessie
ENV JAVA_VERSION 1.8.0
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java.list
RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/webupd8team-java.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
RUN echo "debconf shared/accepted-oracle-license-v1-1 select true" | /usr/bin/debconf-set-selections
RUN apt-get update
RUN apt-get install -y --force-yes vim
RUN apt-get install -y --force-yes oracle-java8-installer
Yet this gives:
Connecting to download.oracle.com (download.oracle.com)|23.63.224.171|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-01-17 12:31:05 ERROR 404: Not Found.
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
The command '/bin/sh -c apt-get install -y --force-yes oracle-java8-installer' returned a non-zero code: 100
I have found many similar issues described online, but none of the proposed solutions worked for me. Any idea?
Found the solution on https://hub.docker.com/r/anapsix/docker-oracle-java8/~/dockerfile/:
## JAVA INSTALLATION
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends oracle-java8-installer && apt-get clean all
The "secret sauce" you were looking for is the first line:
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
Re to donhector's response and your question: you need to replace the strings in the installer file, instead of yours last command:
apt-get install -y --force-yes oracle-java8-installer
run these commands:
apt-get -y install oracle-java8-installer || true
cd /var/lib/dpkg/info
sed -i 's|JAVA_VERSION=8u151|JAVA_VERSION=8u162|' oracle-java8-installer.*
sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/|' oracle-java8-installer.*
sed -i 's|SHA256SUM_TGZ="c78200ce409367b296ec39be4427f020e2c585470c4eed01021feada576f027f"|SHA256SUM_TGZ="68ec82d47fd9c2b8eb84225b6db398a72008285fafc98631b1ff8d2229680257"|' oracle-java8-installer.*
sed -i 's|J_DIR=jdk1.8.0_151|J_DIR=jdk1.8.0_162|' oracle-java8-installer.*
apt-get install -f -y
apt-get install -y oracle-java8-set-default
I have them in a separate script and run it as
RUN /bin/sh /path/to/script.sh
or you can run them directly from your Dockerfile, that's up to you.
You are installing from the webupd8 PPA repo. If you notice, the Java 8 package in that repo points to Java 8 version 151. That package pulls the binary for 151 from the Oracle servers (since Java Oracle licence does not allow anyone else hosting the binaries). Oracle released version 161 a couple days back and apparently moved or removed 151 from their servers. So basically the package in the webupd8 PPA repo is trying to download the 151 binary which no longer exists at the location that the webupd8 package expects it (hence the 404 you got). The webupd8 PPA repo maintainer will have to release a new package pointing to the new 161 binaries from Oracle. Docker or Debian don't play any role in the issue, it is just basically a broken link issue.
Until then you could apply a "workaround" like the one mentioned here: JDK 8 is NOT installed - ERROR 404: Not Found
Here's the list of Java packages in the webupd8 repo:
https://launchpad.net/~webupd8team/+archive/ubuntu/java/+packages
See dpkg oracle Jdk error while installing cassandra in Ubuntu 16.04. This issue is occurring for everyone using install scripts of any kind.
** Java 11:
RUN apt-get install wget java-common gnupg2 -y
RUN echo "oracle-java11-installer shared/accepted-oracle-license-v1-2 select true" | debconf-set-selections
RUN echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | tee /etc/apt/sources.list.d/linuxuprising-java.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends oracle-java11-installer && apt-get clean all

Create Jenkins Docker Image with pre configured jobs

I have created a bunch of Local deployment pipeline jobs, these jobs do things like remove an existing container, build a service locally, build a docker image, run the container - etc. These are not CI/CD jobs, just small pipelines for deploying locally during dev.
What I want to do now is make this available to all our devs, so they can just simply spin up a local instance of jenkins that already contains the jobs.
My docker file is reasonably straight forward...
FROM jenkins:latest
USER root
RUN apt-get update
RUN apt-get install -y sudo
RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers
# Docker
RUN apt-get update
RUN apt-get dist-upgrade -y
RUN apt-get install apt-transport-https ca-certificates -y
RUN sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
RUN apt-get update
RUN apt-cache policy docker-engine
RUN apt-get install docker-engine -y
# .NET Core CLI dependencies
RUN echo "deb [arch=amd64] http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.6 main" > /etc/apt/sources.list.d/llvm.list \
&& wget -q -O - http://llvm.org/apt/llvm-snapshot.gpg.key|apt-key add - \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
clang-3.5 \
libc6 \
libcurl3 \
libgcc1 \
libicu52 \
liblldb-3.6 \
liblttng-ust0 \
libssl1.0.0 \
libstdc++6 \
libtinfo5 \
libunwind8 \
libuuid1 \
zlib1g \
&& rm -rf /var/lib/apt/lists/*
#DotNetCore
RUN curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?linkid=847105
RUN mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet
RUN ln -s /opt/dotnet/dotnet /usr/local/bin
# Minimal Jenkins Plugins
RUN /usr/local/bin/install-plugins.sh git matrix-auth workflow-aggregator docker-workflow blueocean credentials-binding
# Skip initial setup
ENV JAVA_OPTS -Djenkins.install.runSetupWizard=false
COPY LocallyDeployIdentityConfig.xml /var/jenkins_home/jobs/identity/config.xml
USER jenkins
What I thought I could do is simply copy a job config file into the /jobs/jobname folder and the job would appear, but not only does this not appear, but now I cannot manually create jobs either. I now get a java.io.IOException "No such file or directory" - Note when I exec into the running container, the job and jobname directories exist and my config file is in there.
Any ideas?
For anyone who is interested - I found a better solution. I simply map the jobs folder to a folder on my host, that way I can put the created jobs into source control and edit then add them without having to build a new docker image.
Sorted.
Jobs need to bootstrapped while the Jenkins starts can be copied to /usr/share/jenkins/ref/jobs/ folder.
But keep in mind that if the jobs(or any) already exist in Jenkins home folder, updates from /usr/share/jenkins/ref/jobs/ folder won't have any effect unless you end the files with *.override name.
https://github.com/jenkinsci/docker/blob/master/jenkins-support#L110
Dockerfile
# First time building of jenkins with the preconfigured job
COPY job_name/config.xml /usr/share/jenkins/ref/jobs/job_name/config.xml
# But if jobs need to be updated, suffix the file names with '.override'.
COPY job_name/config.xml.override /usr/share/jenkins/ref/jobs/job_name/config.xml.override
I maintain the jobs in a bootstrap folder together with configs etc.
To add a job (i.e. seedjob) I need to add the following to the Dockerfile:
# copy seedjob
COPY bootstrap/seedjob.xml /usr/share/jenkins/ref/jobs/seedjob/config.xml

Resources