summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWuKong <rebirthmonkey@gmail.com>2017-07-19 14:01:30 +0200
committerWuKong <rebirthmonkey@gmail.com>2017-07-19 14:01:30 +0200
commit6a59009e64f727bcf3c67a8ae45a02e4137bfb99 (patch)
treed58fed674114f4ee8497efec8d303d0f4baba836
parentffd694ebadb1d3b4e140104f9f0a81837c0e7258 (diff)
update moon_router
Change-Id: Iafa79fce14d965dba2f21612eb9c2ae47599c6d7 Signed-off-by: WuKong <rebirthmonkey@gmail.com>
-rw-r--r--moonv4/README.md93
-rw-r--r--moonv4/moon_router/Dockerfile11
-rw-r--r--moonv4/moon_router/README.md (renamed from moonv4/moon_router/README.rst)13
-rw-r--r--moonv4/moon_router/moon_router/__init__.py (renamed from moonv4/moon_router/moon_secrouter/__init__.py)0
-rw-r--r--moonv4/moon_router/moon_router/__main__.py3
-rw-r--r--moonv4/moon_router/moon_router/api/__init__.py (renamed from moonv4/moon_router/moon_secrouter/api/__init__.py)0
-rw-r--r--moonv4/moon_router/moon_router/api/generic.py (renamed from moonv4/moon_router/moon_secrouter/api/generic.py)0
-rw-r--r--moonv4/moon_router/moon_router/api/route.py (renamed from moonv4/moon_router/moon_secrouter/api/route.py)2
-rw-r--r--moonv4/moon_router/moon_router/messenger.py (renamed from moonv4/moon_router/moon_secrouter/messenger.py)4
-rw-r--r--moonv4/moon_router/moon_router/server.py (renamed from moonv4/moon_router/moon_secrouter/server.py)4
-rw-r--r--moonv4/moon_router/moon_secrouter/__main__.py3
-rw-r--r--moonv4/moon_router/setup.py11
-rw-r--r--moonv4/templates/moon_keystone/README.md39
13 files changed, 95 insertions, 88 deletions
diff --git a/moonv4/README.md b/moonv4/README.md
index ba334a7d..8a729ad1 100644
--- a/moonv4/README.md
+++ b/moonv4/README.md
@@ -30,67 +30,94 @@ sudo gpasswd -a ${USER} docker
sudo service docker restart
```
-## Launch MySql, RabbitMQ, Keystone containers
-TODO: put all the containers to `dockerhub`
-### moon_mysql:v4.1
+## Launch MySql, RabbitMQ, Keystone
-### moon_rabbitmq:v4.1
+### Cleanup
+```bash
+docker container rm -f $(docker ps -a | grep moon | cut -d " " -f 1) 2>/dev/null
+docker container rm -f messenger db keystone 2>/dev/null
+```
-### moon_keystone:v4.1
+
+### Internal Network Creation
```bash
-docker container run -dti --net moon --hostname keystone --name keystone -e DB_HOST=db -e DB_PASSWORD_ROOT=p4sswOrd1 -p 35357:35357 -p 5000:5000 asteroide/keystone_mitaka:latest
+docker network create -d bridge --subnet=172.88.88.0/16 --gateway=172.88.88.1 moon
```
-## Install Orchestrator
-### Get the code
+### MySql
```bash
-git clone https://git.opnfv.org/moon
-cd moon/moonv4
-export MOON_HOME=$(pwd)
-sudo ln -s $(pwd)/conf /etc/moon
+docker container run -dti --net=moon --hostname db --name db -e MYSQL_ROOT_PASSWORD=p4sswOrd1 -e MYSQL_DATABASE=moon -e MYSQL_USER=moon -e MYSQL_PASSWORD=p4sswOrd1 -p 3306:3306 mysql:latest
```
-### Start Orchestrator
-To start the Moon platform, you have to run the Orchestrator.
+### Rabbitmq
+```bash
+docker container run -dti --net=moon --hostname messenger --name messenger -e RABBITMQ_DEFAULT_USER=moon -e RABBITMQ_DEFAULT_PASS=p4sswOrd1 -e RABBITMQ_NODENAME=rabbit@messenger -e RABBITMQ_DEFAULT_VHOST=moon -e RABBITMQ_HIPE_COMPILE=1 -p 5671:5671 -p 5672:5672 -p 8080:15672 rabbitmq:3-management
+```
-TODO: put all Python packages to PIP
+### moon_keystone
```bash
-cd ${MOON_HOME}/moon_orchestrator
-sudo apt install python3-venv
-pyvenv tests/venv
-. tests/venv/bin/activate
-pip3 install -r requirements.txt --upgrade
-pip3 install dist/moon_db-0.1.0.tar.gz --upgrade
-pip3 install dist/moon_utilities-0.1.0.tar.gz --upgrade
-pip3 install . --upgrade
-moon_db_manager upgrade
+docker container run -dti --net moon --hostname keystone --name keystone -e DB_HOST=db -e DB_PASSWORD_ROOT=p4sswOrd1 -p 35357:35357 -p 5000:5000 wukongsun/moon_keystone:mitaka
```
-### `/etc/moon/moon.conf`
-- edit `dist_dir` variable
-- check each `container` variable
-Launch `Moon Orchestrator`
+## Orchestrator
+To start the Moon platform, you have to run the Orchestrator.
+
+### Installation
+```bash
+sudo pip3 install moon_db --upgrade
+sudo pip3 install moon_utilities --upgrade
+sudo pip3 install moon_orchestrator --upgrade
+moon_db_manager upgrade
+```
+
+### Launch
```bash
moon_orchestrator
```
### Tests
-In the Python venv
```bash
-pip3 install pytest
-cd ${MOON_HOME}/moon_interface/tests/apitests
+sudo pip3 install pytest
+cd /usr/lib/moon_orchestratr/moon_interface/tests/apitests
pytest
```
+
+## Launch consul, router, manager, interface
+
+### moon_consul
+```bash
+docker container run -dti --net moon --hostname consul --name consul wukongsun/moon_consul:v4.1
+```
+
+### moon_router
+```bash
+docker container run -dti --net moon --hostname router --name router wukongsun/moon_router:v4.1
+```
+
+### moon_manager
+```bash
+docker container run -dti --net moon --hostname manager --name manager wukongsun/moon_manager:v4.1
+```
+
+
+### moon_interface
+```bash
+docker container run -dti --net moon --hostname interface --name interface wukongsun/moon_interface:v4.1
+```
+
+
## Log
### Get some logs
```bash
docker ps
+docker logs db
docker logs messenger
docker logs keystone
-docker logs moon_router
-docker logs moon_interface
+docker logs router
+docker logs manager
+docker logs interface
```
diff --git a/moonv4/moon_router/Dockerfile b/moonv4/moon_router/Dockerfile
new file mode 100644
index 00000000..c4b542b3
--- /dev/null
+++ b/moonv4/moon_router/Dockerfile
@@ -0,0 +1,11 @@
+FROM ubuntu:latest
+
+RUN apt update && apt install python3.5 python3-pip -y
+RUN pip3 install moon_utilities moon_db
+
+ADD . /root
+WORKDIR /root/
+RUN pip3 install -r requirements.txt
+RUN pip3 install .
+
+CMD ["python3", "-m", "moon_router"] \ No newline at end of file
diff --git a/moonv4/moon_router/README.rst b/moonv4/moon_router/README.md
index ded4e99a..91899b31 100644
--- a/moonv4/moon_router/README.rst
+++ b/moonv4/moon_router/README.md
@@ -1,5 +1,4 @@
-Core module for the Moon project
-================================
+# Router: Core module for the Moon project
This package contains the core module for the Moon project
It is designed to provide authorization features to all OpenStack components.
@@ -7,3 +6,13 @@ It is designed to provide authorization features to all OpenStack components.
For any other information, refer to the parent project:
https://git.opnfv.org/moon
+
+## Build Image
+```bash
+docker image build -t wukongsun/moon_router:v4.1 .
+```
+
+## Push Image
+```bash
+docker push wukongsun/moon_router:v4.1
+``` \ No newline at end of file
diff --git a/moonv4/moon_router/moon_secrouter/__init__.py b/moonv4/moon_router/moon_router/__init__.py
index 903c6518..903c6518 100644
--- a/moonv4/moon_router/moon_secrouter/__init__.py
+++ b/moonv4/moon_router/moon_router/__init__.py
diff --git a/moonv4/moon_router/moon_router/__main__.py b/moonv4/moon_router/moon_router/__main__.py
new file mode 100644
index 00000000..0d7a8fe6
--- /dev/null
+++ b/moonv4/moon_router/moon_router/__main__.py
@@ -0,0 +1,3 @@
+from moon_router.server import main
+
+main()
diff --git a/moonv4/moon_router/moon_secrouter/api/__init__.py b/moonv4/moon_router/moon_router/api/__init__.py
index e69de29b..e69de29b 100644
--- a/moonv4/moon_router/moon_secrouter/api/__init__.py
+++ b/moonv4/moon_router/moon_router/api/__init__.py
diff --git a/moonv4/moon_router/moon_secrouter/api/generic.py b/moonv4/moon_router/moon_router/api/generic.py
index d066f715..d066f715 100644
--- a/moonv4/moon_router/moon_secrouter/api/generic.py
+++ b/moonv4/moon_router/moon_router/api/generic.py
diff --git a/moonv4/moon_router/moon_secrouter/api/route.py b/moonv4/moon_router/moon_router/api/route.py
index 2a2c54bc..1a102abf 100644
--- a/moonv4/moon_router/moon_secrouter/api/route.py
+++ b/moonv4/moon_router/moon_router/api/route.py
@@ -10,7 +10,7 @@ from uuid import uuid4
from oslo_log import log as logging
from moon_utilities.security_functions import call, notify
from oslo_config import cfg
-from moon_secrouter.api.generic import Status, Logs
+from moon_router.api.generic import Status, Logs
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
diff --git a/moonv4/moon_router/moon_secrouter/messenger.py b/moonv4/moon_router/moon_router/messenger.py
index 52e5c341..46565c62 100644
--- a/moonv4/moon_router/moon_secrouter/messenger.py
+++ b/moonv4/moon_router/moon_router/messenger.py
@@ -7,8 +7,8 @@ from oslo_config import cfg
import oslo_messaging
import time
from oslo_log import log as logging
-from moon_secrouter.api.generic import Status, Logs
-from moon_secrouter.api.route import Router
+from moon_router.api.generic import Status, Logs
+from moon_router.api.route import Router
from moon_utilities.api import APIList
LOG = logging.getLogger(__name__)
diff --git a/moonv4/moon_router/moon_secrouter/server.py b/moonv4/moon_router/moon_router/server.py
index 16f6ea9c..40e2b945 100644
--- a/moonv4/moon_router/moon_secrouter/server.py
+++ b/moonv4/moon_router/moon_router/server.py
@@ -9,7 +9,7 @@ import signal
from oslo_config import cfg
from oslo_log import log as logging
from moon_utilities import options # noqa
-from moon_secrouter.messenger import Server
+from moon_router.messenger import Server
class AsyncServer(threading.Thread):
@@ -23,7 +23,7 @@ class AsyncServer(threading.Thread):
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
-DOMAIN = "moon_secrouter"
+DOMAIN = "moon_router"
__CWD__ = os.path.dirname(os.path.abspath(__file__))
diff --git a/moonv4/moon_router/moon_secrouter/__main__.py b/moonv4/moon_router/moon_secrouter/__main__.py
deleted file mode 100644
index 8ec695db..00000000
--- a/moonv4/moon_router/moon_secrouter/__main__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from moon_secrouter.server import main
-
-main()
diff --git a/moonv4/moon_router/setup.py b/moonv4/moon_router/setup.py
index 0c3b61ba..aabe8349 100644
--- a/moonv4/moon_router/setup.py
+++ b/moonv4/moon_router/setup.py
@@ -4,14 +4,14 @@
# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
from setuptools import setup, find_packages
-import moon_secrouter
+import moon_router
setup(
- name='moon_secrouter',
+ name='moon_router',
- version=moon_secrouter.__version__,
+ version=moon_router.__version__,
packages=find_packages(),
@@ -21,7 +21,7 @@ setup(
description="",
- long_description=open('README.rst').read(),
+ long_description=open('README.md').read(),
# install_requires= ,
@@ -40,8 +40,7 @@ setup(
entry_points={
'console_scripts': [
- 'moon_secrouter = moon_secrouter.server:main',
+ 'moon_router = moon_router.server:main',
],
}
-
)
diff --git a/moonv4/templates/moon_keystone/README.md b/moonv4/templates/moon_keystone/README.md
index cf77a74a..7027324e 100644
--- a/moonv4/templates/moon_keystone/README.md
+++ b/moonv4/templates/moon_keystone/README.md
@@ -13,45 +13,6 @@ docker build --build-arg https_proxy=http://proxy:3128 --build-arg http_proxy=ht
```
-## Setup an execution environment
-
-### clean up if necessary
-```bash
-docker container rm -f $(docker ps -a | grep moon | cut -d " " -f 1) 2>/dev/null
-docker container rm -f messenger db keystone 2>/dev/null
-```
-
-### create a network
-```bash
-docker network create -d bridge --subnet=172.18.0.0/16 --gateway=172.18.0.1 moon
-```
-
-### Start RabbitMQ
-TODO: use our own container
-```bash
-docker container run -dti --net=moon --hostname messenger --name messenger -e RABBITMQ_DEFAULT_USER=moon -e RABBITMQ_DEFAULT_PASS=p4sswOrd1 -e RABBITMQ_NODENAME=rabbit@messenger -e RABBITMQ_DEFAULT_VHOST=moon -e RABBITMQ_HIPE_COMPILE=1 -p 5671:5671 -p 5672:5672 -p 8080:15672 rabbitmq:3-management
-```
-
-
-### Start MySQL server
-TODO: user our own containter
-```bash
-docker container run -dti --net=moon --hostname db --name db -e MYSQL_ROOT_PASSWORD=p4sswOrd1 -e MYSQL_DATABASE=moon -e MYSQL_USER=moon -e MYSQL_PASSWORD=p4sswOrd1 -p 3306:3306 mysql:latest
-```
-
-## launch a Keystone container
-TODO: user our own containter
-```bash
-docker container run -dti --net moon --hostname keystone --name keystone -e DB_HOST=db -e DB_PASSWORD_ROOT=p4sswOrd1 -p 35357:35357 -p 5000:5000 keystone:mitaka
-```
-
-## check
-### log
-```bash
-docker logs keystone -f
-```
-
-
### access to the container
```bash
docker container exec -ti keystone /bin/bash