I'm running Ionic in a docker container.
When I start ionic serve I can access the Testserver from my host machine with localhost:8100.
When I start ionic serve -l it is not possible to access the lab from my host with localhost:8200
The test server outputs
Lab: http://localhost:8200
Local: http://localhost:8100
External: http://172.22.0.9:8100
DevApp: my_app#8100 on 520710a333bb
So the lab is only started on localhost, and can not be accessed from the host. How it is possible to access the Lab from the host?
need change lab-host
ionic serve -l --lab-host=0.0.0.0 --lab-port=8200
Related
I have installed and uninstalled and reinstalled GCloud on MACOS Monterey (Chipset M1) and I'm facing the next situation: When I run in Terminal gcloud auth login, it displays the next message:
WARNING: Failed to start a local webserver listening on any port between 8085 and 8184. Please check your firewall settings or locally running programs that may be blocking or using those ports.
WARNING: Defaulting to --no-browser mode.
You are authorizing gcloud CLI without access to a web browser. Please run the following command on a machine with a web browser and copy its output back here. Make sure the installed gcloud version is 372.0.0 or newer.
I have tried in many ways to install: The last one was this:
curl https://sdk.cloud.google.com | bash
exec -l $SHELL #restart shell
But I still facing that message.
Anybody couls help me with this?
This happens because my Internet provider has blocked these ports. There will be to make some fixes to the router.
Patch solution for this:
gcloud auth login --no-launch-browser
Follow the instructions given on Terminal
first I would like to thank you for been here! I hope you doing well!
So... I'm trying to create an Ubuntu:20.04 container on Google Cloud Run or Kubernetes..
Whenever I try to deploy this Dockerfile on Google Cloud Run
FROM ubuntu:20.04
RUN apt-get update
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
It fails, and shows an error:
The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable
Apparently, this happens due to lack of a webserver inside the container?
To fix this, I followed this guideline by Google itself.
So, basically, inside the Dockerfile, I just added couple of code lines:
It just installs python, flask and gunicorn and set default to automatically run app.py when container is created.
FROM ubuntu:20.04
RUN apt-get update
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
RUN apt-get install -y python3 && apt-get install -y pip && pip install Flask gunicorn
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app
Also, I created a new file "app.py" that import Flask.
Its just a simple webserver...
# Python run this file, and when someone send a request to this Ubuntu:20.04 container ip on port 8080
# a simple text is showed "Hello World".
import os
from flask import Flask
app = Flask(__name__)
#app.route('/')
def hello_world():
target = os.environ.get('TARGET', 'World')
return 'Hello {}!\n'.format(target)
if __name__ == "__main__":
app.run(debug=True,host='0.0.0.0',port=int(os.environ.get('PORT', 8080)))
And boom... It works!! We have Ubuntu:20.04 running on Google Cloud Run... the error was fixed!
So, Google Cloud Run works like:
if there's a webserver running on that port:
then GCR LAUNCH CONTAINER
if there's NO webserver running on that port:
GCR DOESN'T launch container...
IN RESUME:
I just want to run a python code on ubuntu container.
just like I run in my local machine, that works perfectly.
also this python code doesn't use flask or any webservice, it runs independently, make some compute works and comunicate through an external database.
So, my question is, how to deploy a container image that doesn't host a web service, on Google Cloud Run or Kubernetes, just like I create on my local machine and acess through /bin/bash CLI...???
So, my question is, how to deploy a container image that doesn't host a web service, on Google Cloud Run or Kubernetes, just like I create on my local machine and access through /bin/bash CLI...???
There might be a misunderstanding of the Google services here.
Google Cloud Run
Runs your web application (a web server) in a container. It is not a service for other things than web applications (e.g. only http).
Key features: Keeps your server up and running, and can scale out to multiple instances.
Google Kubernetes Engine
Runs services (processes that starts and then are meant to stay running) in containers, both stateless, as Deployment and stateful as StatefulSet. Also support for jobs that is tasks that perform something and then terminates.
Key features: Keeps your server up and running, and can scale out to multiple instances. Can re-run Jobs that failed.
Google Compute Engine
If no one of the above fits your needs, you can always go low level and run and maintain virtual machines with e.g. Linux and containers on it.
I am using Flutter Web and want to setup the development server for multiple devices.
I'm currently running the server like this:
flutter run -d web-server --web-port 5000
This works for http://localhost:5000 but when I try to access the server from http://127.0.0.1:5000/ even on the same machine it doesn't work.
How can make the server accessible from any device under the same network without building the app?
NEW ANSWER
Cloudflare should enable you to make a tunnel to your localhost.
On linux you can:
Install Cloudflare
Create a tunnel which point to localhost:5000 with cloudflared tunnel --url http://localhost:5000/
Use the given address to access your local development website from anywhere
Note that this is still slow. I would say it's good enough if you need to check on other devices once in a while but not if you want to develop like you would with hot reload.
OLD ANSWER (This seem to be really slow for an unknown reason)
You should look into something like ngrok.
On linux you can:
Install ngrok: sudo apt install ngrok
Create a tunnel which point to localhost:5000 with ngrok http 5000
Use the given address to access your local development website from anywhere
You need to add --web-hostname 0.0.0.0;
flutter run -d web-server --web-hostname 0.0.0.0 --web-port 5000
This tells it to listen on all addresses.
For me hostname 0.0.0.0 does not work (it works with PHP but not for Flutter)
flutter run -d web-server --web-hostname 0.0.0.0 --web-port 5000
It works when using actual local IP number of my machine
I have a development environment using docker-compose, it has 5 services:
db (postrgresql)
redis
celery
celery-beat
web (a django web app - development is occurring here)
In development, I run the top four in containers with
docker-compose up db redis celery celery-beat
These four containers can connect to each other no problem.
However, while I code with the web app, I need to run it locally so I can get live updates and debug. However, running locally, the web app can't connect with the containers, and I need to map the ports on the containers, e.g:
db:
ports:
- 5432:5432
so that my locally running web app can connect with them.
However, if I then push my code to github, TravisCI fails it with this error:
ERROR: for db Cannot start service db: b'driver failed programming external connectivity on endpoint hackerspace_db_1 (493e7fb9e53f551b3b1eea35f9e2baf5725e9077fc642d8121891cab31b34373): Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use'
ERROR: Encountered errors while bringing up the project.
The command "docker-compose run web sh -c "python src/manage.py test src/"" exited with 1.
TravisCI passes without the port mapping, but I have to develop with port mapping.
How can I get around this so that they both work with the same settings? I'm willing to try different workflows, as I'm new to docker and containers and trying to find my way around.
I've tried:
Developing in a container with Visual Studio Code's Remote - Containers extension, but there doesn't seem to be a way to view the debug log/output
Finding a parameter to add to the docker-compose up ... that would map the ports when I run them, but there doesn't seem to be an option for this.
I have downloaded Hortonworks Sandbox (IP: 192.179.144.XXX) on my Windows 10 laptop. I have the HDP Sandbox running on VMWare.
Below is my sandbox information:
Created on: 19_04_2017_19_09_16 for
Hadoop stack version: Hadoop 2.7.3.2.6.0.3-8
Ambari Version: 2.5.0.5-1
Ambari Hash: 0b5e975972e7a0b265e87b2e38eefde9039ef44c
Ambari build: Release : 1
Java version: 1.8.0_121
OS Version: CentOS release 6.9 (Final)</code>
My goal is to be able to connect to Kafka (HDP Sandbox) from Java IntelliJ SDK based out of my Windows host machine.
So far, I have tried the following in order to be able to access HDP Kafka from my host machine via Java and/or Kafka tool 1.0, but been unsuccessful.
Updated the Network-Atapter to 'Host Only' in my VMware settings.
Opened, Kafka broker, port number 6667 by adding the port number to the 'start_sandbox.sh' file. Leveraged the following article: http://tlxu.blogspot.com/2016/12/add-ports-mapping-to-hdp-25-vmware.html
2.1 Below are the steps taken to "open" the port 6667 -
2.1.1) login to the Sandbox VM (actual docker container)
2.1.2) Disable sandbox.service: $ systemctl disable sandbox.service
2.1.3) Reboot the VM: $ init 6
2.1.4) Modify sandbox start script: $ vi /root/start_scripts/start_sandbox.sh
2.1.5) Added "-p 6667:6667 \" after "-p 2222:22 \"
2.1.6) save and exit.
2.1.7) Delete existing sandbox container: $ docker rm sandbox
2.1.8) Enable sandbox.service: systemctl enable sandbox.service
2.1.9) Reboot the VM: $ init 6
2.1.10) Verify new ports: $ docker ps | grep 6667
2.1.11) Received the following output - 0.0.0.0:6667->6667/tcp
However, when I open chrome on my laptop and try to connect to: http://192.179.144.XXX:6667, I receive the following error:
This site can’t be reached The webpage at http://192.179.144.XXX:6667/ might be temporarily down or it may have moved permanently to a web address. ERR_UNSAFE_PORT
I also tried 'logging' and 'telnetting' on the sandbox using "Putty" with following credentials: root#192.179.144.XXX and port: 6667. I receive the following error:
Network Error: software caused connection abort
Within the sandbox I ran the following command to check if the port is open inside the sandbox. I don't know what the output means, though.
[root#sandbox ~]# netstat -tnlpa | grep 6667
[root#sandbox ~]#
Kafka properties in "Kafka Broker" section in Ambari has the following properties:
Kafka broker host: sandbox.hortonworks.com
zookeeper.connect: sandbox.hortonworks.com:2181
listeners: PLAINTEXT://localhost:6667
(Please note: I also tried changing 'localhost' to '0.0.0.0', and my kafka-console-consumer and kafka-console-produer failed. Received "LEADER_NOT_AVAILABLE" error.)
Within Kafka properties in Ambari, I logged in as an Admin and added the following properties to the "Custom Kafka-broker"
advertised.port=6667
advertised.listeners=PLAINTEXT://sandbox.hortonworks.com:6667
advertised.host.name=192.179.144.XXX
I am unable to move forward, and I would really appreciate if anyone could help out on:
1.) Is my port open? If not, how else can I open the port?
2.) Any additional changes I need to make with Kafka settings, that would let the Java IDE on my Windows to connect to Kafka (dependent on issue #1)?
Kafka is not an HTTP service. Chrome, or browser, will not connect.
Kafka is not an SSH program. Putty, or other, will be connect.
You need to verify connection using kafka-console-* tools from windows
listeners: PLAINTEXT://localhost:6667
Should be the following for Kafka to listen externally of the sandbox
listeners: PLAINTEXT://:6667
Then, I don't know about Host Only or NAT settings, but you shouldn't need to touch those if you setup port forwarding in the VM settings.
advertised.host.name
Should not need to be changed in Ambari, but if you did, then set it to the sandbox hostname
If you don't need Hadoop and all the other stuff in HDP, I suggest getting the HDF sandbox, or just using Docker for Windows and using the Kafka containers on DockerHub