Swarmlab docs

Application development in a distributed system

Development of Distributed Systems from Design to Application


You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.7 KiB

3 years ago
= FAQ!
3 years ago
[#How_to_get_the_path_of_current_script0]
3 years ago
xref:index.adoc#How_to_get_the_path_of_current_script[How to get the path of current script]
[#Fix_x509_certificate_signed_by_unknown_authority_issue0]
xref:index.adoc#Fix_x509_certificate_signed_by_unknown_authority_issue[How to Fix "x509: certificate signed by unknown authority" issue]
[#Add_current_user_to_the_docker_group0]
xref:index.adoc#Add_current_user_to_the_docker_group[Homw to Add current user to the docker group]
3 years ago
[cols="1,1"]
|===
|Cell in column 1, row 1
3 years ago
|Cell in column 1, row 2
|Cell in column 1, row 3
3 years ago
|===
3 years ago
3 years ago
3 years ago
[#How_to_get_the_path_of_current_script]
3 years ago
[.text-right]
3 years ago
== How to get the path of current script xref:index.adoc#How_to_get_the_path_of_current_script0[image:up-1.png[28,28,float=right]]
3 years ago
[source,bash]
----
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
TARGET="$(readlink "$SOURCE")"
if [[ $TARGET == /* ]]; then
SOURCE="$TARGET"
else
DIR="$( dirname "$SOURCE" )"
SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
fi
done
SRPATH="$( dirname "$SOURCE" )"
SFPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
if [ "$SFPATH" != "$SRPATH" ]; then
RDIR=$SRPATH # relativ path directory
fi
#echo "full path file $SOURCE"
#echo "full path dir $SFPATH"
#echo "relativ path dir $SRPATH"
cwdir=$PWD
wdir=$SFPATH
cd $wdir
echo "current working directory,"
echo $cwdir
echo "dir of running program"
echo $wdir
----
3 years ago
3 years ago
[#Fix_x509_certificate_signed_by_unknown_authority_issue]
[.text-right]
== How to Fix "x509: certificate signed by unknown authority" issue xref:index.adoc#Fix_x509_certificate_signed_by_unknown_authority_issue0[image:up-1.png[28,28,float=right]]
3 years ago
3 years ago
run with sudo
3 years ago
3 years ago
[source,bash]
----
#!/bin/bash
3 years ago
3 years ago
registry_address=hub.swarmlab.io
registry_port=5443
mkdir -p /etc/docker/certs.d/$registry_address:$registry_port
openssl s_client -showcerts -connect $registry_address:$registry_port < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/docker/certs.d/$registry_address:$registry_port/ca.crt
registry_port=5480
mkdir -p /etc/docker/certs.d/$registry_address:$registry_port
openssl s_client -showcerts -connect $registry_address:$registry_port < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/docker/certs.d/$registry_address:$registry_port/ca.crt
----
[#Add_current_user_to_the_docker_group]
[.text-right]
== Homw to Add current user to the docker group xref:index.adoc#Fix_x509_certificate_signed_by_unknown_authority_issue0[image:up-1.png[28,28,float=right]]
[source,bash]
----
sudo usermod -aG docker $USER
----