Run meteor tests with Chimp at Codeship CI - bash

I have Meteor project and I want to run my tests with Chimp at Codeship.
I have a problem that Meteor project must be started before running Chimp. After starting Meteor, it blocks terminal showing that server si ready at localhost:3000
Usually at localhost I just run (and wait to start) Meteor. Then in another bash tab I run chimp.
At Codeship bash I cannot do such a thing. I tried some linux commands sleep, &, nohup but I cannot put it together.
Setup commands
# Install node
nvm install 4.0
nvm install 0.10
node -v
# Install chimp
npm install -g chimp
# Install meteor
curl -o meteor_install_script.sh https://install.meteor.com/
chmod +x meteor_install_script.sh
sed -i "s/type sudo >\/dev\/null 2>&1/\ false /g" meteor_install_script.sh
./meteor_install_script.sh
export PATH=$PATH:~/.meteor/
meteor --version
Test commands
nohup bash -c "meteor --settings=settingsRemote.json 2>&1 &" && sleep 3m; cat nohup.out
chimp --ddp=http://localhost:3000 --mocha --browser=firefox --path=tests
With above settings I got this output on meteor command. Chimp is never run.
[[[[[ ~/src/bitbucket.org/jirikrepl/nedatluj-meteor ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:3000/
------------------------------------------------------------------------------
This command didn't output anything for 10 minutes, thus we stopped it.
Please make sure your steps regularly print to standard out or standard error.
If the error is on our end please inform us so we can help you to fix this.
------------------------------------------------------------------------------

Ok here is the solution. I edited code above, so it now works.

Related

How to get the exit code from playwright?

I'm running some playwright tests in a pipeline but I'm having problems trying to fail the build when a test fails.
In my pipeline I call a make file that calls a shell script that installs playwright, does some setup, and then runs the command yarn playwright test the script I call always returns an exit code 0 but Playwright returns an exit code 1 if a test fails.
Is it possible for me to get the exit code of Playwright so I can then pass it back up and handle it in my pipeline?
Update:
The line in my makefile that calls the sh script is:
uiTests: node-install node-audit
$(DOCKER_RUN_NODE) bash /app/scripts/playwright.sh
My Playwright.sh script:
#!/usr/bin/env bash
apt-get update
apt-get install -y gnupg2 gnupg1 wget
docker pull mcr.microsoft.com/playwright/python:v1.27.0-focal
yarn install
yarn playwright install
yarn playwright install-deps
yarn run local & yarn run uiTests
rm -rf node_modules
This pulls the dependencies then starts the local instance of the site and runs the tests
yarn run uiTests runs this command "BASE_URL='http://localhost:3000' yarn playwright test"

Docker is not running when run curl command to create new laravel project

I just start learning laravel, and follow the tutorial from https://laravel.com/docs/8.x/installation "Getting started on Windows" .
I manage to install Docker Desktop and COnfigured to use WSL2 Backend.
When I run the command curl -s https://laravel.build/example-app | bash to create laravel application directory from cmd, this warning come out Docker is not running.
I run curl using command prompt. (cmd).
Update:
So, I run the command in Windows Terminal:.
PS E:\Play> curl -s https://laravel.build/example-app | bash
Here is the response I get:
cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri:
Any Idea what to do?
Try to explicitly enable integration with your distro in Docker settings:
After that relaunch your WSL2 terminal & try again. That should help.
You can also open https://laravel.build/example-app in a browser & check what commands the script is running: and run them manually to check the output for any errors.
For those who are using Ubuntu or Debian can check this guide out on how to install and configure Docker.
sudo snap install docker
sudo usermod -aG docker $(whoami)
sudo chmod 666 /var/run/docker.sock
You need to install a linux distro, and then in Windows Terminal create a new tab for the linux distro and run the command there, not in a windows powershell tab.
Make sure that you are running curl command on your distro. Use Windows Terminal app and open a new tab as WSL2 (your distro).
sudo chmod 666 /var/run/docker.sock
I guess you are using ubuntu or debian.
chmod will do the trick here.

Heroku CLI unresponsive on Ubuntu 16.04

I'm trying to get heroku cli installed on Ubuntu 16.04, following the documentation here: Heroku CLI Documentation and while my system appears to install it correctly, whenever I try any Heroku commands like heroku login the terminal hangs, and becomes unresponsive. I'm not getting any error codes.
Here's what I've tried:
I've tried installing heroku via the following methods:
wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh
That didn't work, I uninstalled and tried this:
sudo snap install heroku --classic
That did't work, I uninstalled and tried this:
wget https://cli-assets.heroku.com/heroku-cli/channels/stable/heroku-cli-linux-x64.tar.gz -O heroku.tar.gz
tar -xvzf heroku.tar.gz
mkdir -p /usr/local/lib /usr/local/bin
mv heroku-cli-v6.16.12-04b3626-linux-x64 /usr/local/lib/heroku
ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
And got the same result.
The one command that does seem to work is heroku --version, but only after about 3 minutes does it return heroku-cli/6.16.12-04b3626 (linux-x64) node-v9.11.1
. I don't know if there is something going on with my os, but everything else on my system seems to be working fine.
Any help would be greatly appreciated.
The problem was my ~/.netrc file. I had somehow gotten the same entry into it over 12,000 times. After clearing that file heroku works.

Ruby on Rails 4 executing shell command daemon

I use the built-in options to distribute my Ruby on Rails app.
Meaning I start the server with
rails s -e production -p 80 -d
But as soon as I append the daemon flag -d to this command I can no longer execute shell commands...
I tried a wide spectrum of possibilities to execute commands e.g.:
system(cmd)
%x[ #{cmd} ]
`#{cmd}`
Process.detach(spawn(cmd))
Process.fork do
p = spawn(cmd)
Process.detach(p)
end
And I have no idea what else I can do...
Would be very grateful for a hint/solution...
Some informations to the running system:
OS: Ubuntu 14.04 LTS
Rail Version: 4.0.2
I log via ssh onto the computer and start the rails server
I've tested all commands listed above, they all work without the daemon flag but will not work with it...
Thanks in advance.
Greetings Alex
Failure found.
There is not connection between Server as daemon and no processes/shell commands.
I was just stupid enough to look in the wrong dirs...
Note:
If you execute the rails server as daemon it is no longer a process of the user but of the root. Just check the next time if all paths are bullet proof.

What is the command/configuration to run NodeJS/Express app as a daemon?

In SSH if I run:
$ node server
My web app works fine until I close the SSH session. What is the command or configuration needed so that it runs all the time without an active SSH session?
you can run it like:
nohup node server
Or you can install forever.
npm -g install forever
forever start server
If you have multiple nodejs, you can use pm2 to manage them.
Or, use screen or tmux to keep the nodejs running while detach the session.

Resources