Ctrl + ↑ Later
curl -H 'Host:stage.it-premium.com.ua' https://192.168.150.62

where Host is your host and 192.168.150.62 is your nginx server.

For coreos that's enough to use something like this

docker run -d \
  -v /home/core/certificates:/etc/nginx/certs:rw \
  --volumes-from nginx-proxy \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  jrcs/letsencrypt-nginx-proxy-companion

docker run -d -p 80:80 -p 443:443 \
  --name nginx-proxy \
  -v /home/core/certificates:/etc/nginx/certs:ro \
  -v /etc/nginx/vhost.d \
  -v /usr/share/nginx/html \
  -v /var/run/docker.sock:/tmp/docker.sock:ro \
  -v /home/core/conf.d/external.conf:/etc/nginx/conf.d/external.conf  \
  --restart always \
  jwilder/nginx-proxy

and then not to forget to specify

LETSENCRYPT_HOST=mydomain.com
LETSENCRYPT_EMAIL=my@email.com

in your docker-compose section.

More is here https://hub.docker.com/r/mickaelperrin/docker-letsencrypt-nginx-proxy-companion/

I struggled with deploying web services via Ansible to staging CoreOS host and that's something that looks like a hell!

I received one error, then another with just simple-simple steps like

- name: IT-Premium docker-compose deploy
  hosts: coreos
  tasks:
    - name: Install docker-py
      pip: name=docker-py executable=/home/core/bin/pip

    - name: Install PyYAML
      pip: name=PyYAML executable=/home/core/bin/pip

    - name: Install docker-compose
      pip: name=docker-compose executable=/home/core/bin/pip version=1.9.0

    - name: Creates it-premium directory
      file: path=/home/core/it-premium state=directory

    - name: copy docker-compose.yml
      copy: src=./docker-compose.yml dest=/home/core/it-premium/docker-compose.yml
      tags: deploy

    - name: copy sqlite
      copy: src=./sqlite dest=/home/core/it-premium/ mode=0644
      tags: deploy

    - name: docker registry login
      docker_login:
        registry: "registry.it-expert.com.ua"
        username: nexus
        password: "{{gitlab_password}}"

    - name: pull images
      docker_image:
        name: registry.it-expert.com.ua/nexus/it-premium
        state: present

    - name: launch it-premium docker-compose with 2 containers
      tags: step1
      docker_service:
        project_src: it-premium
        state: present
        build: no
      register: output

    - debug:
        var: output

You can notice version of docker-compose 1.9.0, which is supplied there. That's because of issue with
Error: cannot import name 'IPAMConfig'
thrown by docker_service.

And here is why https://github.com/ansible/ansible/issues/20492

