aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWuKong <rebirthmonkey@gmail.com>2017-07-27 15:45:29 +0200
committerWuKong <rebirthmonkey@gmail.com>2017-07-27 15:45:29 +0200
commitaf66f3bcd5f702f3047a4f65eb20e5b47e6cb278 (patch)
tree075f4dd436b0159cb2260d053f0a7a3d63693413
parente6891dc2021fac2902f48e00f7f5f8862c6b5db2 (diff)
improve moonv4 README.md
Change-Id: Ic255399401c52f06246249ed9732be630f9e5e0a
-rw-r--r--moonv4/README.md59
-rw-r--r--moonv4/moon_orchestrator/README.md3
-rw-r--r--moonv4/moon_orchestrator/README.rst130
-rw-r--r--moonv4/moon_orchestrator/reinstall.sh8
4 files changed, 34 insertions, 166 deletions
diff --git a/moonv4/README.md b/moonv4/README.md
index cd9e0259..bfab3255 100644
--- a/moonv4/README.md
+++ b/moonv4/README.md
@@ -1,12 +1,10 @@
-# Modules for the Moon project
+# Moon Version 4
This directory contains all the modules for MoonV4
-## Usage
-
-### Prerequist
-
+## Installation
+### Prerequisite
```bash
sudo apt install python3-dev python3-pip
sudo pip3 install pip --upgrade
@@ -14,8 +12,8 @@ sudo apt -y install docker-engine # ([Get Docker](https://docs.docker.com/engine
echo 127.0.0.1 messenger db keystone | sudo tee -a /etc/hosts
```
-### Configure Docker Engine
+### Docker Engine Configuration
```bash
cat <<EOF | sudo tee /etc/docker/daemon.json
{
@@ -23,16 +21,16 @@ cat <<EOF | sudo tee /etc/docker/daemon.json
}
EOF
sudo mv /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak
-sudo sed '/ExecStart=\/usr\/bin\/dockerd -H fd:\/\//ExecStart=\/usr\/bin\/dockerd/' /lib/systemd/system/docker.service.bak | sudo tee /lib/systemd/system/docker.service
+# sudo sed '/ExecStart=\/usr\/bin\/dockerd -H fd:\/\//ExecStart=\/usr\/bin\/dockerd/' /lib/systemd/system/docker.service.bak | sudo tee /lib/systemd/system/docker.service
sudo service docker restart
export DOCKER_HOST=tcp://172.88.88.1:2376
# if you have a firewall:
sudo ufw allow in from 172.88.88.0/16
```
-## Launch MySql, RabbitMQ, Keystone, Consul
-
+## Run Standard Containers
### Cleanup
+Remove already running containers
```bash
docker container rm -f $(docker ps -a | grep moon | cut -d " " -f 1) 2>/dev/null
docker container rm -f messenger db keystone consul 2>/dev/null
@@ -40,77 +38,82 @@ docker container rm -f messenger db keystone consul 2>/dev/null
### Internal Network Creation
+Create an internal Docker network called `moon`
```bash
docker network create -d bridge --subnet=172.88.88.0/16 --gateway=172.88.88.1 moon
```
### MySql
+Run the standard `MySql` container in the `moon` network
```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
```
### Rabbitmq
+Run the standard `Rabbitmq` container in the `moon` network
```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
```
### moon_keystone
+Run the `keystone` container (created by the `Moon` project) in the `moon` network
```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 wukongsun/moon_keystone:mitaka
```
-### moon_consul
+### Consul
+Run the standard `Consul` container in the `moon` network
```bash
docker run -d --net=moon --name=consul --hostname=consul -p 8500:8500 consul
```
-## Orchestrator
-To start the Moon platform, you have to run the Orchestrator container.
-
+## Run Moon's Containers
+### Automatic Launch
+To start the `Moon` framework, you only have to run the `moon_orchestrator` container
```bash
docker container run -dti --net moon --hostname orchestrator --name orchestrator wukongsun/moon_orchestrator:v4.1
```
-### Tests
-```bash
-docker exec -ti interface /bin/bash
-pip3 install pytest
-cd /usr/local/lib/python3.5/dist-packages/moon_interface/tests/apitests
-pytest
-```
+### Manuel Launch
+We can also manuelly start the `Moon` framework
-## Launch router, manager, interface, orchestrator independently
-
-
-### moon_router
+#### moon_router
```bash
docker container run -dti --net moon --hostname router --name router wukongsun/moon_router:v4.1
```
-### moon_manager
+#### moon_manager
```bash
docker container run -dti --net moon --hostname manager --name manager wukongsun/moon_manager:v4.1
```
-### moon_interface
+#### moon_interface
```bash
docker container run -dti --net moon --hostname interface --name interface wukongsun/moon_interface:v4.1
```
-### moon_orchestrator
+#### moon_orchestrator
```bash
docker container run -dti --net moon --hostname orchestrator --name orchestrator wukongsun/moon_orchestrator:v4.1
```
+### Tests
+```bash
+docker exec -ti interface /bin/bash
+pip3 install pytest
+cd /usr/local/lib/python3.5/dist-packages/moon_interface/tests/apitests
+pytest
+```
+
## Log
### Get some logs
```bash
-docker ps
+docker container ps
docker logs db
docker logs messenger
docker logs keystone
diff --git a/moonv4/moon_orchestrator/README.md b/moonv4/moon_orchestrator/README.md
new file mode 100644
index 00000000..d4cdc4fb
--- /dev/null
+++ b/moonv4/moon_orchestrator/README.md
@@ -0,0 +1,3 @@
+# Moon Orchestrator
+Internal orchestrator used for the Moon framework
+
diff --git a/moonv4/moon_orchestrator/README.rst b/moonv4/moon_orchestrator/README.rst
deleted file mode 100644
index 77fbe4c5..00000000
--- a/moonv4/moon_orchestrator/README.rst
+++ /dev/null
@@ -1,130 +0,0 @@
-================================
-Core module for the Moon project
-================================
-
-This package contains the main module for the Moon project
-It is designed to provide the main entry point for the Moon platform.
-
-For any other information, refer to the parent project:
-
- https://git.opnfv.org/moon
-
-
-Usage
-=====
-
-Get the code
-------------
-
- git clone https://git.opnfv.org/moon
- cd moon
- MOON_HOME=$(pwd)
-
-Create an initial docker
-------------------------
-
- cd /tmp
- git clone https://github.com/rebirthmonkey/vmspace.git
- cd docker/ubuntu_python
- # Check the proxy settings in Dockerfile
- docker build ubuntu:python .
-
-Configure the network
----------------------
-
- docker network create -d bridge --subnet=172.18.0.0/16 --gateway=172.18.0.1 moon
- echo "127.0.0.1 messenger db" | sudo tee -a /etc/hosts
-
-Start Rabbitmq
---------------
-
- docker run -dti --net=moon --hostname messenger --name messenger --link messenger:messenger -e RABBITMQ_DEFAULT_USER=moon -e RABBITMQ_DEFAULT_PASS=password -e RABBITMQ_NODENAME=rabbit@messenger -e RABBITMQ_DEFAULT_VHOST=moon -p 5671:5671 -p 5672:5672 rabbitmq:3-management
-
-Start MySQL server
-------------------
-
- docker run -dti --net=moon --hostname db --name db -e MYSQL_ROOT_PASSWORD=password -p 3306:3306 mysql:8
- cd $(MOON_HOME)/moon_orchestrator
- mysql -h db -uroot -ppassword < bin/init_db.sql
-
-Get python packages for all components
---------------------------------------
-
- cd $(MOON_HOME)/moon_orchestrator
- bash bin/build_all.sh
- mysql -h db -uroot -ppassword < bin/init_db.sql
-
-Start Orchestrator
-------------------
-
- cd $(MOON_HOME)/moon_orchestrator
- pyvenv tests/venv
- . tests/venv/bin/activate
- pip install -r ../moon_db/requirements.txt
- pip install -r ../moon_utilities/requirements.txt
- pip install -r requirements.txt
- pip install dist/moon_db-0.1.0.tar.gz
- pip install dist/moon_utilities-0.1.0.tar.gz
- pip install .
- # Check the proxy settings in $(MOON_HOME)/moon_orchestrator/conf/moon.conf
- moon_orchestrator
-
-Get some logs
--------------
-
- docker logs messenger
- docker logs router
- docker logs interface
-
-Get the API in PDF
-------------------
-
- cd $(MOON_HOME)/moon_interface/tools
- sudo pip install requests
- sudo apt-get install pandoc
- /usr/bin/python3 api2rst.py
- pandoc api.rst -o api.pdf
- evince api.pdf
-
-How to hack the Moon platform
-=============================
-
-Update the moon_interface
--------------------------
-
-Go to the directory $(MOON_HOME)/moon_interface and update the code accordingly to your needs,
-then update the python package.
-
- python setup.py sdist
- cp dist/moon_interface_* ../moon_orchestrator/dist
- # kill moon_orchestrator if needed and restart it
-
-Update the moon_secrouter
--------------------------
-
-Go to the directory $(MOON_HOME)/moon_secrouter and update the code accordingly to your needs,
-then update the python package.
-
- python setup.py sdist
- cp dist/moon_secrouter* ../moon_orchestrator/dist
- # kill moon_orchestrator if needed and restart it
-
-Problems that may arise
-=======================
-
-If the moon_orchestrator doesn't want to start
-(with, for example, the following error: `docker.errors.APIError: 409 Client Error: Conflict`),
-check if the router and interface containers still exist and kill and delete them:
-
- docker kill interface
- docker kill router
- docker rm interface
- docker rm router
-
-If the moon_orchestrator complains that it cannot request the RabbitMQ server,
-check if the messenger server is up and running:
-
- docker ps
- # you must see the messenger running here
- # if not, restart it
- docker run -dti --net=moon --hostname messenger --name messenger --link messenger:messenger -e RABBITMQ_DEFAULT_USER=moon -e RABBITMQ_DEFAULT_PASS=password -e RABBITMQ_NODENAME=rabbit@messenger -e RABBITMQ_DEFAULT_VHOST=moon -p 5671:5671 -p 5672:5672 rabbitmq:3-management
diff --git a/moonv4/moon_orchestrator/reinstall.sh b/moonv4/moon_orchestrator/reinstall.sh
deleted file mode 100644
index 0649a378..00000000
--- a/moonv4/moon_orchestrator/reinstall.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-pip install -r requirements.txt
-pip install dist/moon_utilities-0.1.0.tar.gz
-pip install dist/moon_db-0.1.0.tar.gz
-pip install -r ../moon_utilities/requirements.txt
-pip install -r ../moon_db/requirements.txt
-python setup.py develop
-docker rm -f moon_interface moon_router
-docker ps