Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum Master committed Jul 9, 2019
0 parents commit 4f2d862
Show file tree
Hide file tree
Showing 152 changed files with 6,017 additions and 0 deletions.
136 changes: 136 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
version: 2.1

references:

working_directory: &working_directory
/home/circleci/gitRoot/

repo_cache_key: &repo_cache_key
v1-repo-{{ .Branch }}-{{ .Revision }}

# Step to restore repository from cache
restore_repo: &restore_repo
restore_cache:
key: *repo_cache_key

save_repo: &save_repo
save_cache:
key: *repo_cache_key
paths:
- *working_directory

base_terraform_image: &base_terraform_image
hashicorp/terraform:light

terraform_config: &terraform_config
docker:
- image: *base_terraform_image
environment:
TERRAFORM_DIR: terraform
working_directory: *working_directory
environment:
BASH_ENV: /root/.bashrc

terraform_init: &terraform_init
run:
name: terraform init
command: |
cd /home/circleci/gitRoot/terraform
terraform init
jobs:

# core job
build_test_project:

# assign the working directory
working_directory: *working_directory

# run the steps with Docker as the primary container
# job commands run in this container
# CircleCI Node.js image
# mongodb image - runs in a common network where ports exposed
# on the primary container are available on localhost
docker:
- image: circleci/node:8.12.0-jessie
- image: mongo:4.0.5
command: [mongod, --smallfiles]

# steps that comprise the `build-env` job
steps:

# check out source code to working directory
- checkout

# restore the saved cache after the first run or if `pom.xml` has changed
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
- *restore_repo

# install the Angular CLI
# install the Angular CLI
- run: 'sudo npm install -g @angular/cli'

# create an appRoot directory to install into
- run: mkdir /home/circleci/appRoot

# create a new Angular project shell
- run: cd /home/circleci/appRoot && ng new angular7demo --defaults

# copy the application files from the working directory
- run: cp -r -n /home/circleci/appRoot/angular7demo/ /home/circleci/gitRoot/

# setup the application, copies generated app files to the project directory
- run: cd /home/circleci/gitRoot/angular7demo && npm install --prod && npm run setup

# perform the build into a directory called angular under the dist directory
- run: cd /home/circleci/gitRoot/angular7demo && ng build #--base-href /angular7demo/


# cache the entire project since it covers the npm_modules
# and the files created during ng new
- *save_repo

docker_build:
# assign the working directory
working_directory: *working_directory

docker: # run the steps with Docker
- image: circleci/python:3.7

steps:
- *restore_repo
- setup_remote_docker
- run:
name: creating docker image requiring project env vars DOCKER_USER and DOCKER_PASS
command: |
docker login --username tylertravismya --password 69cutlass
docker build -t realmethods/angular7demo:latest .
docker push realmethods/angular7demo:latest
terraform:
<<: *terraform_config
steps:
- *restore_repo
- *terraform_init
- add_ssh_keys: # fingerprint is returned when the private SSH key is applied to this CircleCI project
fingerprints:
- "50:36:21:3f:3e:fd:de:fc:2f:1f:17:a6:09:6d:1b:dd"
- run:
name: terraform plan
command: |
cd /home/circleci/gitRoot/terraform
terraform plan -out=terraform.plan -var aws-access-key=$USER_AWS_ACCESSKEY -var aws-secret-key=$USER_AWS_SECRETKEY
terraform apply -auto-approve "terraform.plan"
# simple workflow to build out the environment
workflows:
version: 2
build_test_deploy_workflow:
jobs:
- build_test_project
- docker_build:
requires:
- build_test_project
- terraform:
requires:
- docker_build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
code_gen_catch_all/
target/
.git/
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM node:8.12

# this allows for updates to take place without failure
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list

# install curl
RUN apt-get update --fix-missing && \
apt-get install -y dos2unix && \
apt-get install -y sed && \
apt-get install -y nano

# copy all file to a working directory
ARG PROJECT=angular7demo
ARG PROJECT_DIR=/var/www/${PROJECT}
RUN mkdir -p $PROJECT_DIR
COPY . /var/www/
RUN ls /var/www
RUN ls /var/www/angular7demo

# install Angular-CLI
RUN npm install -g @angular/cli

# prepare entrypoint
RUN dos2unix /var/www/entrypoint.sh
RUN chmod +x /var/www/entrypoint.sh
ENTRYPOINT ["/var/www/entrypoint.sh"]
85 changes: 85 additions & 0 deletions angular7demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# realMethods

This Angular/MongoDB (not AngularJS) project was generated with realMethods version 1.1.

The Angular technology stack package it was generated from has been tested with Angular version 7.2.0.


The following instructions assume NPM is installed. If not, you can download it by installing Node.js at
[Node.js Download Page](https://nodejs.org/en/download/)


The realMethods Angular technology stack was developed and tested for Angular 7.

If you have an older version of Angular, you should consider un-installing it in favor of Angular v7:

`npm uninstall -g @angular/cli`
`npm cache verify`

To install Angular, issue the following:

`npm install -g @angular/cli`

Verify the installation with `ng --version`


**Note: It is important to use this name because the next step expects this name.**

`ng new angular7demo --defaults`

The default application files and packages will be installed. The next steps will copy the generated files, overwrite some of the default files and install
the remaining packages.


Either pull the generated files from your Git repository,
or download the generated application archive file and unzip into the parent directory of the **angular7demo** directory
in order to overlay the generated files into it. If asked to replace existing files, answer _Yes_.


Change to the **angular7demo** directory and install the remaining required packages:

`npm run setup`



It is assumed MongoDB is running at:

`mongodb://localhost:27017/angular7demo`

See file ./config/mongoDb.js to make changes to the database location.


The application leverages Mongoose to assist in persisting data to MongoDB.

From the angular7demo directory, start mongoose:

`node server.js`

If it runs successfully, mongoose is listening on port 4000.


You now have a fully functional application to use, test, and build out.

To run the dev server:

`ng serve`

Using your browser, navigate to:

`http://localhost:4200/`.

The app will automatically reload if you change any of the source files.


Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).


Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).


Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

Learn more at [Angular Build](https://angular.io/cli/build/)


To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
134 changes: 134 additions & 0 deletions angular7demo/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular7demo": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/angular7demo",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular7demo:build"
},
"configurations": {
"production": {
"browserTarget": "angular7demo:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular7demo:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"angular7demo-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "angular7demo:serve"
},
"configurations": {
"production": {
"devServerTarget": "angular7demo:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
} }
}
}
},
"defaultProject": "angular7demo"
}
4 changes: 4 additions & 0 deletions angular7demo/config/mongoDb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
DB: 'mongodb://localhost:27017/angular7demo',
mongooseUrl: 'http://localhost:4000'
};
Loading

0 comments on commit 4f2d862

Please sign in to comment.