how to fix i think some thing wrong with the code - docker

what wrong with it ?
do i do something wrong in here ?
docker stop blockchain-service
docker rm blockchain-service
docker run --name blockchain-service -d
--restart always -v ~/ethereum/:/var/run/ethereum -e
GETH_IPC_PATH=/var/run/ethereum/ethereum-data.ipc -e
SQS_QUEUE_URL=https://sqs.us-east-1.amazonaws.com/407151891480/geth-mainnet-transactions -e
MASTER_WALLET_ADDRESS=0xMASTER_KEY --log-opt max-size=100m --log-opt max-file=3 -e
SQS_PAYMENT_REQUESTS_QUEUE_URL=geth-mainnet-payment-requests -e
FAKE_USER_WALLET_PRIVATE_KEY=PRIVATE_KEY -e
FAKE_USER_WALLET_PUBLIC_KEY=0xPUBLIC_KEY -e
AWS_ACCESS_KEY_ID=ACCESS_KEY -e
AWS_SECRET_ACCESS_KEY=ACCESS_KEY -e
ENV=prod -e
EXPECTED_TRANSACTION_AMOUNT=1000000000000000000000 -e
DB_PORT=5432 -e
DB_NAME=endordb -e
DB_USER=endor_admin -e
DB_HOST=MY_DB.us-east-1.rds.amazonaws.com -e
DB_PASSWORD=NO_PASSWORD -e
SLACK_TOKEN=xoxp-14092887333-345643415810-495051526626-e
2e61b404d4be9b0a7002ae01e25991a 407151891480.dkr.ecr.us-east-1.amazonaws.com/blockchain-service

Maybe you are missing an env variable after the SLACK_TOKEN?
I recommend to put all your variables in an env file and then use "--env-file

Related

Github action deploying to lightsail has suddenly started failing with dial tcp i/o timeout

I have a github action set up to deploy to an Amazon Lightsail server via ssh. It was working fine until it suddenly started failing with an i/o error. It has consistently failed now for 24 hours (I have tried it many times). I commented out everything in the script part and still get the error, so I know it isn't anything in the script. I think it's pretty clear that it is failing to reach the server and not even getting as far as attempting to run the script.
Here is the output:
Run appleboy/ssh-action#master
/usr/bin/docker run --name ea425b117d14f49c9448e1ae86bb8e0dfd290d_f25ed1 --label ea425b --workdir /github/workspace --rm -e "INPUT_HOST" -e "INPUT_USERNAME" -e "INPUT_KEY" -e "INPUT_PORT" -e "INPUT_SCRIPT" -e "INPUT_PASSPHRASE" -e "INPUT_PASSWORD" -e "INPUT_SYNC" -e "INPUT_USE_INSECURE_CIPHER" -e "INPUT_CIPHER" -e "INPUT_TIMEOUT" -e "INPUT_COMMAND_TIMEOUT" -e "INPUT_KEY_PATH" -e "INPUT_FINGERPRINT" -e "INPUT_PROXY_HOST" -e "INPUT_PROXY_PORT" -e "INPUT_PROXY_USERNAME" -e "INPUT_PROXY_PASSWORD" -e "INPUT_PROXY_PASSPHRASE" -e "INPUT_PROXY_TIMEOUT" -e "INPUT_PROXY_KEY" -e "INPUT_PROXY_KEY_PATH" -e "INPUT_PROXY_FINGERPRINT" -e "INPUT_PROXY_CIPHER" -e "INPUT_PROXY_USE_INSECURE_CIPHER" -e "INPUT_SCRIPT_STOP" -e "INPUT_ENVS" -e "INPUT_DEBUG" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/carboncalc/carboncalc":"/github/workspace" ea425b:117d14f49c9448e1ae86bb8e0dfd290d
======CMD======
# cd /opt/bitnami/drupal
# git pull origin main
# composer -n install
# if [ $? -ne 0 ]; then
# exit 1
# fi
# drush updb
# drush cr
======END======
372023/01/18 11:24:51 dial tcp 104.21.26.173:22: i/o timeout
Someone has reported a similar issue here for MacOS runners but I am using ubuntu-latest. I've also tried with ubuntu-20.04 and had same issue.
I can't see any way to increase the timeout so if you know of a way please let me know.
Various people have raised issues on https://github.com/appleboy/ssh-action with the same issue but the answers are things like the SSH key being incorrect, the port being closed or the IP changing. But I have no problem ssh'ing from my machine, and the key that is stored in secrets is the same one that was working a few days ago.
There is plenty of disk space on the target machine.
OP here. Turns out the problem was that I was using the hostname in the ssh command, rather than the IP. For some AWS-magicky reason, the hostname was resolving to an internal IP. It was different from the IP which I use when successfully SSH'ing from my local machine. So I replaced the hostname with this IP, and it started working again.

