Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Support aliases for default pipeline network: pipeline_default #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dolanor
Copy link

@dolanor dolanor commented Jul 7, 2017

Hello,
as discussed in gitter, here is my PR for having network aliases working in the default network (which is pipeline_default currently).

As asked, I also tried the sample_7 with redis to check it didn't fail. It seems it passes.
Proof:

dolanor@moondark:~/.local/gopath/src/github.com/cncd/pipeline$ pipec compile  --repo-remote-url https://github.com/drone/envsubst --commit-sha 4e8a9e59868d6a1cbaaaa41b2cd724b8ac3dc506 --commit-ref refs/heads/master  --commit-branch master --in samples/sample_7_redis/pipeline.yml --out redis.json
Successfully compiled samples/sample_7_redis/pipeline.yml to redis.json
dolanor@moondark:~/.local/gopath/src/github.com/cncd/pipeline$ vi redis.json 
dolanor@moondark:~/.local/gopath/src/github.com/cncd/pipeline$ pipec exec --in redis.json
proc "pipeline_clone" started
+ git init
Initialized empty Git repository in /go/src/github.com/drone/envsubst/.git/
+ git remote add origin https://github.com/drone/envsubst
+ git fetch --no-tags origin +refs/heads/master:
From https://github.com/drone/envsubst
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
+ git reset --hard -q 4e8a9e59868d6a1cbaaaa41b2cd724b8ac3dc506
+ git submodule update --init --recursive
proc "pipeline_clone" exited with status 0
proc "pipeline_services_1" started
proc "pipeline_services_0" started
1:C 07 Jul 18:21:56.882 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

1:M 07 Jul 18:21:56.885 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 07 Jul 18:21:56.885 # Server started, Redis version 3.0.7
1:M 07 Jul 18:21:56.885 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 07 Jul 18:21:56.885 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 07 Jul 18:21:56.885 * The server is now ready to accept connections on port 6379
proc "pipeline_step_0" started
1:C 07 Jul 18:21:57.851 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

1:M 07 Jul 18:21:57.853 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 07 Jul 18:21:57.853 # Server started, Redis version 3.0.7
1:M 07 Jul 18:21:57.853 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 07 Jul 18:21:57.853 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 07 Jul 18:21:57.853 * The server is now ready to accept connections on port 6379
+ sleep 1
+ redis-cli -h redis1 ping
PONG
+ redis-cli -h redis2 ping
PONG
+ redis-cli -h redis1 set HELLO hello
OK
+ redis-cli -h redis2 set HELLO hola
OK
+ redis-cli -h redis1 get HELLO
hello
+ redis-cli -h redis2 get HELLO
hola
proc "pipeline_step_0" exited with status 0

Have I forgotten anything else? (btw, is it the right way to test pipec? There is no automated test yet?)

the default network for pipeline is named by a random ID when launched
by drone. We need a stable name that is going through all drone
execution.
@dolanor
Copy link
Author

dolanor commented Sep 19, 2017

Hi,
I rebased on master and changed the way the aliases can be setup. Now it uses the network default.
My previous version worked with pipeline itself, but wouldn't work with drone as it would generate a *_default network with random name for each run.

I've been using it on a project, and so far, it has been working great. However, you need to make the service privileged to access the network.

I tested the sample 7, and I got the same output as before. So it seems ok.

How you use it in the .drone.yml goes like that:

services:
  web:
    image: nginx:latest
    privileged: true
    networks:
      default:
        aliases:
          - myown.alias.com
          - subservice.alias.com

@dolanor
Copy link
Author

dolanor commented Oct 4, 2017

Hi,
Is there anything I can do to make this PR mergeable? I'd love to not have to fork drone to have this capability. But I understand that dev time bandwidth is limited.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant