Skip to content

Commit

Permalink
Merge pull request #3219 from jeff1evesque/feature-2935
Browse files Browse the repository at this point in the history
#2935: Replace puppet 'docker' with containers
  • Loading branch information
jeff1evesque authored May 2, 2018
2 parents e152910 + 6e4c86a commit e1f4a93
Show file tree
Hide file tree
Showing 183 changed files with 2,130 additions and 3,501 deletions.
20 changes: 9 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,29 @@
!factory.py
!license.md
!contributing.md
!Vagrantfile
!{docker-compose,rancher-template}.development.yml
!/install_rancher
!/puppet/
!/test
!/log/
!*.dockerfile
!/dockerfile
!.coveragerc
!/utility/

# Ignore and don't commit the following directories
*.sass-cache/
*__pycache__/
*.pytest_cache/
*.cache/
/interface/static/js/
/interface/static/css/
/interface/static/img/
/interface/static/node_modules/
/interface/static/js
/interface/static/css
/interface/static/node_modules
/src/node_modules/
/puppet/environment/*/modules_contrib/

# Ignore and don't commit the following files
*.pyc
*npm-debug.log
/src/js/.gitignore
/log/database
/log/application
/log/webcompiler
/log/webserver
/log/*.log
/log/{application,database,webcompiler,webserver,*.log}
/test/*.log
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ sudo: required

## configurations
before_install:
- PROJECT_DIRECTORY=$(pwd)
- chmod u+x test/linter
- chmod u+x test/unit-tests

Expand All @@ -15,8 +14,8 @@ install:

## lint and test
script:
- ./test/linter run "$PROJECT_DIRECTORY"; LINT_EXIT=$?
- ./test/unit-tests "$PROJECT_DIRECTORY"
- ./test/linter run; LINT_EXIT=$?
- ./test/unit-tests --norecycle --verbose; TEST_EXIT=$?

## results: the following commands are run after linting, and tests have completed.
##
Expand All @@ -27,4 +26,6 @@ script:
after_success:
- coverage combine
- coveralls
- if [ "$LINT_EXIT" -gt 0 ]; then exit 1; fi
- if [ "$LINT_EXIT" -gt 0 ] && [ "$TEST_EXIT" -gt 0 ]; then echo "Lint ($LINT_EXIT) and Unit Tests failed" && exit 1; fi
- if [ "$LINT_EXIT" -gt 0 ]; then echo "Lint Failed ($LINT_EXIT)" && exit 1; fi
- if [ "$TEST_EXIT" -gt 0 ]; then echo 'Unit Tests failed' && exit 1; fi
48 changes: 9 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ Please adhere to [`contributing.md`](https://github.com/jeff1evesque/machine-lea

## Configuration

Fork this project, and remember to [generate](https://github.com/jeff1evesque/machine-learning/blob/master/doc/configuration/ssh_keys.rst)
ssh keys, before cloning the repository:
Fork this project, using of the following methods:

- [simple clone](https://github.com/jeff1evesque/machine-learning/blob/master/doc/configuration/setup_clone.rst#simple-clone):
clone the remote master branch.
Expand All @@ -34,49 +33,20 @@ Fork this project, and remember to [generate](https://github.com/jeff1evesque/ma
- [release tag](https://github.com/jeff1evesque/machine-learning/blob/master/doc/configuration/setup_clone.rst#release-tag):
clone the remote branch, associated with the desired release tag.

**Note:** the [`puppetfile.rst`](https://github.com/jeff1evesque/machine-learning/blob/master/doc/background/puppetfile.rst)
can be reviewed, to better understand why ssh keys are required.

## Installation

In order to proceed with the installation for this project, two dependencies
need to be installed:

- [Vagrant](https://www.vagrantup.com/)
- [Virtualbox](https://www.virtualbox.org/) (with extension pack)

Once the necessary dependencies have been installed, execute the following
command to build the virtual environment:

```bash
cd /path/to/machine-learning/
vagrant up
```

Depending on the network speed, the build can take between 10-15 minutes. So,
grab a cup of coffee, and perhaps enjoy a danish while the virtual machine
builds. Remember, the application is intended to run on localhost, where the
[`Vagrantfile`](https://github.com/jeff1evesque/machine-learning/blob/master/Vagrantfile)
defines the exact port-forward on the host machine.

**Note:** a more complete refresher on virtualization, can be found within the
vagrant [wiki page](https://github.com/jeff1evesque/machine-learning/wiki/Vagrant).

The following lines, indicate the application is accessible via `localhost:8080`,
on the host machine:
To proceed with the installation for this project, both docker and rancher must be
installed. Installing docker must be done manually, to fulfill a set of [dependencies](https://jeff1evesque.github.io/machine-learning.docs/latest/installation/dependencies).
Once completed, rancher can be installed, and automatically configured, by simply
executing a provided bash script, from the docker quickstart terminal:

```bash
...
## Create a forwarded port mapping which allows access to a specific port
## within the machine from a port on the host machine. In the example below,
## accessing "localhost:8080" will access port 80 on the guest machine.
main.vm.network 'forwarded_port', guest: 5000, host: 8080
main.vm.network 'forwarded_port', guest: 6000, host: 9090
...
cd /path/to/machine-learning
./install-rancher
```

**Note:** ssl is configured on the [reverse proxy](https://www.nginx.com/resources/admin-guide/reverse-proxy/),
such that accessing `http://localhost:8080`, on the host machine, will redirect to `https://localhost:8080`.
**Note:** the installation, and the configuration of rancher, has been [outlined](https://jeff1evesque.github.io/machine-learning.docs/latest/installation/rancher)
if more explicit instructions are needed.

## Execution

Expand Down
94 changes: 0 additions & 94 deletions Vagrantfile

This file was deleted.

18 changes: 5 additions & 13 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,11 @@
from factory import create_app

# run unit test
if len(sys.argv) > 1:
if sys.argv[1] == 'test':
pytest.main([
'--cov', '.',
'test/live_server'
])
elif sys.argv[1] == 'run-api':
args = {
'prefix': 'test/hiera',
'instance': 'programmatic'
}
app = create_app(args)
app.run(host='0.0.0.0')
if sys.argv[1] == 'test':
pytest.main([
'--cov', '.',
'test/live_server'
])

# run application
else:
Expand Down
4 changes: 2 additions & 2 deletions brain/validator/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def load_min(app=True, root='/var/machine-learning'):
min_c = current_app.config.get('PASSWORD_MIN_C', None)
return {'password_min_c': min_c, 'error': None}
else:
with open(root + '/hiera/test/hiera/application.yaml', 'r') as stream:
with open(root + '/hiera/application.yaml', 'r') as stream:
try:
yamlres = yaml.load(stream)
min_c = yamlres['validate_password']['password_min_c']
Expand All @@ -44,7 +44,7 @@ def load_max(app=True, root='/var/machine-learning'):
max_c = current_app.config.get('PASSWORD_MAX_C', None)
return {'password_max_c': max_c, 'error': None}
else:
with open(root + '/hiera/test/hiera/application.yaml', 'r') as stream:
with open(root + '/hiera/application.yaml', 'r') as stream:
try:
yamlres = yaml.load(stream)
max_c = yamlres['validate_password']['password_max_c']
Expand Down
47 changes: 0 additions & 47 deletions default.dockerfile

This file was deleted.

35 changes: 0 additions & 35 deletions doc/background/puppetfile.rst

This file was deleted.

38 changes: 0 additions & 38 deletions doc/configuration/ssh-keys.rst

This file was deleted.

Loading

0 comments on commit e1f4a93

Please sign in to comment.