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 <kevin.carter@rackspace.com>
This commit is contained in:
parent
ef0e66c6d8
commit
d464139d34
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" \
|
||||
|
|
|
@ -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" \
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
-------------------
|
||||
|
|
|
@ -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" \
|
||||
|
|
|
@ -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" \
|
||||
|
|
|
@ -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" \
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue