I want to add network proxy function (OD-1807)
Meng Sen opened 2 years ago

Due to network conditions, access to some warehouse sites requires proxy access. I tried to add the proxy configuration to the environment variable, but just for the container, OneDev still doesn't recognize the proxy properly.

docker exec -it onedev /bin/bash
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

I hope to add network agent configuration options to the system settings. Or whether there is a temporary solution. Thanks.

  • Meng Sen commented 2 years ago

    This is my configuration file for launching OneDev.

    version: '3'
    
    networks:
      1panel-network:
        external: true
    
    services:
      onedev:
        image: 1dev/server:10.3.2
        container_name: ${CONTAINER_NAME}
        restart: always
        networks:
          - 1panel-network
        ports:
          - "${PANEL_APP_PORT_HTTP}:6610"
          - "${PANEL_APP_PORT_SSH}:6611"
        volumes:
          - ${ONEDEV_ROOT_PATH}/data:/opt/onedev
          - /var/run/docker.sock:/var/run/docker.sock
        env_file:
          - .env
        environment:
          - initial_user=${INITIAL_USER}
          - initial_password=${INITIAL_PASSWORD}
          - initial_email=${INITIAL_EMAIL}
          - initial_server_url=${INITIAL_SERVER_URL}
          - initial_ssh_root_url=${INITIAL_SSH_ROOT_URL}
        labels:
          createdBy: "Apps"
    
    

    I have tried adding a proxy configuration to the environment configuration.

    version: '3'
    
    networks:
      1panel-network:
        external: true
    
    services:
      onedev:
        image: 1dev/server:10.3.2
        container_name: ${CONTAINER_NAME}
        restart: always
        networks:
          - 1panel-network
        ports:
          - "${PANEL_APP_PORT_HTTP}:6610"
          - "${PANEL_APP_PORT_SSH}:6611"
        volumes:
          - ${ONEDEV_ROOT_PATH}/data:/opt/onedev
          - /var/run/docker.sock:/var/run/docker.sock
        env_file:
          - .env
        environment:
          - initial_user=${INITIAL_USER}
          - initial_password=${INITIAL_PASSWORD}
          - initial_email=${INITIAL_EMAIL}
          - initial_server_url=${INITIAL_SERVER_URL}
          - initial_ssh_root_url=${INITIAL_SSH_ROOT_URL}
          - http_proxy=http://127.0.0.1:7890
          - https_proxy=http://127.0.0.1:7890
          - no_proxy=127.0.0.1,localhost
        labels:
          createdBy: "Apps"
    

    The result is still that it has no effect on the OneDev program

  • Robin Shen commented 2 years ago

    Please edit "${ONEDEV_ROOT_PATH}/data/conf/wrapper.conf" to add below lines:

    wrapper.java.additional.2=-Dhttp.proxyHost=127.0.0.1 
    wrapper.java.additional.3=-Dhttp.proxyPort=7890 
    wrapper.java.additional.4=-Dhttp.proxysHost=127.0.0.1 
    wrapper.java.additional.5=-Dhttp.proxysPort=7890 
    
  • Robin Shen commented 2 years ago

    Sorry ought to be:

    wrapper.java.additional.2=-Dhttp.proxyHost=127.0.0.1 
    wrapper.java.additional.3=-Dhttp.proxyPort=7890 
    wrapper.java.additional.4=-Dhttps.proxyHost=127.0.0.1 
    wrapper.java.additional.5=-Dhttps.proxyPort=7890 
    
    
  • Robin Shen changed state to 'Closed' 2 years ago
    Previous Value Current Value
    Open
    Closed
issue 1/1
Type
Question
Priority
Major
Assignee
Labels
No labels
Issue Votes (1)
Watchers (3)
Reference
OD-1807
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover