Ember server port permission - macos

When doing ember s on any ember app, I get:
Serving on http://localhost:4200/
Livereload failed on http://localhost:49152. It is either in use or you do not have permission.
Checking the failing port with lsof -iTCP:49152 shows nothing. So I guess this must be a permission issue. I installed this on a new Mac using the setup suggested at https://stackoverflow.com/a/28025834/704499: brew install nvm, then nvm install 6.9.2, then npm install -g npm#latest.
I can start the server by using sudo ember s. But I can also start the server by explicitly assigning a different port for livereload – which doesn't make any sense given that nothing is blocking port 49152…
nodejs 6.9.2
nvm 0.32.1
npm 3.10.9
ember-cli 2.10.0
I'm confused as to what the exact cause of this problem is and how I can solve it. Any hints appreciated.

It's related to the Touchbar on the new MacBook Pros. See details here: https://github.com/ember-cli/ember-cli/issues/6513
If you change the port that live reload is launching on (on mobile at the moment, so don't have an easy way to look that command up), you should be set.

To address this issue temporarily, start the server on a different port:
ember serve --live-reload-port 0
Per ember help: "Pass 0 to automatically pick an available port", which generally works both for --live-reload-port as well as for webserver port. Occasionally I get the same error, and specifying a port like 35729 does the trick.
A fix is also in the ember-cli pipeline; you can update to the beta branch to test:
npm install -g ember-cli#beta
Note: #acorncom pointed out that beta has a fix (github issue) and the original poster of the question, #morgler, shared specific instructions for the live reload port number change in a comment on this thread. My answer merely consolidates the info in one place, so credit where credit is due.

Related

Looking for cloud based ide/ides where i can setup apache-superset for developement

I am looking to play with apache-superset on a cloud-based ide. I have it on my local. I tried unsuccessfully to set it up on gitpod. I wanted suggestions on where can I set it up, opensource preferably not necessarily. I believe cloud9 is 1 such place, but I am looking for other options before I settle. If you've ever set it up on any such platform, even if it is on gitpod and can help me, kindly do so.
[Disclaimer: Gitpod staff]
You can indeed use Gitpod to work on apache-superset, and for that you'll just need a working configuration.
From what I can see in apache-superset's requirements, you'll need to get:
PostgreSQL (e.g. by using Gitpod's official gitpod/workspace-full-postgres Docker base image)
Redis (e.g. by installing it in a Dockerfile via sudo apt-get install)
Various Python dependencies (e.g. by running pip install . after cloning)
Various Node.js dependencies for the front-end (e.g. by running npm install)
Here is a basic configuration I wrote to achieve this:
https://github.com/jankeromnes/incubator-superset/commit/0d345a76ec8126fd1f8b9bc7b6ce4961bf3b593d
What it does is:
Create a Docker image with PostgreSQL and Redis
Once the repository is cloned, open 4 separate Terminals ("tasks"):
Redis server
Superset backend
Superset worker
Superset front-end
All dependencies will be installed automatically, and once the front-end is ready, it will automatically open in a web preview IDE side panel.
You can try it out by opening my personal fork of the apache-superset repository in Gitpod, e.g. by following this link:
https://gitpod.io/#https://github.com/jankeromnes/incubator-superset

Laravel Brower Test (Dusk) error on MacOS (Docker): Failed to connect on localhost port 9515: connection refused

I just installed Laravel's Dusk to add browser tests. However, when I run a test, I get a Failed to connect on localhost port 9515: connection refused error.
I checked online and it seems like a lot of people are having the same issue. I came across few solutions e.g. this but it seems like they are all for Windows and Homestead whilst I am running my project on MacOS and Docker.
I did try to follow the solution but I found out sudo apt is not available for MacOS. I then installed Homebrew and tried to run the commands starting with brew instead of sudo apt but it responds saying no formula available for the name.
I would really appreciate it if you could recommend a solution or source I could look at. Thank you.
In case if someone else is having the same issue:
Basically, the issue was I was just following the Laravel Dusk Documentation without making any further configuration.
For the Docker environment, more configuration has to be done such as adding a Selenium container to allow the browser tests to run.
Checkout Jake Harris's 7 steps to running Laravel Dusk 3.0 tests in Docker environments to do this.
Thank you.

very strange behaviour with ruby, openssl, unicorn, systemd (Gcloud)

We started seeing some strange errors in our logs that normally appear when ruby isn't compiled properly with OpenSSL. But it's inconcistent...
We're getting errors like:
RuntimeError: Unsupported digest algorithm (SHA256). (also with other digests, like sha1). example error trace
Faraday::SSLError (SSL_CTX_new: (null)) example error trace
We managed to reproduce it when starting unicorn using service unicorn start or systemctl start unicorn. But only with some requests... Not all of them. Some requests that use OpenSSL under the hood do work. Others don't.
However, when we start unicorn with /etc/init.d/unicorn start, everything works without a hitch. (to clarify, systemd starts the same /etc/init.d script)
We tried debugging ENV vars, user permissions, file/dir ownership, recompile ruby, bootstrap a new server from scratch... Nothing seems to help.
In case this helps:
unicorn init.d script
unicorn.rb
What are we missing? What can we try that we haven't thought of?
UPDATE 1
output of some debug commands, e.g. OpenSSL, ruby etc
PATH is being set inside the init.d script
unicorn is being executed via su into www-data user
The same problem happens when we use this unicorn.service file in /etc/systemd/system
We're running Ubuntu 16.04 on Gcloud
Ruby was not installed via apt (explicitly removed, in case platform came pre-installed) and compiled from scratch. We're currently running 2.3.4 and tried also 2.3.6. Compiled either manually or using ruby-build. No rbenv, nor RVM.
We install libssl-dev via apt (we're running apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev before building ruby)
UPDATE 2
We're using a scripted/repeatable build process for the VM (using fabric), and this problem is consistent on multiple VMs we bootstrapped on GCloud. We then tried a VM on DigitalOcean with the same bootstrap scripts, and the problem doesn't seem to appear there.
In both cases we picked Ubuntu 16.04 64bit base image, but obviously there are some differences with kernel versions, base installed packages etc...
UPDATE 3
The problem simply vanished. See my answer below.
#gingerlime I had a similar situation with our Jenkins on GCP, we're using ChefDK 3.1.0 (ruby embeed 2.5.1p57) -- tried other also, over a Jenkins that was running over systemd (Ubuntu 16.04) and upstart (Ubuntu 14.04) -- we tried on both versions, right now running over 16.04 in 4.15.0-1023-gcp kernel version, running a few jobs with kitchen-docker and this problem always emerge in a few situations.
I digged into and found that this only happens when the Etc.getlogin class gets called (for me here), this doesn't return any error, it return the correct info, the correct type of the class (String), but once it gets a call, the Unsupported digest algorithm gets raised.
If I start the process manually by root or jenkins user, this problem doesn't happen. I tried to implement the Etc.getlogin in several different ways, like using ENV['USER'], a fixed String, or other classes from Etc, like getpwuid, simulating the return class and values from Etc.getlogin, and the error doesn't get raised.
I'm not sure if this is some bug related to the ruby version and the custom kernel that GCP instances uses, but it happens in a similar situation like yours, and for me, the Etc.getlogin was the problem. Right now, I fixed by using a custom configuration that doesn't gets the call from this function, and it's working normally.
One option is that this isn't an issue of sysVinit vs systemd at all, but you just haven't triggered the issue with your sysVinit script yet.
When you run your svsVinit script through the systemctl command it's going through a compatibility layer, and there may be a problem there. Your problem would be simplified both yourself and for us if you reproduced the issue directly with a systemd service file and shared that file.
You mentioned debugging ENV, but didn't mention exactly what you checked in the ENV. This is definitely one place where systemd could make a difference. As seen in man systemd.exec, systemd sets $PATH in the environment to a fixed value:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
If this is not exactly the same as when run directly as an sysVinit script, that could be an issue.
I would also check for all your copies of SSL on the system. Do you have more than one? Where? Do you have more than copy of the ruby openssl module loaded?
 locate -r lib/.*libssl.*so
Also see the answer to the FAQ: Why do things behave differently under systemd?
(also posted on this github issue)
It looks like the problem just vanished. We were testing and reproducing it consistently, across several Compute Engine instances on Google Cloud. Under certain conditions (unicorn / puma started by systemd, etc), it was completely reproducible both with our own rails app, and with a plain vanilla rails app we've set for testing purposes. It was reproducible across several ruby versions as well (we tested 2.3.4, 2.3.6 and 2.5.0).
Suddenly, all instances that were consistently failing started working without exhibiting these problems. Like it never existed. We didn't even reboot some of those instances, and we saw no evidence of any unattended upgrades taking place... We also had one snapshot of a system that had this problem, and that we can reliably reproduce on. Creating an instance from this snapshot stopped exhibiting it as well from that specific point in time a few hours ago.
We're totally confused as to what might have cause it, and what might have made it disappear... However, without being able to reproduce it now, I guess there's no point leaving this issue open, so will close it. Chalk it up to Deus ex machina I suppose. (perhaps the google support gods, but they haven't reported anything back to us yet)

enable ldap module in laravel homestead

Currently have an issue where i can not enable the ldap module in homestead. I have changed multiple php.ini files and still nothing seems to be working. Has anyone else had issues with enabling modules in homestead?
Side note: when trying to restart php-fpm i am getting a permission denied issue. They prompt me with a password (which i have tried "secret") but still cant seem to get that to work either.
Have restarted the homestead instance multiple times as well. no prevail.
any thoughts?
Citti
I think this question deserves its own answer as it's pretty easy to install the wrong version of ldap on homestead and not know why things aren't working.
TL;DR: Match the version of ldap to the version of php you're running & install with apt-get.
For example, running homestead v.6.1.0:
cd HOMESTEADFOLDER # on your host
vagrant ssh # access the guest machine
sudo apt-get update # update apt-get package list
sudo apt-get install php7.1-ldap # or whatever version
In my example above, if you switch out php7.1-ldap for php7.0-ldap everything appears to install correctly (it does in fact install correctly) but, in reality, you've installed the module to a version of php that's not actually running. It took me several attempts at rebooting FPM to figure out this is what I had done.
Side note: apt-get will restart php and reload modules so there's no need to try and reboot the server or mess about with .ini files.
While ssh-ed in to the guest machine, you can check that the package is installed with php -m
If ldap is a thing your project needs, it's probably a better idea to handle this in a script. The answer referenced by fh-jashmore in his comment above comment has a simple but solid example: How to automatically enable php extensions in Homestead on vagrant up

Run window manager with chromium and go through proxy server on RPI

I am using Raspberry pi(s) for workstations in an office setup. I want the users to have access to the intranet and a couple of websites. I have a proxy set up with whitelist that works fine.
I want to boot the RPI and show only a web browser and connect through the proxy. I understand I need a window manager for this.
I have been experimenting with chromium (as it makes it very easy to insert the proxy address as an attribute when opening chromium via command line). The problem is, Chromium is a demanding browser and struggles with JQuery on the RPI.
I am looking for a browser I can run through a proxy, in a window manager from a start up script that won't be slow as hell!
Does this exist? Or am I going down the wrong path for this?
I don't know if this is really what you want but here is one way to boot directly into a web-browser:
1. Make sure you use a Raspberry with the latest version of raspbian installed and updated:
sudo apt-get update
sudo apt-get upgrade
2. If you don't want to use Midori, install the browser you want. I prefer chromium (Light version of Google Chrome) so that's what I will use here. To install chromium run the following command:
sudo apt-get install chromium
3. Configure raspi-config to start in GUI mode:
sudo raspi-config -> Enable boot to desktop/Scratch -> Desktop login as....
4. To start chromium on boot, comment all existing code in the file and add the following last:
sudo nano /etc/xdg/lxsession/LXDE/autostart
#xset s off
#xset -dpms
#xset s noblank
#chromium
On the last line you can also add switches like kiosk mode (--kiosk) after #chromium. Watch this link for more switches:
List of commandline switches
Hope this was any help! Good luck!

Resources