avast / gradle-docker-compose-plugin not working - kotlin

I'm using the avast /
gradle-docker-compose-plugin - https://github.com/avast/gradle-docker-compose-plugin in my project here - https://github.com/johnnyalpha8/Pet-Shop/blob/main/build.gradle.kts .
My project is a SpringBoot Kotlin API.
I believe I have configured the plugin correctly. I have added it to the plugins block of my build.gradle.kts -
plugins {
...
id("com.avast.gradle.docker-compose") version "0.15.2"
}
Now when I try out the new task ./gradlew composeUp the container starts up just fine, but then immediately shuts down and the build fails with -
Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ config --services
Successfully started process 'command 'docker-compose''
Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ ps --services
Successfully started process 'command 'docker-compose''
List containers.
Usage: ps [options] [SERVICE...]
Options:
-q Only display IDs
Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ config --services
Successfully started process 'command 'docker-compose''
Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ stop --timeout 10 myservice mariadb
Successfully started process 'command 'docker-compose''
Stopping 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_1 ...
Stopping 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_myservice_1 ...
Stopping 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_myservice_1 ... done
Stopping 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_1 ... done
Starting process 'command 'docker-compose''. Working directory: /home/charliejade/dev/apps/reactiveKotlin-source-code Command: docker-compose --no-ansi -p 649e9eedea35a6b45cffd19a30f272cd_reactiveKotlin_ down --volumes
Successfully started process 'command 'docker-compose''
Removing 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_1 ...
Removing 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_myservice_1 ...
Removing 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_myservice_1 ... done
Removing 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_1 ... done
Removing volume 649e9eedea35a6b45cffd19a30f272cdreactivekotlin_mariadb_data
> Task :composeUp FAILED
:composeUp (Thread[Execution worker for ':',5,main]) completed. Took 1 mins 18.015 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':composeUp'.
> Exit-code 1 when calling docker-compose, stdout:
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 19s
Gradle Scan - https://scans.gradle.com/s/ealbm2cysvi42
Full debug logs with stacktrace can be found here - https://github.com/johnnyalpha8/Pet-Shop/issues/1
I am using -
Linux Mint 19.3 Tricia as my OS.
Kotlin v1.6.20
docker-compose version 1.17.1
I should add that my services start correctly when done manually with docker-compose up docker-compose.yml. My docker-compose.yml file has two services, mariadb + my Kotlin REST API. I've tried ./gradlew composeUp with just mariadb in the docker-compose file and I get the same result.
Feel free to checkout the code from here - https://github.com/johnnyalpha8/Pet-Shop and try it out for yourself :(
I am quite stumped, but don't want to give up on the plugin just yet :)!
Any insight into what is wrong would be appreciated!

Related

How to force exit an vue cli thread on completion in a deploy script (e.g. ctrl c equivelant)