Change the password that was set when starting docker

I runned with the following parameters:
docker run --restart always -v /srv/dav:/var/lib/dav \ -e AUTH_TYPE=Basic -e USERNAME=webdav -e PASSWORD=******* \ -e SSL_CERT=selfsigned --publish 443:443 -d k3vmcd/webdav
How can I change the password for an already running container?
-e AUTH_TYPE=Basic -e USERNAME=webdav -e PASSWORD=******* \
I tried to restart the container with a different password, but the already created container did not change the password

Getting "/opt/jboss/tools/docker-entrypoint.sh: line 165: DB_ADDR: unbound variable" while creating keycloak container

I am trying to create a docker container for keycloak. But when I try the below command in docker quickstart terminal:
docker run -it -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin jboss/keycloak
I am getting the below error:
/opt/jboss/tools/docker-entrypoint.sh: line 165: DB_ADDR: unbound variable
Upon researching a bit, I came to know that I need to pass DB_ADDR in the command also. So I tried the below command now:
docker run -it -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_ADDR=keycloak-db -e DB_VENDOR=h2 jboss/keycloak
But still I am getting the same error. I don't really know what I am doing wrong. Please if anyone can help me here. Thankyou all.
Update the script as below:
docker run \
-p 8080:8080 \
-e KEYCLOAK_USER=admin \
-e DB_VENDOR=h2 \
-e KEYCLOAK_PASSWORD=admin \
-it jboss/keycloak:latest

no matching manifest for linux/amd64 in the manifest list entries

