Readme.md 2.58 KB
Newer Older
Dmitry Volodin's avatar
Dmitry Volodin committed
1
2
3
# NOC Tower
NOC Tower is the tool for deployment and maintaining multiple
NOC (http://nocproject.org/) installations.
Aleksey Shirokih's avatar
Aleksey Shirokih committed
4

Aleksey Shirokih's avatar
Aleksey Shirokih committed
5
[![build status](https://code.getnoc.com/noc/tower/badges/master/build.svg)](https://code.getnoc.com/noc/tower/commits/master)
Dmitry Volodin's avatar
Dmitry Volodin committed
6

Dmitry Volodin's avatar
Dmitry Volodin committed
7
## Preparation
Aleksey Shirokih's avatar
Fix doc    
Aleksey Shirokih committed
8
### Debian based Linux
Dmitry Volodin's avatar
Dmitry Volodin committed
9
10
```
#!shell
Aleksey Shirokih's avatar
Aleksey Shirokih committed
11
# apt-get install python-virtualenv libffi6 libffi-dev python-dev gcc libssl-dev
Dmitry Volodin's avatar
Dmitry Volodin committed
12
13
14
15
# groupadd tower
# useradd -d /home/tower -g tower -s /bin/bash -m tower
```

Aleksey Shirokih's avatar
Fix doc    
Aleksey Shirokih committed
16
17
18
### Rhel based Linux
```
#!shell
Aleksey Shirokih's avatar
Aleksey Shirokih committed
19
# yum install python-virtualenv libffi libffi-devel python-devel gcc openssl-devel
Aleksey Shirokih's avatar
Fix doc    
Aleksey Shirokih committed
20
21
22
23
24
# groupadd tower
# useradd -d /home/tower -g tower -s /bin/bash -m tower
```


Dmitry Volodin's avatar
Dmitry Volodin committed
25
26
27
### FreeBSD
```
#!shell
Aleksey Shirokih's avatar
Aleksey Shirokih committed
28
# pkg install -y python2 libffi py27-pip py27-virtualenv py27-sqlite3 ca_root_nss
Dmitry Volodin's avatar
Dmitry Volodin committed
29
# pw groupadd -n tower
30
# pw useradd -g tower -s /bin/csh -d /home/tower -n tower -m
Dmitry Volodin's avatar
Dmitry Volodin committed
31
32
33
```


Dmitry Volodin's avatar
Dmitry Volodin committed
34
## Installation
Dmitry Volodin's avatar
Dmitry Volodin committed
35
36
37
38
Tower is installed into /opt/tower directory by default, though you
can use arbitrary directory (i.e. /usr/local/tower) as well.
Replace /opt/tower/ to directory of your choice

Dmitry Volodin's avatar
Dmitry Volodin committed
39
 - Create Tower directory
40
41
42

```
#!shell
Dmitry Volodin's avatar
Dmitry Volodin committed
43
44
# mkdir /opt/tower
# cd /opt/tower
45
```
Dmitry Volodin's avatar
Dmitry Volodin committed
46
47

 - Create virtualenv
48
49
```
#!shell
Dmitry Volodin's avatar
Dmitry Volodin committed
50
/opt/tower# virtualenv .
51
```
Dmitry Volodin's avatar
Dmitry Volodin committed
52

Dmitry Volodin's avatar
Dmitry Volodin committed
53
54
55
 - Install Tower
```
#!shell
Aleksey Shirokih's avatar
Aleksey Shirokih committed
56
/opt/tower# ./bin/pip install --upgrade pip
Aleksey Shirokih's avatar
Aleksey Shirokih committed
57
/opt/tower# ./bin/pip install https://cdn.getnoc.com/tower/noc-tower-latest.zip
Dmitry Volodin's avatar
Dmitry Volodin committed
58
59
60
/opt/tower# chown -R tower var/
```
 - Generate Tower ssh keys
61
62
```
#!shell
Dmitry Volodin's avatar
Dmitry Volodin committed
63
/opt/tower# su - tower -c "ssh-keygen -t rsa -b 4096"
64
```
Dmitry Volodin's avatar
Dmitry Volodin committed
65

Dmitry Volodin's avatar
Dmitry Volodin committed
66
 - Run Tower
67
68
```
#!shell
Dmitry Volodin's avatar
Dmitry Volodin committed
69
/opt/tower# su - tower -c "cd /opt/tower && ./bin/tower-web"
70
```
Dmitry Volodin's avatar
Dmitry Volodin committed
71

72
## Deploying
73

Dmitry Volodin's avatar
Dmitry Volodin committed
74
 - Enter the magical mistery tower.
Dmitry Volodin's avatar
Dmitry Volodin committed
75
76
77
78
79
80
81
82
83
84
   Open http://<IP>:8888/ in your browser. Login as admin/admin

 - Set up Tower
 Go to settings and set Tower's site URL (http://<IP>:8888/) and
 Tower's repository URL, as seen by nodes (http://<IP>:8888/hg).

 Do not forget to change tower's admin password
 (Upper right menu > Change Password)

## Prepare nodes
Aleksey Shirokih's avatar
Fix doc    
Aleksey Shirokih committed
85
86
87
88
89
90
91
92
On each node 
* create ansible user (*ansible* by default),
* grant it passwordless sudo privileges and copy Tower's
* copy public ssh key (*/home/tower/.ssh/id_rsa.pub*) to *ansible's*
```
#!shell
/opt/tower# su - tower -c "ssh-copy-id node_ip"
```
Aleksey Shirokih's avatar
Aleksey Shirokih committed
93
94

## RHEL Only
Aleksey Shirokih's avatar
Fix doc    
Aleksey Shirokih committed
95
96
* For RHEL based systems check if "Defaults    requiretty" is commented.
* Ensure python2.7 package installed
Aleksey Shirokih's avatar
Aleksey Shirokih committed
97
* Create new file on tower in /opt/tower/var/tower/playbooks/ENV_NAME/ansible/vars/local.yml with such lines
Aleksey Shirokih's avatar
fix    
Aleksey Shirokih committed
98

Aleksey Shirokih's avatar
Aleksey Shirokih committed
99
100
101
```
rhel_subscription_username: ""
rhel_subscription_password: ""
Aleksey Shirokih's avatar
fix    
Aleksey Shirokih committed
102
```
Aleksey Shirokih's avatar
Aleksey Shirokih committed
103
104
105

## Proxy 
In cause of using proxy for internet acces you should set proxy settings to `/home/tower/.hgrc` that way
Aleksey Shirokih's avatar
fix    
Aleksey Shirokih committed
106

Aleksey Shirokih's avatar
Aleksey Shirokih committed
107
108
109
110
```
[http_proxy]
host=192.168.1.1:3128
```