I'm using Laravel Forge to run a simple deploy script. npm run build calls 'vue-cli-service build'.
Script below. The script 'ends' on
DONE Build complete. The dist directory is ready to be deployed.
INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
but the thread does not quit, which causes issues in forge (e.g. thinks it's timed out or failed when it hasn't).
How do I do the equivelant of ctrl-c in a terminal once this has finished, in the deploy script? I've seen threads on trap SIGINT / trap etc. but I'm still not really sure how to implement it.
It may be that I just include the exit callback fix noted here: Vue-cli-service serve build completion callback?
git pull origin $FORGE_SITE_BRANCH;
npm run build;
( flock -w 10 9 || exit 1
echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock
if [ -f artisan ]; then
$FORGE_PHP artisan migrate --force
fi```
Try out to add Daemon termination command to the end of your deployment script
$FORGE_PHP artisan horizon:terminate

Command "rabbitmq-plugins enable rabbitmq_management" fails with "Error: noproc"

My team has a continuous integration script running in Bitbucket Pipelines that includes some RabbitMQ tests.
Our bitbucket-pipelines.yml file looks like this:
image: python:3.6.8
pipelines:
default:
- step:
name: Run Tests
caches:
- pip
script:
- pip install -r requirements.txt
- apt-get update
- apt-get install -y rabbitmq-server
- rabbitmq-server -detached
- sleep 2
- rabbitmq-plugins enable rabbitmq_management
- sleep 2
- rabbitmqctl stop
- sleep 2
- rabbitmq-server -detached
- python tests.py
Around 50% of the time we get the following error:
+ rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
mochiweb
webmachine
rabbitmq_web_dispatch
amqp_client
rabbitmq_management_agent
rabbitmq_management
Applying plugin configuration to rabbit#90a65858-035c-4b74-be6b-a0e43bb508d1... failed.
Error: noproc
Re-running the pipeline generally "fixes" the problem. But this is eating away at our build minutes, and is quite frustrating to constantly re-run failed pipelines.
We added some sleep commands in there to try and slow things down, but thats obviously not working as intended, because we keep getting the "Error: noproc"
I'm hopeful that we are just "holding it wrong" but after lots of research and experimentation, it's not clear to me what were doing wrong.

Testing chaincode Using dev mode network issue

I am running “dev mode” by leveraging pre-generated orderer and channel artifacts for a sample dev network
here cli require image: hyperledger/fabric-tools by default it is trying to pull latest tag image and showing errorlatest image. and it throwing error
Error response from daemon: manifest for hyperledger/fabric-tools:latest not found
so I pull image hyperledger/fabric-tools:x86_64-1.0.0, and rename it with hyperledger/fabric-tools:latest( not sure it is proper way or not ) by :
docker pull hyperledger/fabric-tools:x86_64-1.0.0
docker tag hyperledger/fabric-tools:x86_64-1.0.0 hyperledger/fabric-tools
My network is running successfully but unfortunately cli container is stopped running.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d10d170cd2fa hyperledger/fabric-tools:x86_64-1.0.0 "/bin/bash -c ./sc..." 29 seconds ago Exited (1) 27 seconds ago cli
163f494bb85f hyperledger/fabric-ccenv "/bin/bash -c 'sle..." 59 minutes ago Up About a minute chaincode
e96e86930d94 hyperledger/fabric-peer "peer node start -..." 59 minutes ago Up About a minute 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer
c568480e30d2 hyperledger/fabric-orderer "orderer" 59 minutes ago Up About a minute 0.0.0.0:7050->7050/tcp
You can use the tools container as the cli container.
docker exec -it d10d170cd2fa /bin/bash
Can you post logs of cli container by issuing command docker logs <containerId>? cli container exit doesn't necessarily mean there's any error about the e2e test.
If you started the services using docker-compose, you can run either of: docker-compose restart -f docker-compose-simple.yaml cli or docker-compose up -f docker-compose-simple.yaml cli.
However, if you started your network AFTER having tagged the fabric-tools image as above, you should examine the logs of your exited container with docker logs cli, to determine why it exited.
It can be because of previously running docker containers. In my case first time it worked correctly but it gave error in second time. Killing and removing created docker containers using
docker rm container_name
and starting containers again, solved the problem.

Gitlab CI, ssh runner

When I try to create ssh runner in deploy console I have this error:
Running with gitlab-ci-multi-runner 1.7.1 (f896af7)
Using SSH executor...
ERROR: Preparation failed: open ~/.ssh/id_rsa.pub: no such file or directory
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: open ~/.ssh/id_rsa.pub: no such file or directory
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: open ~/.ssh/id_rsa.pub: no such file or directory
Will be retried in 3s ...
ERROR: Build failed (system failure): open ~/.ssh/id_rsa.pub: no such file or directory
On my server I created ssh key, and this key is in directory ~/.ssh/id_rsa.pub.
My .gitlab-ci.yml file:
stages:
- deploy
before_script:
- whoami
mate-finder:
stage: deploy
script:
- sudo apt-get update -qy
- sudo apt-get install -y nodejs
- sudo npm install
- sudo ng build
- sudo ng serve
How can I deploy my application on server? How must I configure my runner on the server, when I want to deploy my angular2 application on it?
You need to check, where config.toml is placed. You can do it with a search.
find / -name 'config.toml'
If result would be
/etc/gitlab-runner/config.toml
You running runner as root. And you need to specify full path like /root/.ssh/id_rsa.
If no - you running it under other user and you'll need to specify directory like /home/user/.ssh/id_rsa.
To find out which user you are - register shell executor and run pwd or whoami
I believe it would be gitlab-runner if not root.
In my case, I change ~/.ssh/id_rsa path to /root/id_rsa.
when I changed in config.toml it is not helped, but reconfigure the runner fix that.

Capistrano 3 Unicorn Start returning a strange error in the last step

I ran $ cap production deploy on my rails 5 application. It worked fine right up to the last step:
Seems like a permission issue to me, but it was working normally earlier.
unicorn:restart
01 service unicorn_myApp_production restart
01 Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by any .serv…
01 See system logs and 'systemctl status unicorn_myApp_production.service' for details.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as marvin#bubbl.in: service exit status: 1
service stdout: Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status unicorn_myApp_production.service' for details.
service stderr: Nothing written
SSHKit::Command::Failed: service exit status: 1
service stdout: Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status unicorn_myApp_production.service' for details.
service stderr: Nothing written
Tasks: TOP => unicorn:restart
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as marvin#bubbl.in: service exit status: 1
service stdout: Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status unicorn_myApp_production.service' for details.
service stderr: Nothing written
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
DEBUG [b9413f29] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env mv /var/www/myApp/releases/…
INFO [b9413f29] Finished in 0.111 seconds with exit status 0 (successful).
INFO [cef268ae] Running /usr/bin/env sudo service delayed_job_myApp_production restart as marvin#bubbl.in
DEBUG [cef268ae] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env sudo service delayed_job_bubb…
INFO [cef268ae] Finished in 21.242 seconds with exit status 0 (successful).
INFO [41580c64] Running /usr/bin/env sudo /etc/init.d/nginx reload as marvin#bubbl.in
DEBUG [41580c64] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env sudo /etc/init.d/nginx reload…
DEBUG [41580c64] [....] Reloading nginx configuration (via systemctl): nginx.service
DEBUG [41580c64]
DEBUG [41580c64]
DEBUG [41580c64]
DEBUG [41580c64] [ ok
DEBUG [41580c64]
DEBUG [41580c64]
DEBUG [41580c64] .
INFO [41580c64] Finished in 0.268 seconds with exit status 0 (successful).
INFO [84d3bdae] Running /usr/bin/env service unicorn_myApp_production restart as marvin#bubbl.in
DEBUG [84d3bdae] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env service unicorn_myApp_produ…
DEBUG [84d3bdae] Failed to restart unicorn_myApp_production.service: The name org.freedesktop.PolicyKit1 was not provided by…
See system logs and 'systemctl status unicorn_myApp_production.service' for details.
Has anyone else faced this? What am I doing wrong.
It is a permissions error. In the last line:
/usr/bin/env service myApp start
Try:
/usr/bin/env sudo service myApp start