I am new for docker and consul. I have created the 4 instances in AWS. I have added the use of the following instance.
First Instance - Server 1
Second Instance - Server 2
Third Instance - Server 3
Fourth Instance - Server 4
This instance having the ubuntu 18.04 OS. I am trying to implement an auto-discovery concept using consul.
I have done the following steps.
I have installed the docker in my four instances using the below link https://docs.docker.com/install/linux/docker-ce/ubuntu/
And pulling the consul image using the below link
https://hub.docker.com/_/consul?tab=description
I have checked on 'Running Consul for Development'. Its working fine for all the instances.
Server 1:
I am trying to run on consul agent in client mode. It's showing below error.
sudo docker run -d --net=host -e 'CONSUL_LOCAL_CONFIG={"leave_on_terminate": true}' consul agent -bind=<external ip> -retry-join=<root agent ip>
external ip - I have given on server1 private IP.
root agent ip - I have given on bootstrap server private IP.
Output:
I got the 64 letter key. EG:
b93b160ef52b9203d67bb6db27793963dc419276145f4c247c9ba4e2bd6deb03
But that reference sites having a different response.
dig #bootstrap_server_private_ip -p 8600 consul.service.consul
It's showing on connection timed out an error.connection timed out error
Related
We have two AWS EC2 instances and from the first server using PHP I am making a request to the second server like this: file_get_contents('https://somedomain.com/api/feed/obj/1234'). It tries to connect but just hangs.
Using wget in the terminal I get:
$ wget -dv https://somedomain.com/api/feed/obj/1234
Setting --verbose (verbose) to 1
DEBUG output created by Wget 1.17.1 on linux-gnu.
Reading HSTS entries from /home/abc/.wget-hsts
URI encoding = 'ANSI_X3.4-1968'
converted 'https://somedomain.com/api/feed/obj/1234' (ANSI_X3.4-1968) -> 'https://somedomain.com/api/feed/obj/1234' (UTF-8)
--2021-06-01 11:08:01-- https://somedomain.com/api/feed/obj/1234
Resolving somedomain.com (somedomain.com)... vv.xx.yy.zz
Caching somedomain.com => vv.xx.yy.zz
Connecting to somedomain.com (somedomain.com)|vv.xx.yy.zz|:443...
I guess it has something to do with internal/external ip's.
I recently installed laravel envoy task runner, when I try to run a task with command envoy run deploy I get the following error:
GabotronES#gabriel-ubuntu-1:/var/www/dtcburger.es$ envoy run deploy
Are you sure you want to run the [echo] task? [y/N]: y
[GabotronES:206.189.X.XX]: ssh: Could not resolve hostname gabotrones:206.189.X.XX: Name or service not known
[✗] This task did not complete successfully on one of your servers.
It says it can't resolve hostname gabotrones but my ubuntu user is GabotronES, in my Envoy.blade.php I have also user GabotronES in #servers directive, is this because envoy doesn't allow username with capitals to connect via ssh?
#servers(['web' => 'GabotronES:206.189.X.XX'])
*censored my IP just in case
I don't think the capitals are the issue.
Please try this syntax:
#servers(['web' => 'GabotronES#206.189.X.XX'])
You can also try to connect directly from the command line, to check if things work as expected.
i call my api with following port:
http://IPv4 Public IP:8000/login
and i pull code through docker compose up. this will will give me all project configuration with php 7.1.8
php artisan serve
command will start successfully on 127.0.0.1:8000 this port.
but i use AWS EC2(ubuntu 16.04) instance. so, i call API "IPv4 Public IP:8000/login" in postman.
but it's give me an error:
could not get any response
there was an error connecting to IPv4 Public IP:8000/login
if you are using docker container it will allocate a port in your runing image
eg: your image is runing on 0.0.0.81
so you can set security group as "custom TCP rule" in 81 port
and it's runing
and your API call are runing like
http://youIp:81/api
I am trying to wrap my head around Docker. For me there are still grey areas, which I have tried to research on the internet.
I'm trying to setup a Docker for an existing Laravel application.
I use Laradock (laradock/laradock) from GitHub (it's like Homestead but for Docker).
I use command like this:
docker-compose up -d nginx mysql
If I use docker ps command, I would be able to see the running containers for both MySQL and Nginx and maybe some others.
How can I take an image of docker-compose?
I have tried this
docker commit [container-id] username/reponame
An image does get created, but it's incomplete image. As I am running a whole application with MySQL, Nginx, etc..
How to take image of whole and deploy it to Docker?
All I want is that I can deploy an existing project that is using multiple containers in local to the Docker container on docker.com.
I'm using Docker on Windows 10.
Update
Here is the single node i have, currently I am on free plan with docker.com and microsoft.com.
The Node with Azure Microsoft:
The Container of Laravel:
The repository on Docker I am using on container:
and finally the image link as my repository image is public:
https://hub.docker.com/r/pakistanihaider/pakistanihaider.me/
Now for some reason the image I created and I pushed to Docker is not working and site is not going live, even on localhost when I create image and I try to run image it doesn't work. But when I try docker-compose up -d command, everything works perfectly.
The logs I have online for my service
[pakistanihaider-1]2017-01-02T17:56:56.794183200Z /usr/lib/python2.7/dist-packages/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
[pakistanihaider-1]2017-01-02T17:56:56.794218000Z 'Supervisord is running as root and it is searching '
[pakistanihaider-1]2017-01-02T17:56:56.923437200Z 2017-01-02 17:56:56,923 CRIT Supervisor running as root (no user in config file)
[pakistanihaider-1]2017-01-02T17:56:56.923533400Z 2017-01-02 17:56:56,923 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
[pakistanihaider-1]2017-01-02T17:56:56.958072800Z 2017-01-02 17:56:56,957 INFO RPC interface 'supervisor' initialized
[pakistanihaider-1]2017-01-02T17:56:56.958969800Z 2017-01-02 17:56:56,958 CRIT Server 'unix_http_server' running without any HTTP authentication checking
[pakistanihaider-1]2017-01-02T17:56:56.960595100Z 2017-01-02 17:56:56,960 INFO supervisord started with pid 1
[pakistanihaider-1]2017-01-02T17:56:57.968087400Z 2017-01-02 17:56:57,967 INFO spawned: 'nginx' with pid 7
[pakistanihaider-1]2017-01-02T17:56:57.970004700Z 2017-01-02 17:56:57,969 INFO spawned: 'hhvm-fastcgi' with pid 8
[pakistanihaider-1]2017-01-02T17:56:57.971064400Z 2017-01-02 17:56:57,970 INFO spawned: 'php5-fpm' with pid 9
[pakistanihaider-1]2017-01-02T17:56:59.547596700Z 2017-01-02 17:56:59,542 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[pakistanihaider-1]2017-01-02T17:56:59.547617600Z 2017-01-02 17:56:59,542 INFO success: hhvm-fastcgi entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[pakistanihaider-1]2017-01-02T17:56:59.547623400Z 2017-01-02 17:56:59,543 INFO success: php5-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
What is going wrong here?
I hope someone can help me out with this issue I'm facing.
I've made a fully functional project on a local server and would now like to deploy it to Bluemix Cloud Foundry.
I've followed the tutorial: https://console.eu-gb.bluemix.net/docs/starters/upload_app.html
But when I'm trying to push it through terminal with following commands
cf push app_name -b https://github.com/cloudfoundry/php-buildpack.git -s cflinuxfs2
cf push app_name -b https://github.com/cloudfoundry/go-buildpack
cf push app_name -c start_command
cf push app_name -m 512m
But non seems to work, since every single time I get the following error
Staging failed: Buildpack compilation step failed
-----> Composer command failed
FAILED
Error restarting application: BuildpackCompileFailed
It is a PHP app build with PHPStorm on Symfony and Doctrine if that matters.
I am fairly new to all server/setup/deployment configurations as well as command line.
EDIT 1
I figured out this part thanks to this link: https://support.run.pivotal.io/entries/109600943-cf-push-ing-a-symfony-app-fails-with-Composer-command-failed-
It seems that by default the buildpack assumes that you want all of the files you push to be public. Because of this assumption, it takes all of your files and moves them into the doc root of either HTTPD or Nginx.
By creating the file .bp-config/options.json in the root of your project. Then inside options.json add
{
"WEBDIR": "web"
}
This will tell the buildpack that you have a specific directory to use for the doc root, so it will just use that instead of moving everything into the default doc root.
However...
This brings me a new issue and returns the following error
FAILED
Error restarting application: Start unsuccessful
If i enter the recent log the terminal provides me this:
2016-08-25T02:53:40.62+0200 [App/0] OUT Could not open input file: app.php
2016-08-25T02:53:40.62+0200 [App/0] ERR
2016-08-25T02:53:40.69+0200 [DEA/211] ERR Instance (index 0) failed to start accepting connections
2016-08-25T02:53:40.72+0200 [API/9] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"b6c3c871-5484-4f12-9d84-657cf6eacfbf", "instance"=>"c11566bdabe5458d9bfc4965c9c1aa85", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472086420}
2016-08-25T02:53:40.72+0200 [API/3] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"b6c3c871-5484-4f12-9d84-657cf6eacfbf", "instance"=>"c11566bdabe5458d9bfc4965c9c1aa85", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472086420}
2016-08-24T16:41:14.03+0200 [DEA/135] OUT Starting app instance (index 0) with guid abb206b3-b8ea-4269-b248-ec7b35f7098a
2016-08-24T16:41:26.26+0200 [App/0] ERR bash: start_command: command not found
2016-08-24T16:41:26.26+0200 [App/0] OUT
2016-08-24T16:41:26.35+0200 [DEA/135] ERR Instance (index 0) failed to start accepting connections
2016-08-24T16:41:26.38+0200 [API/6] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"5ebd6d77-68c4-4901-b9a8-b5cecfa4cddb", "instance"=>"7b5b555ae68645f4a2c09b73c0adbcb3", "index"=>0, "reason"=>"CRASHED", "exit_status"=>127, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472049686}
EDIT 2 (updated error msg)