Can not get data with etcdctl but Can do with curl - etcd

I can get data from etcd with curl, like follow:
core ~ $ curl http://10.12.1.105:2379/v2/keys/zk/codis/db_test
{"action":"get","node": {"key":"/zk/codis/db_test","dir":true,"expiration":"2016-09- 18T06:35:35.892545267Z","ttl":31535019,"nodes": [{"key":"/zk/codis/db_test/ActionResponse","dir":true,"expiration":"2016-09- 18T06:40:45.162912721Z","ttl":31535328,"modifiedIndex":10,"createdIndex":10},
{"key":"/zk/codis/db_test/LOCK","dir":true,"expiration":"2016-09-18T06:48:07.460467703Z","ttl":31535770,"modifiedIndex":5130,"createdIndex":5130},
{"key":"/zk/codis/db_test/servers","dir":true,"modifiedIndex":5132,"createdIndex":5132},
{"key":"/zk/codis/db_test/dashboard","value":"{\"addr\": \"10.12.1.101:18087\", \"pid\": 9}","expiration":"2016-09-18T06:35:35.90202187Z","ttl":31535019,"modifiedIndex":6,"createdIndex":6},{"key":"/zk/codis/db_test/migrate_tasks","dir":true,"expiration":"2016-09-18T06:35:35.909309855Z","ttl":31535019,"modifiedIndex":7,"createdIndex":7},
{"key":"/zk/codis/db_test/slots","dir":true,"modifiedIndex":8,"createdIndex":8},
{"key":"/zk/codis/db_test/actions","dir":true,"expiration":"2016-09-18T06:40:45.15502607Z","ttl":31535328,"modifiedIndex":9,"createdIndex":9}],"modifiedIndex":5,"createdIndex":5}}
But I Can not get data from etcd2 with etcdctl :
core#hack-day-master ~ $ etcdctl -C 10.12.1.105:2379 ls
/coreos.com
Who can help me?

try
etcdctl -C 10.12.1.105:2379 ls --recursive
--recursive would help list all keys.

Related

Install CURRENT version of Gradle within CI

Gradle describes their installation in their docs:
https://docs.gradle.org/current/userguide/installation.html
However the docs requires using specific version and there is no easy way to say "get the current version".
I would like to do something like:
export GRADLE_VERSION=`curl https://services.gradle.org/current-version`
curl -sSLO https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip \
&& unzip -q -d /opt/gradle gradle-*.zip \
&& echo "PATH=$PATH:/opt/gradle/gradle-${GRADLE_VERSION}/bin" > ~/.bashrc
Obviously there is no such API service like /current-version. How would you achieve this?
I suggest:
curl -s 'https://services.gradle.org/versions/current' | jq -r '.version'
Output:
7.3.1
or
curl -s 'https://services.gradle.org/versions/current' | jq -r '.downloadUrl'
Output:
https://services.gradle.org/distributions/gradle-7.3.1-bin.zip

How can I replace a variable and do conditional inside to work to interpolate as input of pacman [fix script]?

