Skip to content

Commit ac60a45

Browse files
author
Bharath Siravara
committed
Photon Controller: Initial Commit
0 parents  commit ac60a45

File tree

2,983 files changed

+397401
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,983 files changed

+397401
-0
lines changed

.gitignore

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# VIM
2+
.*.s[a-w][a-z]
3+
*.un~
4+
Session.vim
5+
.netrwhist
6+
7+
# Emacs
8+
*~
9+
\#*\#
10+
11+
# IDEA
12+
.idea
13+
14+
# Local Dev DB
15+
mem.h2.db
16+
mem.trace.db
17+
18+
# cscope, ctags
19+
cscope.files
20+
cscope.in.out
21+
cscope.out
22+
cscope.po.out
23+
tags
24+
25+
26+
.ruby
27+
28+
tmp/
29+
ruby/common/test_files/deployment/dcmap.yml

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vendor/xenon"]
2+
path = vendor/xenon
3+
url = ../xenon

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Photon Controller
2+
3+
Photon Controller is an open-source system for managing hardware, containers, and clusters at scale.
4+
5+
Photon Controller is designed to support:
6+
* **High Scale**: Manage tens of thousands of compute nodes in one deployment.
7+
* **High Churn**: Handle thousands of concurrent API requests.
8+
* **Multiple Tenants**: Allocate and manage resources for many users and groups in a single deployment.
9+
* **Container Frameworks**: Easily spin up instances of [Kubernetes](http://kubernetes.io), [Mesos](http://mesos.apache.org), and [Docker Swarm](https://docs.docker.com/swarm/) in seconds.
10+
11+
## Participation
12+
13+
If you'd like to become a part of the Photon Controller community, here are some ways to connect:
14+
15+
* Visit us on [GitHub](http://vmware.github.io/photon-controller)
16+
* Join the Photon Controller [user group](http://fix.me) or [developers group](http://fix.me) on Google Groups -- coming soon
17+
* Ask questions using the "photon-controller" tag on [Stack Overflow](http://stackoverflow.com/)
18+
19+
If you're looking to play with the code, keep reading.
20+
21+
## Repository
22+
23+
The product is arranged in a single repository, with subdirectories arranged by language. See the individual READMEs for instructions on building the code.
24+
25+
* [Devbox](devbox-photon/README.md): Devbox uses [Vagrant](http://vagrantup.com) to create a small standalone deployment of Photon Controller for test purposes.
26+
* [Java](java/README.md): Most of the Photon Controller management plane is written in Java, with many individual services implemented on top of the [Xenon framework](http://fix.me) -- coming soon.
27+
* [Python](python/README.md): The ESX agent and its test and analysis collateral are implemented in Python.
28+
* [Ruby](ruby/README.md): The Photon Controller CLI is implemented in Ruby, as are the integration tests for the product.
29+
* **Note**: The Ruby CLI will soon be replaced with a Golang version.
30+
* [Thrift](thrift/README.md): Photon Controller uses [Apache Thrift](http://thrift.apache.org) for RPC communication between the management plane and the agent.
31+
32+
## Development
33+
34+
If you'd like to make changes to Photon Controller, you can submit pull requests on [GitHub](http://vmware.github.io/photon-controller).
35+
36+
Contributors to Photon Controller must have signed and submitted a copy of the [Contributor License Agreement](http://fix.me) -- coming soon -- to [email protected].
37+
38+
All pull requests satisfy the following criteria:
39+
40+
1. Pass **unit tests** according to the instructions in the appropriate language-specific README file.
41+
2. Pass **integration tests** according to the instructions for [Devbox](devbox-photon/README.md).
42+
43+
We will run any changes through our own validation process which ensures that both conditions are met, but it's in everyone's interest if you take care of this on your own first.
44+
45+
Thanks, and enjoy!

devbox-photon/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.vagrant/
2+
log/
3+
proxy.sh

devbox-photon/README.md

+181
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
# Dev Box "Photon Controller"
2+
3+
## Introduction
4+
5+
Dev Box uses [Vagrant], [Docker] and [Photon OS] to create a local VM and install the Photon Controller components in docker containers. These components are installed from source located in the local working copy. This allows you to make a change locally without committing it and testing it end to end.
6+
7+
All of the components are compiled, packaged and started in their own containers inside the VM. The process does not make any changes to your working copy.
8+
9+
The logs from the Photon Controller services are synced to the host and are located in `log` directory.
10+
11+
## Requirements
12+
13+
* vagrant (http://www.vagrantup.com/downloads.html)
14+
15+
Steps to install: https://docs.vagrantup.com/v2/installation/index.html
16+
17+
* virtualbox (https://www.virtualbox.org/wiki/Downloads)
18+
19+
Steps to install: https://www.virtualbox.org/manual/ch01.html#intro-installing
20+
21+
* vagrant plugin for Photon OS (http://artifactory.ec.eng.vmware.com/artifactory/vagrant-box-with-images/develop/27/vagrant-guests-photon-0.0.1.gem)
22+
23+
The plugin is downloaded and installed by the install_photon_plugin.sh script listed below.
24+
25+
## Instructions
26+
27+
### Starting Devbox
28+
29+
#### Photon OS plugin for Vagrant
30+
31+
In order to control the Dev Box VM, Vagrant needs a plugin for Photon OS. The plugin is installed as a gem directly into Vagrant. Before starting Dev Box, run the following script to install the plugin:
32+
33+
install_photon_plugin.sh
34+
35+
The script can be invoked repeatedly if you want to make sure the plugin is installed or if you want to reinstall the plugin.
36+
37+
#### Start and provision Dev Box
38+
39+
Dev Box configuration and startup code is located in the Dev Box directory (`<code>/photon-devbox`). The following command starts Dev Box:
40+
41+
vagrant up
42+
43+
#### Setting Vagrant box name and location
44+
45+
Dev Box Vagrant box file is located at `https://bintray.com/artifact/download/vmware-esxcloud/public/<build #>/resource/photon-devbox.box`. It is downloaded on-demand and cached locally. It is also associated with a name. Both name and URL can be redirected by using environment variables (`DEVBOX_NAME` and `DEVBOX_URL`).
46+
47+
### Checking Dev Box status
48+
49+
Dev Box status can be checked with the following command:
50+
51+
vagrant status
52+
53+
The API Frontend has been forwarded locally to port 9080. Status can be checked with the following commands:
54+
55+
curl http://localhost:9080/status/
56+
curl http://<devbox ip>:9000/status/
57+
58+
By default Dev Box starts with a private IP address (172.31.253.66). As described below, a public or a specific private IP address can be configured using environment variables.
59+
60+
### Accessing Dev Box
61+
62+
You can go into the Dev Box VM using the vagrant ssh command.
63+
64+
vagrant ssh [photon]
65+
66+
### Stopping and destroying Dev Box
67+
68+
vagrant destroy [-f] [photon]
69+
70+
Destroying Dev Box is the recommended way of cleaning up.
71+
72+
### Recreate without destroying
73+
74+
Vagrant supports reprovisioning and reloading of Dev Box VMs, but in order to perform complete cleanup, it is not recommended to use the Vagrant reload feature (`vagrant reload [photon]`). It is recommended to destroy and create the Dev Box VM as described above.
75+
76+
### Emergency VM cleanup
77+
78+
If for some reason Dev Box VM cannot be destroyed via Vagrang command (`vagrant destroy [-f] [photon]`), follow the next steps to manually power off and delete the VM:
79+
80+
* Identify the running VMs
81+
82+
`vboxmanage list runningvms`
83+
84+
Sample output may look like this:
85+
86+
"devbox-photon_photon_1446051688357_62198" {4b963230-c8b4-434d-b70d-39270373fa65}
87+
88+
Notice the machine ID ("devbox-photon_photon_1446051688357_62198").
89+
90+
* If the VM is not running, identify it with the following command:
91+
92+
`vboxmanage list vms`
93+
94+
* Power off the VM:
95+
96+
`vboxmanage controlvm <machine ID> poweroff`
97+
98+
for example:
99+
100+
vboxmanage controlvm devbox-photon_photon_1446051688357_62198 poweroff
101+
102+
* Unregister the VM (with optional deletion of its artifacts)
103+
104+
`vboxmanage unregistervm <machine ID> [--delete]`
105+
106+
for example:
107+
108+
vboxmanage unregistervm devbox-photon_photon_1446051688357_62198 --delete
109+
110+
## Controlling Dev Box behavior with environment variables
111+
112+
### Vagrant box file
113+
To override the default values of the vagrant box name and URL, define the following self-explanatory environment variables before starting Dev Box:
114+
115+
* `DEVBOX_NAME`
116+
* `DEVBOX_URL`
117+
118+
### IP Address
119+
By default Dev Box runs with a private IP address as part of the default configuration of VirtualBox (172.31.253.66). To specify your own private IP address define the following environment variable before starting Dev Box:
120+
121+
* `PRIVATE_NETWORK_IP`
122+
123+
To use a public IP address for the Dev Box, define the following environment variables before starting Dev Box:
124+
125+
* `PUBLIC_NETWORK_IP`
126+
* `PUBLIC_NETWORK_MASK`
127+
128+
The following self-explanatory variables are optional:
129+
130+
* `BRIDGE_NETWORK`
131+
* `PUBLIC_NETWORK_GATEWAY`
132+
133+
### Using Dev Box with Lightwave for authentication
134+
To enable authentication in Photon Controller services, a Lightwave STS must be installed, configured and available. In most cases a public IP address needs to be set on the Dev Box in order to access the Lightwave server. To enable authentication define the following environment variables before starting Dev Box:
135+
136+
* `ENABLE_AUTH` - set to `true` to enable authentication, do not set or set to `false` to disable it
137+
* `PHOTON_AUTH_LS_ENDPOINT` - address of the Lightwave server
138+
* `PHOTON_AUTH_SERVER_PORT` - port of Lightwave server, currently fixed to 443
139+
* `PHOTON_AUTH_SERVER_TENANT` - tenant (domain) of the Lightwave server
140+
* `PHOTON_SWAGGER_LOGIN_URL` - registered login URL for the client at the Lightwave server
141+
* `PHOTON_SWAGGER_LOGOUT_URL` - registered logout URL for the client at the Lightwave server
142+
143+
### Using Dev Box with a real ESX host
144+
By default Dev Box uses an internal Photon Controller Agent, which mimics the ESX operations. To use with an actual ESX host, set the following environment variables before starting Dev Box:
145+
146+
* `REAL_AGENT` set to `true` to use real ESX host. Do not set or set to false to use internal Agent
147+
* `ESX_IP` IP address of the ESX host
148+
* `ESX_DATASTORE` name of the data store on the ESX host to be used by Dev Box
149+
150+
NOTE: When using real ESX host, Dev Box installs Photon Controller Agent's VIB on it. This setting is used frequently with a public IP address of the Dev Box.
151+
152+
### Enable syslog log entries remoting
153+
To enable sending log entries to a remote syslog endpoint (such as VMware LogInsight), use the following environment variables before starting Dev Box:
154+
155+
* `ENABLE_SYSLOG` - set to `true` to use a remote syslog endpoint
156+
* `SYSLOG_ENDPOINT` - address of the remote syslog endpoint
157+
158+
### Other settings
159+
160+
* `NO_PORT_FORWARDING` - define if you want to disable the Vagrant/VirtualBox port forwarding of the services from the VM to the host machine. For details on the forwarded ports, refer to the `Vagrantfile`. In most cases forwarding is not necessary as the ports are accessible directly on the VM via its IP address.
161+
* `DEVBOX_PHOTON_MEMORY` - override the memory setting for the Dev Box VM. Default is 3072MB.
162+
* `DEVBOX_PHOTON_CPUS` - override the CPUs assigned to the Dev Box VM. Default is 4.
163+
* `PROXY_PROFILE` - Allows configuring proxy inside the Dev Box VM. Requires a proxy setting file `/etc/profile.d/proxy.sh` which is used inside the VM for setting up proxy.
164+
* `DEVBOX_NO_CLEAN_LOGS` - set if you don't want the logs directory cleaned up when bringin up Dev Box.
165+
* `DEVBOX_FORCE_PHOTON_PLUGIN_REINSTALL` - force reinstall of the Vagrant plugin for Photon OS even if it's already installed.
166+
167+
## Remote debugging
168+
Remote debugging is enabled by default for the Java services in Dev Box. Debugger endpoints are available at the following ports:
169+
170+
* API Frontend: 39000
171+
* Chairman: 23000
172+
* Root Scheduler: 23010
173+
* Housekeeper: 26000
174+
* Cloud Store: 29000
175+
* Deployer: 28000
176+
177+
To connect the remote debugger, add a new remote debug configuration with the hostname set to Dev Box's IP address (default for private configuration is `172.31.253.66`) and the corresponding service port.
178+
179+
[Vagrant]: http://vagrantup.com
180+
[Docker]: http://www.docker.com
181+
[Photon OS]: https://vmware.github.io/photon/

0 commit comments

Comments
 (0)