I do not understand what was wrong in using appengine:exec. Can you found it? - gcloud

TOPIC: App Eng environment flex Ruby on Rails App.
Got this error when trying to do some rake tasks on remote.
NoMethodError: undefined method []' for nil:NilClass
/usr/local/bundle/gems/appengine-0.5.0/lib/appengine/exec.rb:754:in start_build_strategy' /usr/local/bundle/gems/appengine-0.5.0/lib/appengine/exec.rb:491:in start'
/usr/local/bundle/gems/appengine-0.5.0/lib/appengine/tasks.rb:317:in start_and_report_errors' /usr/local/bundle/gems/appengine-0.5.0/lib/appengine/tasks.rb:165:in block in setup_exec_task'
/usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in <top (required)>' /usr/local/bin/bundle:23:in load'
/usr/local/bin/bundle:23:in <main>' Tasks: TOP => appengine:exec
Got this error when trying to do some rake tasks on remote, like rake db:migrate.
We could make this by build a cloud run service, but it doesn't work for now, because we exhausted CPU quota. Instead we are trying to do the same by employing appengine gem.
We are using docker to avoid installing dependencies on local environment.
aebuild:
docker build ${ALECTRICO_PATH} -f AppEng.local.Dockerfile -t local-app-eng
aerun:
docker run --rm -it
-v $(shell pwd)/.config/gcloud/application_default_credentials.json:/config/sa.json
-v $(shell pwd)/.kube/:/root/.kube/
-v ${shell pwd}/AppEng.web.Dockerfile:/home/Dockerfile
-v $(shell pwd)/app.gcloud.yaml:/home/app.yaml
-v $(shell pwd)/.gcloudignore:/home/.gcloudignore
-v $(shell pwd)/.dockerignore:/home/.dockerignore
-v $(shell pwd)/.env:/home/.env
-v $(shell pwd)/corel002.png:/home/app/views/electrico/presupuesto_mailer/corel002.png
-e CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=/config/sa.json
-e CLOUDSDK_CORE_PROJECT=${PROJECT_ID}
-e CLOUDSDK_APP_CLOUD_BUILD_TIMEOUT='16000s'
local-app-eng
bash -c "gcloud auth login && bundle exec rake appengine:exec -- ls"

Related

Makefile: Terminates after running commands "go test ./..."