First sorry, this is not the best title and it is difficult for me to understand, please consider edit.
I would like to understand what is happening
Steps:
First, run docker pull oblique/archlinux-yay.
Second, run docker run -it --rm 52a1e19f71c7 bash (52a1e19f71c7 is the container id).
Do the following, download a tarball, create two variables and set with these strings, use EOS and do a if else condition and I expect to install with pacman a package.
[root#71cac056c2f9 ~]# curl -O https://gitlab.com/carlosal1015/dune-archiso-repository-extra/-/jobs/1079556435/artifacts/raw/x86_64/gconf-3.2.6+11+g07808097-10-x86_64.pkg.tar.zst
[root#71cac056c2f9 ~]# ISDEPENDS='true'
[root#71cac056c2f9 ~]# DEPENDENCIES_PACKAGE='gconf*'
[root#71cac056c2f9 ~]# sudo -H -i -u aur bash -e -x << EOS
if [ $ISDEPENDS ]; then sudo pacman -U `echo $DEPENDENCIES_PACKAGE | tr -d \'` ; fi
EOS
Type enter after last EOS.
[root#71cac056c2f9 ~]# error: 'gconf-3.2.6+11+g07808097-10-x86_64.pkg.tar.zst': could not find or read package
[root#71cac056c2f9 ~]# ls
gconf-3.2.6+11+g07808097-10-x86_64.pkg.tar.zst
And I would like to pass sudo pacman -U gconf* and start installation, because when I do the following works well.
[root#71cac056c2f9 ~]# pacman -U gconf*
loading packages...
resolving dependencies...
looking for conflicting packages...
Packages (6) dbus-glib-0.110-2 js78-78.8.0-1 libnsl-1.3.0-1 polkit-0.118-1 python-3.9.2-1
gconf-3.2.6+11+g07808097-10
Total Download Size: 42.96 MiB
Total Installed Size: 153.36 MiB
:: Proceed with installation? [Y/n]
Thank you.

Getting Lego error passing email address using --email

To renew a LetsEncrypt certificate I was following this Bitnami doc and:
sudo /opt/bitnami/letsencrypt/lego --tls --email="somebody#example.com" --domains="example.com" --domains="www.example.com" --path="/opt/bitnami/letsencrypt" renew --days 90
kept returning the error:
You have to pass an account (email address) to the program using --email or -m
I tried retyping the hyphens and quotations in case they were being changed to en dashes and inverted commas in copy/paste, but no luck. Appreciate pointers to what I may be doing wrong or could do differently.
Bitnami Engineer here. It seems you have an old version of the lego binary in your instance, you have 2 options:
Use that previous version: In this case you will need to run this command instead
sudo /opt/bitnami/letsencrypt/lego --email="somebody#example.com" --domains="example.com" --domains="www.example.com" --path="/opt/bitnami/letsencrypt" renew --days 90
Note: I removed the --tls parameter
Update the lego binary
cd /tmp
curl -Ls https://api.github.com/repos/xenolf/lego/releases/latest | grep browser_download_url | grep linux_amd64 | cut -d '"' -f 4 | wget -i -
tar xf lego_v2.6.0_linux_amd64.tar.gz
sudo mkdir -p /opt/bitnami/letsencrypt
sudo mv lego /opt/bitnami/letsencrypt/lego
Note: 2.6.0 was the latest version of the lego binary when writing this message
and then run your command again
sudo /opt/bitnami/letsencrypt/lego --tls --email="somebody#example.com" --domains="example.com" --domains="www.example.com" --path="/opt/bitnami/letsencrypt" renew --days 90
I hope this helps

Installing latest docker compose on Ubuntu

I use the following to install the most recent docker compose for my ubuntu server:
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
How to do I make this more version agnostic. For instance, so that I do not have to go in and keep changing the version -which in this case is 1.21.2. How do I change the command so it gets the most latest stable release?
How do I change the command so it gets the most latest stable release?
You could try following:
curl -L https://github.com/docker/compose/releases/download/`curl -Ls -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest | awk -F / '{print $NF}'`/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
This is same as your script only replacing actual version (1.21.2 in your case) with latest tag over several steps:
First we get redirection url for latest stable:
curl -Ls -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest
currently it resolves to https://github.com/docker/compose/releases/tag/1.21.2
Then we get version tag out of redirection url:
| awk -F / '{print $NF}'
currently resolving to 1.21.2
Finally we execute it in place of version number using your original curl statement. Note that this can break if latest tag is not properly redirected and ads some extra complexity, but automates version pulling as requested.
Accepted answer isn't the latest stable version according to https://docs.docker.com/compose/release-notes/ (returns v2 instead of the latest v1 which I was looking for)
This is the monstrosity I went with
rm -Rf /usr/local/bin/docker-compose && version=$(curl -s https://docs.docker.com/compose/release-notes/ | grep "Docker Compose release notes" | grep "Estimated reading time" | sed 's/.*id=//g' | sed 's/<.*$//g' | sed 's/.*>//g') && curl -L https://github.com/docker/compose/releases/download/${version}/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose

Get latest stable helm release

Is there a shell command to get the latest stable helm release .
For kubernetes we have something like this
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
Try:
wget -qO- https://github.com/kubernetes/helm/releases | sed -n '/Latest release<\/a>/,$p' | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' |head -1
Result:
v2.8.2
And, for those without wget:
HVER=$(curl -sSL https://github.com/kubernetes/helm/releases | sed -n '/Latest release<\/a>/,$p' | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1)
echo $HVER
Result (currently):
v2.9.1
To download the gz that contains the latest Helm executable:
Linux
curl -LO https://storage.googleapis.com/kubernetes-helm/helm-${HVER}-linux-amd64.tar.gz
OSX
curl -LO https://storage.googleapis.com/kubernetes-helm/helm-${HVER}-darwin-amd64.tar.gz
Windows (bash ell)
curl -LO https://storage.googleapis.com/kubernetes-helm/helm-${HVER}-windows-amd64.tar.gz
if in-case you use Dockerfile & Linux
RUN wget "https://storage.googleapis.com/kubernetes-helm/helm-$(wget -qO- https://github.com/kubernetes/helm/releases | sed -n '/Latest release<\/a>/,$p' | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' |head -1)-linux-amd64.tar.gz"
For Linux, OSX, and Windows targets:
HELM_INSTALL_DIR=[‘desired path’]
USE_SUDO=[‘true’|’false’]
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
Other install options: Helm Install Documentation
Recommend migration away from V2.x as soon as you can.
The way I do it for v2:
curl -L0 "https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz" | tar xzO linux-amd64/helm > /usr/local/bin/helm
And for v3:
curl -L0 "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" | tar xzO linux-amd64/helm > /usr/local/bin/helm
Do not forget to chmod +x /usr/local/bin/helm afterwards.

Resources