From d464139d3415b5d419baf85c75b5c996c733f80b Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Wed, 1 Mar 2017 17:28:03 -0600 Subject: [PATCH] Move craton to a non-conflicting port This change moves craton to a port that is not in use according to /etc/services and is not being consumed by any other OpenStack service as defined here: [ https://docs.openstack.org/newton/config-reference/firewalls-default-ports.html ]. This should allow other deployers to leverage craton in an way that does not conflict with other OpenStack services already running in production. Change-Id: I2d0432b4c608cf11538d7b8f267eaf7be763204c Signed-off-by: Kevin Carter --- Dockerfile | 8 ++++---- craton/tests/functional/__init__.py | 4 ++-- doc/source/cells.rst | 8 ++++---- doc/source/dev/install.rst | 8 ++++---- doc/source/docker-install.rst | 4 ++-- doc/source/hosts.rst | 8 ++++---- doc/source/network-devices.rst | 8 ++++---- doc/source/regions.rst | 8 ++++---- etc/craton-api-conf.sample | 2 +- tools/cratonclient_with_keystone.py | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index 366e3eb..6df71ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,9 @@ ############################################################################ # Usage: # docker build --pull -t craton-api:latest . -# docker run -t --name craton-api -p 127.0.0.1:8080:8080 -d craton-api:latest -# python tools/generate_fake_data.py --url http://127.0.0.1:8080/v1 --user demo --project b9f10eca66ac4c279c139d01e65f96b4 --key demo -# curl http://127.0.0.1:8080/v1/regions -H "Content-Type: application/json" -H "X-Auth-Token: demo" -H "X-Auth-User: demo" -H "X-Auth-Project: b9f10eca66ac4c279c139d01e65f96b4" +# docker run -t --name craton-api -p 127.0.0.1:7780:7780 -d craton-api:latest +# python tools/generate_fake_data.py --url http://127.0.0.1:7780/v1 --user demo --project b9f10eca66ac4c279c139d01e65f96b4 --key demo +# curl http://127.0.0.1:7780/v1/regions -H "Content-Type: application/json" -H "X-Auth-Token: demo" -H "X-Auth-User: demo" -H "X-Auth-Project: b9f10eca66ac4c279c139d01e65f96b4" ############################################################################# # Get Ubuntu base image @@ -53,7 +53,7 @@ RUN apt-get install -y libmysqlclient-dev python-mysqldb RUN pip3 install virtualenv # Expose port -EXPOSE 8080 3306 +EXPOSE 7780 3306 Add ./requirements.txt /requirements.txt diff --git a/craton/tests/functional/__init__.py b/craton/tests/functional/__init__.py index afaa2cc..ccf0260 100644 --- a/craton/tests/functional/__init__.py +++ b/craton/tests/functional/__init__.py @@ -102,7 +102,7 @@ class DockerSetup(threading.Thread): @retry(wait_fixed=1000, stop_max_attempt_number=20) def ensure_running_endpoint(container_data): service_ip = container_data['NetworkSettings']['IPAddress'] - url = 'http://{}:8080/v1'.format(service_ip) + url = 'http://{}:7780/v1'.format(service_ip) headers = {"Content-Type": "application/json"} requests.get(url, headers=headers) @@ -198,7 +198,7 @@ class TestCase(testtools.TestCase): if not self.container_setup_error: data = _container.container_data self.service_ip = data['NetworkSettings']['IPAddress'] - self.url = 'http://{}:8080'.format(self.service_ip) + self.url = 'http://{}:7780'.format(self.service_ip) self.session.headers[HEADER_PROJECT] = FAKE_DATA_GEN_PROJECT_ID self.session.headers[HEADER_USERNAME] = FAKE_DATA_GEN_USERNAME self.session.headers[HEADER_TOKEN] = FAKE_DATA_GEN_TOKEN diff --git a/doc/source/cells.rst b/doc/source/cells.rst index 029461d..5e267c1 100644 --- a/doc/source/cells.rst +++ b/doc/source/cells.rst @@ -46,7 +46,7 @@ Example Cell Create .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/cells" \ + curl -i "http://${MY_IP}:7780/v1/cells" \ -d '{"name": "myCell", "region_id": 1}' \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ @@ -126,7 +126,7 @@ Example Cell List .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/cells?region_id=1" \ + curl -i "http://${MY_IP}:7780/v1/cells?region_id=1" \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ -H "X-Auth-User: demo" \ @@ -216,7 +216,7 @@ Example Cell Update .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/cells/1" \ + curl -i "http://${MY_IP}:7780/v1/cells/1" \ -XPUT \ -d '{"name": "changedName"}' \ -H "Content-Type: application/json" \ @@ -300,7 +300,7 @@ Example Cell Update Variables .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/cells/1/variables" \ + curl -i "http://${MY_IP}:7780/v1/cells/1/variables" \ -XPUT \ -d '{"newKey": "sampleKey"}' \ -H "Content-Type: application/json" \ diff --git a/doc/source/dev/install.rst b/doc/source/dev/install.rst index a32f2b8..6b8746c 100755 --- a/doc/source/dev/install.rst +++ b/doc/source/dev/install.rst @@ -192,7 +192,7 @@ Create a Region * To create region, execute the following command:: - # curl -i "http://${MY_IP}:8080/v1/regions" \ + # curl -i "http://${MY_IP}:7780/v1/regions" \ -d '{"name": "DFW", "project_id": "717e9a216e2d44e0bc848398563bda06"}' \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ @@ -205,7 +205,7 @@ Get created Region * To get the created region, execute the following command:: - # curl -i "http://${MY_IP}:8080/v1/regions" \ + # curl -i "http://${MY_IP}:7780/v1/regions" \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ -H "X-Auth-User: demo" \ @@ -217,7 +217,7 @@ Get all hosts for Region 1 * To get all hosts for region 1, execute the following command:: - # curl -i "http://${MY_IP}:8080/v1/hosts?region_id=1" \ + # curl -i "http://${MY_IP}:7780/v1/hosts?region_id=1" \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ -H "X-Auth-User: demo" \ @@ -229,7 +229,7 @@ Get a particular host * To get a particular host, execute the following command:: - # curl -i "http://${MY_IP}:8080/v1/hosts/33" \ + # curl -i "http://${MY_IP}:7780/v1/hosts/33" \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ -H "X-Auth-User: demo" \ diff --git a/doc/source/docker-install.rst b/doc/source/docker-install.rst index a4312d3..92c590d 100755 --- a/doc/source/docker-install.rst +++ b/doc/source/docker-install.rst @@ -65,7 +65,7 @@ Calling into Craton * To generate a sample data set, use the following command:: - $ python tools/generate_fake_data.py --url http://{Container_IP}:8080/v1 --user demo --project b9f10eca66ac4c279c139d01e65f96b4 --key demo + $ python tools/generate_fake_data.py --url http://{Container_IP}:7780/v1 --user demo --project b9f10eca66ac4c279c139d01e65f96b4 --key demo * Now, let's run an API call against Craton running in the container. First, we need to enumerate the running Docker images:: @@ -77,7 +77,7 @@ Calling into Craton * Now that you know the IP address, you can run a curl command like the one below to query Craton:: - $ curl -i "http://{Container_IP}:8080/v1/hosts?region_id=1" -H "Content-Type: application/json" -H "X-Auth-Token: demo" -H "X-Auth-User: demo" -H "X-Auth-Project: b9f10eca66ac4c279c139d01e65f96b4" + $ curl -i "http://{Container_IP}:7780/v1/hosts?region_id=1" -H "Content-Type: application/json" -H "X-Auth-Token: demo" -H "X-Auth-User: demo" -H "X-Auth-Project: b9f10eca66ac4c279c139d01e65f96b4" ------------------- diff --git a/doc/source/hosts.rst b/doc/source/hosts.rst index 7e6e01e..80a96af 100644 --- a/doc/source/hosts.rst +++ b/doc/source/hosts.rst @@ -57,7 +57,7 @@ Example Host Create .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/hosts" \ + curl -i "http://${MY_IP}:7780/v1/hosts" \ -d '{"name": "fooHost", "region_id": 1, "ip_address": "11.11.11.14", "device_type": "Phone", "project_id": "717e9a216e2d44e0bc848398563bda06"}' \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ @@ -168,7 +168,7 @@ Examples Host List .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/hosts?region_id=1" \ + curl -i "http://${MY_IP}:7780/v1/hosts?region_id=1" \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ -H "X-Auth-User: demo" \ @@ -293,7 +293,7 @@ Examples Host Update .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/hosts/2" \ + curl -i "http://${MY_IP}:7780/v1/hosts/2" \ -XPUT \ -d '{"name": "changedName"}' \ -H "Content-Type: application/json" \ @@ -396,7 +396,7 @@ Example Host Variables Update .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/hosts/1/variables" \ + curl -i "http://${MY_IP}:7780/v1/hosts/1/variables" \ -XPUT \ -d '{"newVar": "sample variable"}' \ -H "Content-Type: application/json" \ diff --git a/doc/source/network-devices.rst b/doc/source/network-devices.rst index c3255cf..7a066d3 100644 --- a/doc/source/network-devices.rst +++ b/doc/source/network-devices.rst @@ -73,7 +73,7 @@ Example Network Device Create .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/network-devices" \ + curl -i "http://${MY_IP}:7780/v1/network-devices" \ -d '{"hostname": "fooHost", "region_id": 1, "ip_address": "1.1.1.4", "device_type": "NIC"}' \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ @@ -207,7 +207,7 @@ Example Network Device List .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/network-devices?region_id=1" \ + curl -i "http://${MY_IP}:7780/v1/network-devices?region_id=1" \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ -H "X-Auth-User: demo" \ @@ -336,7 +336,7 @@ Example Network Device Update .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/network-devices/6" \ + curl -i "http://${MY_IP}:7780/v1/network-devices/6" \ -XPUT \ -d '{"hostname": "newHostName", "ip_address": "0.0.0.0"}' \ -H "Content-Type: application/json" \ @@ -442,7 +442,7 @@ Example Network Device Variables Update .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/network-devices/6/variables" \ + curl -i "http://${MY_IP}:7780/v1/network-devices/6/variables" \ -XPUT \ -d '{"newVar": "sample variable"}' \ -H "Content-Type: application/json" \ diff --git a/doc/source/regions.rst b/doc/source/regions.rst index b3b6166..062af0e 100644 --- a/doc/source/regions.rst +++ b/doc/source/regions.rst @@ -45,7 +45,7 @@ Example Region Create .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/regions" \ + curl -i "http://${MY_IP}:7780/v1/regions" \ -d '{"name": "DFW"}' \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ @@ -119,7 +119,7 @@ Example Region List .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/regions" \ + curl -i "http://${MY_IP}:7780/v1/regions" \ -H "Content-Type: application/json" \ -H "X-Auth-Token: demo" \ -H "X-Auth-User: demo" \ @@ -215,7 +215,7 @@ Example Region Update .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/regions/3" \ + curl -i "http://${MY_IP}:7780/v1/regions/3" \ -XPUT \ -d '{"name": "DFW3"}' \ -H "Content-Type: application/json" \ @@ -298,7 +298,7 @@ Example Region Variables Update .. code-block:: bash - curl -i "http://${MY_IP}:8080/v1/regions/3/variables" \ + curl -i "http://${MY_IP}:7780/v1/regions/3/variables" \ -XPUT \ -d '{“array”: [2]}' \ -H "Content-Type: application/json" \ diff --git a/etc/craton-api-conf.sample b/etc/craton-api-conf.sample index 3caff9c..cadcf21 100644 --- a/etc/craton-api-conf.sample +++ b/etc/craton-api-conf.sample @@ -8,7 +8,7 @@ log_file=craton-api.log # Host IP to use for API service host=0.0.0.0 # Port to use for API service -port=8080 +port=7780 # Paste Config file to use api_paste_config=/craton/etc/craton-api-paste.ini # The name of the Paste pipeline to use for Craton. diff --git a/tools/cratonclient_with_keystone.py b/tools/cratonclient_with_keystone.py index 35454eb..74895f9 100644 --- a/tools/cratonclient_with_keystone.py +++ b/tools/cratonclient_with_keystone.py @@ -65,7 +65,7 @@ craton_session = session.Session( ) craton = client.Client( session=craton_session, - url='http://127.0.0.1:8080/', + url='http://127.0.0.1:7780/', ) inventory = craton.inventory(1)