Today I build my image in GitHub Actions suddenly facing this problem(It works fine in the past peroid of time), the GitHub Actions base OS is ubuntu-latest:
Warning: Input 'repository' has been deprecated with message: v2 is now available through docker/build-push-action#v2
Run docker/build-push-action#v1
/usr/bin/docker run --name dockergithubactionsv1_3426e3 --label 48c179 --workdir /github/workspace --rm -e JAVA_HOME_11.0.12_x64 -e JAVA_HOME -e JAVA_HOME_11_0_12_X64 -e INPUT_REGISTRY -e INPUT_USERNAME -e INPUT_PASSWORD -e INPUT_TAGS -e INPUT_REPOSITORY -e INPUT_PATH -e INPUT_TAG_WITH_REF -e INPUT_TAG_WITH_SHA -e INPUT_DOCKERFILE -e INPUT_TARGET -e INPUT_ALWAYS_PULL -e INPUT_BUILD_ARGS -e INPUT_CACHE_FROMS -e INPUT_LABELS -e INPUT_ADD_GIT_LABELS -e INPUT_PUSH -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/retire/retire":"/github/workspace" docker/github-actions:v1 "build-push"
Logging in to registry ***
WARNING! Using -*** the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /github/home/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
Building image [***/reddwarf-pro/dolphin-post:665f8e551bdc05147fee286052ccf3d10a968eb5]
Sending build context to Docker daemon 113.1MB
Step 1/7 : FROM adoptopenjdk/openjdk11-openj9:latest
latest: Pulling from adoptopenjdk/openjdk11-openj9
no matching manifest for linux/amd64 in the manifest list entries
Error: exit status 1
Usage:
github-actions build-push [flags]
Flags:
-h, --help help for build-push
exit status 1
this is my GitHub Action script:
- name: Build image push to aliyun
uses: docker/build-push-action#v1
with:
registry: ${{ secrets.ALI_DOCKER_HUB_REGISTRY }}
username: ${{ secrets.ALIYUN_DOCKER_REPO_USER_NAME }}
password: ${{ secrets.ALIYUN_DOCKER_REPO_USER_PASSWORD }}
tags: ${{ github.sha }}
repository: reddwarf-pro/dolphin-gateway
path: 'dolphin-gateway'
this is my Dockerfile:
FROM adoptopenjdk/openjdk11-openj9:latest
MAINTAINER jiangxiaoqiang (jiangtingqiang#gmail.com)
ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone
ADD build/libs/dolphin-gateway-1.0.0-SNAPSHOT.jar /root/dolphin-gateway-1.0.0-SNAPSHOT.jar
EXPOSE 11014
ENTRYPOINT exec java -Dfile.encoding=UTF-8 -Xmx256M -Xms128M \
-Xdebug -Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=5019 \
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/dump \
-jar /root/dolphin-gateway-1.0.0-SNAPSHOT.jar
where is going wrong? what should I do to fix this problem? what should I do to avoid this problem in the furture?
change the docker image to an specify version:
FROM adoptopenjdk/openjdk11-openj9:jdk-11.0.11_9_openj9-0.26.0-alpine
works.

How to start a custom RQ worker within a Docker Container (Python, Flask and Redis)

I followed the excellent Flask Mega Tutorial by Miguel Grinberg and have successfully setup a Flask web app with a Redis task queue and RQ workers, all in Docker containers.
To improve task queue performance, I now need to use my own custom worker, rather than the default RQ worker.
Unfortunately, I'm struggling to understand how I start a custom worker within docker.
To start a default RQ worker, the Flask Mega Tutorial uses the method of overriding the Docker entrypoint with "venv/bin/rq" and then supplying the argument "worker -u redis://redis-server:6379/0 microblog-tasks".
The executable name is supplied with the --entrypoint flag, whilst the command arguments are passed at the very end, after the name of the container image.
Here is the full command - only the last two lines are relevant to this question.
$ docker run --name rq-worker -d --rm -e SECRET_KEY=my-secret-key \
-e MAIL_SERVER=smtp.googlemail.com -e MAIL_PORT=587 -e MAIL_USE_TLS=true \
-e MAIL_USERNAME=<your-gmail-username> -e MAIL_PASSWORD=<your-gmail-password> \
--link mysql:dbserver --link redis:redis-server \
-e DATABASE_URL=mysql+pymysql://microblog:<database-password>#dbserver/microblog \
-e REDIS_URL=redis://redis-server:6379/0 \
--entrypoint venv/bin/rq \
microblog:latest worker -u redis://redis-server:6379/0 microblog-tasks
I have my own custom worker with the following code, taken directly from the RQ documentation:
#!/usr/bin/env python
import sys
from rq import Connection, Worker
# Preload libraries
import library_that_you_want_preloaded
# Provide queue names to listen to as arguments to this script,
# similar to rq worker
with Connection():
qs = sys.argv[1:] or ['default']
w = Worker(qs)
w.work()
Given that my custom worker is located within the Docker container at "home/dashboard/app/custom_worker.py", which commands do I need to supply upon starting the Docker container to create an RQ worker using my customised worker script? So far I have tried the following:
$ docker run --name rq-worker -d --rm -e SECRET_KEY=my-secret-key \
-e MAIL_SERVER=smtp.googlemail.com -e MAIL_PORT=587 -e MAIL_USE_TLS=true \
-e MAIL_USERNAME=<your-gmail-username> -e MAIL_PASSWORD=<your-gmail-password> \
--link mysql:dbserver --link redis:redis-server \
-e DATABASE_URL=mysql+pymysql://microblog:<database-password>#dbserver/microblog \
-e REDIS_URL=redis://redis-server:6379/0 \
--entrypoint venv/bin/rq \
microblog:latest /home/dashboard/app/custom_worker.py -u redis://redis-server:6379/0 microblog-tasks
and also...
$ docker run --name rq-worker -d --rm -e SECRET_KEY=my-secret-key \
-e MAIL_SERVER=smtp.googlemail.com -e MAIL_PORT=587 -e MAIL_USE_TLS=true \
-e MAIL_USERNAME=<your-gmail-username> -e MAIL_PASSWORD=<your-gmail-password> \
--link mysql:dbserver --link redis:redis-server \
-e DATABASE_URL=mysql+pymysql://microblog:<database-password>#dbserver/microblog \
-e REDIS_URL=redis://redis-server:6379/0 \
--entrypoint /home/dashboard/app \
microblog:latest custom_worker -u redis://redis-server:6379/0 microblog-tasks
Any help would be greatly appreciated. There are a lot of posts online about creating a custom RQ worker, but I've not found much detail on how you practically use your custom worker in deployment.
Thank you kindly,
Robin
In the docs its possible with below command:
/usr/local/bin/rq worker -w custom_worker.py --path path/to/sourcecode
See more options with /usr/local/bin/rq worker --help
Docs:
https://python-rq.org/docs/workers/#custom-worker-classes

Resources