diff --git a/README.md b/README.md index d6617767..07557f98 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ setup using the triton tool. Currently requires [yarn](https://yarnpkg.com/en/docs/install) for installing dependencies, as well as `docker` and `docker-compose` are installed correctly, this can be done by -running `make`, make continues without any errors, then you are good to go. +running `make`, make continues without any errors, then you are good to go. [node-triton](https://github.com/joyent/node-triton) +is also needed if deployment to Triton is required. ``` make && make install @@ -52,6 +53,7 @@ We will also include multiple PoC's of various bits of functionality from UI's p ``` . ├── cloudapi-graphql +├── docs ├── frontend ├── nginx ├── ui @@ -62,6 +64,11 @@ We will also include multiple PoC's of various bits of functionality from UI's p An implementation of the [Joyent CloudAPI](https://apidocs.joyent.com/cloudapi/) in GraphQL. +### Docs + +Documentation about the project, mainly focused on information for the technical runnings of this project. +Can be view online at the [documentation website](http://docs.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone/) + ### frontend The client side code with a dev-server, this also includes the production server for the meantime, however we are looking at moving towards a deployment of the build artifacts to manta, and another server to host these assets. diff --git a/cloudapi-graphql/Dockerfile b/cloudapi-graphql/Dockerfile index db2992cb..68b84ed9 100644 --- a/cloudapi-graphql/Dockerfile +++ b/cloudapi-graphql/Dockerfile @@ -1 +1 @@ -FROM quay.io/yldio/alpine-node-containerpilot:6.9.3 +FROM quay.io/yldio/alpine-node-containerpilot:6.9.4-3 diff --git a/cloudapi-graphql/etc/containerpilot.json b/cloudapi-graphql/etc/containerpilot.json index b1882eac..4ee6bdfa 100644 --- a/cloudapi-graphql/etc/containerpilot.json +++ b/cloudapi-graphql/etc/containerpilot.json @@ -10,5 +10,38 @@ } ], "backends": [ - ] + ], + "telemetry": { + "port": 9090, + "sensors": [ + { + "name": "graphql_memory_percent", + "help": "percentage of memory used", + "type": "gauge", + "poll": 5, + "check": ["/bin/sensors", "memory"] + }, + { + "name": "graphql_cpu_load", + "help": "cpu load", + "type": "gauge", + "poll": 5, + "check": ["/bin/sensors", "cpu"] + }, + { + "name": "graphql_disk_capacity", + "help": "disk capacity", + "type": "gauge", + "poll": 60, + "check": ["/bin/sensors", "diskcapacity"] + }, + { + "name": "graphql_disk_usage", + "help": "disk usage", + "type": "gauge", + "poll": 60, + "check": ["/bin/sensors", "diskusage"] + } + ] + } } diff --git a/docker-compose.yml b/docker-compose.yml index 095e102f..328cea21 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,7 +76,6 @@ nginx: ports: - 80:80 - 443:443 - - 9090:9090 env_file: .env environment: - CONSUL_AGENT=1 @@ -97,3 +96,17 @@ prometheus: labels: - triton.cns.services=prometheus - com.docker.swarm.affinities=["container!=~*prometheus*"] +############################################################################# +# docs is an open source performance monitoring tool +# it is included here for demo purposes and is not required +############################################################################# +docs: + image: quay.io/yldio/joyent-portal-docs + restart: always + mem_limit: 128m + env_file: .env + ports: + - 80:80 + labels: + - triton.cns.services=docs + - com.docker.swarm.affinities=["container!=~*docs*"] diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 00000000..378eac25 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +build diff --git a/docs/Dockerfile b/docs/Dockerfile new file mode 100644 index 00000000..713e5654 --- /dev/null +++ b/docs/Dockerfile @@ -0,0 +1,16 @@ +FROM jfloff/alpine-python:3.4-slim +RUN /entrypoint.sh \ + -p sphinx \ + -p recommonmark \ + -p sphinx_rtd_theme \ + -a make \ +&& echo + +RUN mkdir -p /docs/ +WORKDIR /docs/ +COPY Makefile . +COPY source ./source/ +RUN make html +WORKDIR /docs/build/html/ +EXPOSE 80 +CMD ["python", "-m", "http.server", "80"] diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..532f2e54 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,56 @@ +NAME := $(lastword $(subst /, ,$(CURDIR))) +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = PrototypeJoyentPortal +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: build +build: + docker build -t quay.io/yldio/joyent-portal-$(NAME) . + +.PHONY: push +push: + docker push quay.io/yldio/joyent-portal-$(NAME) + +.PHONY: test +test: + +.PHONY: test-ci +test-ci: + +.PHONY: install +install: + +.PHONY: start +start: + +.PHONY: install-production +install-production: + +.PHONY: clean +clean: + +.PHONY: lint +lint: + +.PHONY: lint-ci +lint-ci: + +.PHONY: licence-check +lint-ci: diff --git a/docs/README.rst b/docs/README.rst new file mode 100644 index 00000000..7f844c8c --- /dev/null +++ b/docs/README.rst @@ -0,0 +1,49 @@ +Prototype Joyent Portal Docs +************** + +This repo contains the source code for the `Prototype Joyent Portal docs`_. + +Contributing +############ + +Fork the repo, make an edit, submit a PR. No patch is too small! <3 + +Building locally +################ + +1. Install `Sphinx `_. +2. Install ``sphinx_rtd_theme`` with ``pip install sphinx_rtd_theme`` +3. Run ``make html`` +4. Open ``build/html/index.html`` in your browser. + +Deployment +########## + +``master`` is automatically deployed to `https://xxx `_. + +License +####### + +This project was forked from `https://github.com/shoreditch-ops/artillery-docs`_ + +:: + + The MIT License (MIT) + Copyright (c) 2015-2016 Shoreditch Ops Ltd + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/docs/circle.yml b/docs/circle.yml new file mode 100644 index 00000000..327866c9 --- /dev/null +++ b/docs/circle.yml @@ -0,0 +1,22 @@ +machine: + python: + version: 2.7.5 + environment: + PATH: "/usr/local/bin:${PATH}" +dependencies: + cache_directories: + - "~/.apt-cache" + pre: + - sudo rm -rf /var/cache/apt/archives && sudo ln -s ~/.apt-cache /var/cache/apt/archives && mkdir -p ~/.apt-cache/partial + - sudo apt-get update; sudo apt-get install python-sphinx + - pip install sphinx_rtd_theme + - pip install s3cmd +test: + override: + - make html +deployment: + production: + branch: master + commands: + - cp .s3cfg ~/.s3cfg + - bash scripts/deploy.sh diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 00000000..f45ee3ed --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Prototype Joyent Portal documentation build configuration file, created by +# sphinx-quickstart on Fri Jan 27 11:28:13 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) +import sphinx_rtd_theme + + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.githubpages'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +from recommonmark.parser import CommonMarkParser + +source_parsers = {'.md': CommonMarkParser} +source_suffix = ['.rst', '.md'] + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = 'Prototype Joyent Portal' +copyright = '2017, YLD and Make Us Proud' +author = 'YLD and Make Us Proud' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '1.0' +# The full version, including alpha/beta/rc tags. +release = '1.0.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "sphinx_rtd_theme" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'PrototypeJoyentPortaldoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'PrototypeJoyentPortal.tex', 'Prototype Joyent Portal Documentation', + 'YLD and Make Us Proud', 'manual'), +] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'prototypejoyentportal', 'Prototype Joyent Portal Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'PrototypeJoyentPortal', 'Prototype Joyent Portal Documentation', + author, 'PrototypeJoyentPortal', 'One line description of project.', + 'Miscellaneous'), +] + + + diff --git a/docs/source/currentprogress.md b/docs/source/currentprogress.md new file mode 100644 index 00000000..4a793dac --- /dev/null +++ b/docs/source/currentprogress.md @@ -0,0 +1,28 @@ +# Current Progress + +## UI + +[Viewable Here](http://nginx.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone/) + +The UI is a set of components that have been built using react, they are viewable +using the link above, which is a running version of react-storybook. + +## Frontend + +[Viewable Here](http://frontend.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone:8000/) + +## Docs + +[Viewable Here](http://docs.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone/) + +## CloudAPI Graphql + +[Accessible Here](http://cloudapi.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone:3000/) + +## Spikes + +The spikes within this project is small pieces of work, implementing features that +we are either not too sure about or wish to find more information on. + +Spikes are not currently hosted anywhere, however they are accessible from github +within the main repository. diff --git a/docs/source/deployment.md b/docs/source/deployment.md new file mode 100644 index 00000000..0ba92551 --- /dev/null +++ b/docs/source/deployment.md @@ -0,0 +1,61 @@ +# Deployment + +The project as it stands is a monorepo, each part of this prototype +(cloudapi-graphql, ui, frontend, nginx) can be found in the root directory. + +We currently are using [CircleCI](https://circleci.com/gh/yldio/joyent-portal/) +for continuous deployment. As soon as a commit is push to Github, we fire a hook +off to CircleCI which kicks off our tests. + +CircleCI is configured through the [circle.yaml](https://github.com/yldio/joyent-portal/blob/master/circle.yml) +found at the root of the project. The main take from this is that we install and +setup our dependencies such as docker, docker-compose, triton and yarn. CircleCI +then runs the appropriate Makefile command. + +## Configuration + +CircleCI is configured purely from environment variables. The current set of +variables are defined below, The SDC\_ variables are pulled directly from the +output of `triton env` and inserted into CircleCI to simplifying setting up triton-cli +in a testing environment. + +We also have some \_DOCKER\_ variables, again these are used by triton, but because +we wish to build and push the images inside CircleCI we only use them at deployment. + +The docker login username and password is derived from a robot account quay.io + + +``` +COMPOSE_HTTP_TIMEOUT +NPM_TOKEN +SDC_ACCOUNT +SDC_KEY_ID +SDC_URL +_DOCKER_CERT_PATH +_DOCKER_HOST +_DOCKER_LOGIN_PASSWORD +_DOCKER_LOGIN_USERNAME +_DOCKER_REGISTRY +_DOCKER_TLS_VERIFY +``` + +Other environment variables in use come directly from CircleCI, and a reference +of these can be found [here](https://circleci.com/docs/environment-variables/) + +## Docker Images + +Each of the service contained within the Joyent Portal repository is deployed +using docker, the are built and tested in CI and when passing are pushed to +[Quay.io](https://quay.io/repository/) under the yldio organisation. + +Images are usually built from our own base image [alpine-node-containerpilot](https://github.com/yldio/alpine-node-containerpilot) +For prosperity, the alpine-node-containerpilot is tagged in quay.io as `latest` +always points at `master`. These tags should represent the version of node being +ran `:6.4.4` and should have a postfix for any no-node changes to the image +`:6.4.4-2`. + +## /.bin/deploy + +This command is ran at the point when all of the tests are passing. It fires off +a call to `docker-compose -d up`. This can equally be ran on a developers machine +if manual intervention is needed. diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 00000000..1da57b72 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,14 @@ +.. Prototype Joyent Portal documentation master file, created by + sphinx-quickstart on Fri Jan 27 11:28:13 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Prototype Joyent Portal's documentation! +=================================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + currentprogress + deployment diff --git a/frontend/Dockerfile b/frontend/Dockerfile index db2992cb..68b84ed9 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1 +1 @@ -FROM quay.io/yldio/alpine-node-containerpilot:6.9.3 +FROM quay.io/yldio/alpine-node-containerpilot:6.9.4-3 diff --git a/frontend/etc/containerpilot.json b/frontend/etc/containerpilot.json index 2c2bd9b1..a82ba53a 100644 --- a/frontend/etc/containerpilot.json +++ b/frontend/etc/containerpilot.json @@ -10,5 +10,38 @@ } ], "backends": [ - ] + ], + "telemetry": { + "port": 9090, + "sensors": [ + { + "name": "frontend_memory_percent", + "help": "percentage of memory used", + "type": "gauge", + "poll": 5, + "check": ["/bin/sensors", "memory"] + }, + { + "name": "frontend_cpu_load", + "help": "cpu load", + "type": "gauge", + "poll": 5, + "check": ["/bin/sensors", "cpu"] + }, + { + "name": "frontend_disk_capacity", + "help": "disk capacity", + "type": "gauge", + "poll": 60, + "check": ["/bin/sensors", "diskcapacity"] + }, + { + "name": "frontend_disk_usage", + "help": "disk usage", + "type": "gauge", + "poll": 60, + "check": ["/bin/sensors", "diskusage"] + } + ] + } } diff --git a/frontend/package.json b/frontend/package.json index 7120cc5d..a54bf67d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -43,6 +43,7 @@ "react-redux": "^5.0.2", "react-router": "4.0.0-alpha.6", "reduce-reducers": "^0.1.2", + "react-select": "^1.0.0-rc.2", "redux": "^3.6.0", "redux-actions": "^1.2.0", "redux-batched-actions": "^0.1.5", diff --git a/frontend/src/components/people-list/index.js b/frontend/src/components/people-list/index.js index 765f6794..4660c6ea 100644 --- a/frontend/src/components/people-list/index.js +++ b/frontend/src/components/people-list/index.js @@ -14,8 +14,9 @@ const buttonStyle = { const People = (props) => { const { - orgUI = {}, + UI = {}, handleToggle, + people } = props; return ( @@ -23,7 +24,7 @@ const People = (props) => { - - + const InputStyle = { + float: 'left', + width: '75%' + }; - + const AddButtonStyle = { + float: 'right', + width: '20%' + }; - - - - ); -}; + const styleInline = { + display: 'inline-block' + }; -Invite.propTypes = { - handleToggle: React.PropTypes.func, - // orgUI: React.PropTypes.obj, - // people: React.PropTypes.arrayOf(PropTypes.person) -}; + const selectData = this.getFormattedPlatformMembers(); + + const handleSelectChange = (v) => { + this.setState({ + selectValue: v + }); + }; + + return ( + + +

Search for a person by name or email or enter an email address + to invite someone new.

+ + + + {/*TODO: Fix why there are issues with webpack and nodemodules*/} +