I encountered a problem running "go test" from a makefile. The idea behind all this is to start a docker container, run all tests against it and then stop & remove the container.
The container gets started and the tests run, but the last two commands (docker stop & rm) aren't executed.
Make returns this message:
make: *** [test] Error 1
Is it "go test" which terminates the makefile execution?
.PHONY: up down test
up:
docker-compose up
down:
docker-compose down
test:
docker run -d \
--name dev \
--env-file $${HOME}/go/src/test-api/testdata/dbConfigTest.env \
-p 5432:5432 \
-v $${HOME}/go/src/test-api/testdata/postgres:/var/lib/postgresql/data postgres
# runs all tests including integration tests.
go test ./... --tags=integration -failfast -v
# stop and remove container
docker stop `docker ps -aqf "name=dev"`
docker rm `docker ps -aqf "name=dev"`
Assuming that you want the 'make test' to return the test status consider the following change to the makefile
test:
docker run -d \
--name dev \
--env-file $${HOME}/go/src/test-api/testdata/dbConfigTest.env \
-p 5432:5432 \
-v $${HOME}/go/src/test-api/testdata/postgres:/var/lib/postgresql/data postgres
# runs all tests including integration tests.
go test ./... --tags=integration -failfast -v ; echo "$$?" > test.result
# stop and remove container
docker stop `docker ps -aqf "name=dev"`
docker rm `docker ps -aqf "name=dev"
exit $$(cat test.result)
It uses the test.result file to capture the exit code from the test

Cloud confluent kafka installation failed in ubuntu 18

Instruction page says as:-
Install the Confluent Cloud CLI
Run this command to install the Confluent Cloud CLI.
curl -L --http1.1 https://cnfl.io/ccloud-cli | sh -s -- -b /usr/local/bin
it failed for permission
"install: cannot create regular file '/usr/local/bin/ccloud':
Permission denied"
Even if I tried
sudo curl -L --http1.1 https://cnfl.io/ccloud-cli | sh -s -- -b /usr/local/bin
Same error. How do I install it?
Well, I installed it as:-
curl -L --http1.1 https://cnfl.io/ccloud-cli | sh -s -- -b ~/Downloads/
After the above command
sudo mv ~/Downloads/ccloud /usr/local/bin/
Everything is fine now.

Eclipse Che Google Cloud Compute Engine

Having challenges running Eclipse Che multiuser mode on Google Cloud computer engine instance.
Environment
(che cli): 6.1.0 - using docker 17.03.2-ce / native
Input:
docker run -it -e CHE_MULTIUSER=true -e CHE_HOST={server-ip} -v /var/run/docker.sock:/var/run/d
ocker.sock -v {localuserfolder}:/data eclipse/che start
Output:
INFO: (che start): Starting containers...
docker_compose --file="/data/instance/docker-compose-container.yml" -p="che" up -d >> "/data/cli.log" 2>&1
che_postgres_1 is up-to-date
ERROR: for che Container "4a245b40b556" is unhealthy.
ERROR: for keycloak Container "4a245b40b556" is unhealthy.
Encountered errors while bringing up the project.
ERROR: Error during 'compose up' - printing 30 line tail of {localuserfolder}/cli.log:
Noticed issue has something do to with postgres not having permission to run some scripts:
docker container logs che_postgres_1
/usr/bin/container-entrypoint: line 3: exec: /var/lib/pgsql/init-che-user-and-run.sh: cannot execute: Permission denied
/usr/bin/container-entrypoint: line 3: /var/lib/pgsql/init-che-user-and-run.sh: Permission denied
Documented fix doesn't work, :/data is already mounted to read/writable directory.
Probably Google Cloud overrides file system permissions somehow. Have you tried mounting different dirs into :/data?
I've tested your command and it works in my case by using a GCP instance with Debian 9 and docker 17.12, here is the steps that I've followed:
1) install docker
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
$ curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
$ sudo apt-get install docker-ce
2) run che, I've used as a directory the /tmp, I recommend you to create another directory to store the files
$ sudo docker run -it -e CHE_MULTIUSER=true -e CHE_HOST=INTERNAL-IP -v /var/run/docker.sock:/var/run/docker.sock -v /DIRECTORY_WITH_PERMISSIONS:/data eclipse/che start

Running new meteorhacks/meteord application, don't have meteor app

I try to create a new project based on the meteor with docker.
I found the repository for this:
https://github.com/meteorhacks/meteord
I created Dockerfile and put there
FROM meteorhacks/meteord:onbuild
And then run:
docker run meteorhacks/meteord
docker run mongo
After downloading all packages so finally I run
docker run -i -t 807754a01782 -d
-e ROOT_URL=http://localhost:3000
-e MONGO_URL=mongodb://127.0.0.1:27017/
-e MONGO_OPLOG_URL=mongodb://127.0.0.1:27017/
-p 8080:80 myapp
Based on this example:
docker run -d \
-e ROOT_URL=http://yourapp.com \
-e MONGO_URL=mongodb://url \
-e MONGO_OPLOG_URL=mongodb://oplog_url \
-p 8080:80 \
yourname/app
Inside myapp folder, I have fresh meteor project.
But as a result, I received
> You don't have an meteor app to run in this image.
Can anyone help me and give me some clues what I'm doing wrong? Or I misunderstanding how Docker with this repository works?
EDIT:
The problem was in command correct command is:
docker run -d
-e ROOT_URL=http://localhost:3000
-e MONGO_URL=mongodb://127.0.0.1:27017/
-e MONGO_OPLOG_URL=mongodb://127.0.0.1:27017/ -p 8080:80
meteorhacks/meteord:base
But now when I check the status of this container I see it is excited. How Can I check what causing the problem?

Starting a rake task as daemon

I'm trying to daemonize a rake task by running the following command (on Ubuntu 12.04)
start-stop-daemon -S --pidfile /home/dep/apps/fid/current/tmp/pids/que.pid
-u dep -d /home/dep/apps/fid/current -b -m
-a "bundle exec rake que:work RAILS_ENV=staging > /home/dep/apps/fid/current/log/que.log 2>&1"
-v
The console says
Starting bundle exec rake que:work RAILS_ENV=staging > /home/dep/apps/fid/current/log/que.log 2>&1...
Detaching to start bundle exec rake que:work RAILS_ENV=staging > /home/dep/apps/fid/current/log/que.log 2>&1...done.
but nothing happen.
the pid file is empty and no log file created.
Am I missing anything here?
Thanks.
Try to get more about the environments (and their differences) when running bundle from your normal environment and running it from start-stop-daemon.
e.g. print all env variables in both cases and adjust accordingly.