This is due to your docker-compose version.
The docker-py package has been renamed into docker in version 2.0 (https://github.com/docker/docker-py/releases/tag/2.0.0). And in this version, Docker.Client has been renamed into docker.APIClient.
Docker-compose 1.10+ now requires docker instead of docker-py. And due to his name the docker package is before the docker-py one in the PYTHONPATH leading to the import error.
A workaround is to downgrade your docker-compose version to 1.9.0 the time the Ansible docker_container module updates its dependencies from docker-py to docker.

That's something like «piss on you, dirty user, because we do not care about backward compatibility».

Because when you change something, it is like delete old state and introduce new one instead. And when you delete something, that could broke anything that relies on state.

How to do instead? Just ADD something new without removal. Call it with new namespace, new function name and just use!

Shut down and reboot the system:

$ systemctl reboot

Shut down and power-off the system:

$ systemctl poweroff

When your site did not work properly in docker do following:

  1. Check is nginx container running
docker ps -a
3fbec7a5431f        jwilder/nginx-proxy                                "/app/docker-entrypoi"   20 hours ago        Up 7 minutes                0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   nginx-proxy
  1. Check if it has proper configuration
docker exec nginx-proxy nginx -t

You should receive

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
docker exec nginx-proxy nginx -T

this shows configuration of nginx. So, no need to bash into nginx container and do cat /etc/nginx/conf.d/default.conf. It's much faster.

  1. Check if your container and nginx container has network connection.
    If not, connect them with
docker network connect mycontainer_default nginx-proxy
  1. Check container logs
docker logs nginx-proxy -f --tail 250

That will show last 250 lines and continues to follow new data.

Short answer: *httpry* is excellent utility for HTTP debugging on Linux.

apt-get install -y httpry
httpry
root@d9fbedf5d17d:/app# httpry -i eth0
httpry version 0.1.7 -- HTTP logging and information retrieval tool
Copyright (c) 2005-2012 Jason Bittel <jason.bittel@gmail.com>
----------------------------
Hash buckets:       64
Nodes inserted:     10
Buckets in use:     10
Hash collisions:    0
Longest hash chain: 1
----------------------------
Starting capture on eth0 interface
2017-01-17 07:44:48	185.49.14.190	172.17.0.4	>	GET	testp3.pospr.waw.pl	http://testp3.pospr.waw.pl/testproxy.php	HTTP/1.1	-	-
2017-01-17 07:44:48	172.17.0.4	185.49.14.190	<	-	-	-	HTTP/1.1	503	Service Temporarily Unavailable
2017-01-17 07:45:05	95.67.19.75	172.17.0.4	>	HEAD	photo.kiev.ua	/	HTTP/1.1	-	-
2017-01-17 07:45:06	172.17.0.4	95.67.19.75	<	-	-	-	HTTP/1.1	200	OK
2017-01-17 07:45:06	95.67.19.75	172.17.0.4	>	HEAD	blog.it-premium.com.ua	/	HTTP/1.1	-	-
2017-01-17 07:45:06	172.17.0.4	172.17.0.6	>	HEAD	blog.it-premium.com.ua	/	HTTP/1.1	-	-
2017-01-17 07:45:06	172.17.0.6	172.17.0.4	<	-	-	-	HTTP/1.1	200	OK
2017-01-17 07:45:06	172.17.0.4	95.67.19.75	<	-	-	-	HTTP/1.1	200	OK
2017-01-17 07:46:35	172.17.0.4	172.17.0.2	>	GET	neovo.kiev.ua	/	HTTP/1.1	-	-
2017-01-17 07:46:35	172.17.0.2	172.17.0.4	<	-	-	-	HTTP/1.1	200	OK
2017-01-17 07:46:51	62.80.171.198	172.17.0.4	>	GET	condom.org.ua	/	HTTP/1.1	-	-
2017-01-17 07:46:51	172.17.0.4	62.80.171.198	<	-	-	-	HTTP/1.1	503	Service Temporarily Unavailable
2017-01-17 07:47:19	163.172.65.114	172.17.0.4	>	GET	photo.kiev.ua	/photo_files/75/original/5050.jpg?1458503622	HT

Source http://xmodulo.com/sniff-http-traffic-command-line-linux.html

For instance you have several small-sized dockerized websited on different servers in your internal network with webserver's IP like 192.168.0.2, 192.168.0.3, 192.168.0.4 and you would like to expose your site to public via single IP address like 95.67.123.18.

Is that possible? Sure, and you can even use great jwilder/nginx-proxy image for that.

Just create on public webserver folder /home/user/conf.d/external.conf and put there config like this

log_format vhost '$host $remote_addr - $remote_user [$time_local] '
                 '"$request" $status $body_bytes_sent '
                 '"$http_referer" "$http_user_agent"';
upstream server.it-premium.com.ua {
  server 192.168.0.2:80;
}
server {
  server_name server.it-premium.com.ua;
  listen 80;
  location / {
    proxy_pass http://server.it-premium.com.ua;
  }
  access_log /var/log/nginx/access.log vhost;
}

also launch nginx-proxy container with extra arguments

-v /home/user/conf.d/external.conf:/etc/nginx/conf.d/external.conf

that will connect single config file to nginx config folder and will read configuration from there.
Beware, in case you change manually external.conf you'll need to restart your nginx container, because docker will treat your file as invalid.

Meet https://sogo.nu/

Really nice looking mail and address book and calendars.

Ctrl + ↓ Earlier