Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9637953
cleanup and add comments for better documentation
Feb 10, 2020
4bcfaf0
force Travis CI to use Node js v8
Feb 10, 2020
a42702c
upgrade to node js 12 and bcrypt ^3.0.6
Feb 10, 2020
6965a0c
upgrade Dockerfile to use Node js 12
Feb 10, 2020
5d2eeed
remove deprecated packages from `package-lock.json`
Feb 10, 2020
3ec636f
list all the meteor package installed
Feb 10, 2020
05301e2
try to do automatic updates to flagged issues
Feb 10, 2020
ed9a14e
force update of all packages
Feb 10, 2020
2c284cc
fix typo
Feb 10, 2020
e98384d
add some missing modules
Feb 10, 2020
76988e6
only fire AWS code build if we are on the Master branch
Feb 10, 2020
9ba7177
install more missing dependencies
Feb 10, 2020
a0a6d1a
fix typo
Feb 10, 2020
2102f2d
do not trigger 2 concurren Travis build
Feb 10, 2020
c6f74c0
add missing packages
Feb 10, 2020
d4204e8
add missing packages
Feb 10, 2020
c5c61c8
make sure dependent packages are also updated
Feb 10, 2020
5d8a70b
update modules but do NOT update Meteor
Feb 10, 2020
f553ae9
Dockerimage file forced to use node.js 8.15.1
Feb 10, 2020
1e32279
revert change from https://github.com/unee-t/frontend/pull/905/commit…
Feb 10, 2020
e617551
comment out package upgrades to get Travic CI tests to pass
Feb 11, 2020
9bd82d0
try to minimize erros in the build - See Issue #906
Feb 11, 2020
168e156
try to reinstall all the packages without the cache
Feb 11, 2020
f5b4d2a
get Travis to build a standard ubuntu image (NOT node.js)
Feb 12, 2020
633b2af
tidy up and make sure we run the tests inside meteor
Feb 12, 2020
025907b
Try to fix issue with non native implementation of bcrypt
Feb 12, 2020
d454c72
tidy up - remove unnecessary lines
Feb 12, 2020
cd6e1ed
WIP - explore Dockerfile syntax to build a simpler image
Feb 12, 2020
7ddfcbd
specify the Meteor version that we are using and should install
Feb 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 47 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,75 @@
sudo: required
# Variables needed for this script are:

language: node_js
node_js:
- lts/*
# Case 1: Stored on Travis Settings
# For all environments:
# - DOCKER_CI_REPO_NAME
# - DOCKER_USERNAME
# - DOCKER_PASSWORD

#For dev environment:
# - AWS_ACCOUNT_USER_ID_DEV
# - AWS_ACCOUNT_SECRET_DEV
# - AWS_PROFILE_DEV

#For Prod environment:
# - AWS_ACCOUNT_USER_ID_PROD
# - AWS_ACCOUNT_SECRET_PROD
# - AWS_PROFILE_PROD

#For Demo environment:
# - AWS_ACCOUNT_USER_ID_DEMO
# - AWS_ACCOUNT_SECRET_DEMO
# - AWS_PROFILE_DEMO

# Case 2: Created when Travis CI runs
# - IMAGE_TAG

env:
global:
- COMMIT=${TRAVIS_COMMIT::7}
#Add IMAGE_TAG variable to build docker image
- IMAGE_TAG=${COMMIT}
# What is the meteor version we are using
- METEOR_VERSION=1.8.1

before_install:
# Removed command as pyenv is no longer found during deploy
#- pyenv global 2.7.14 # For removing SNIMissingWarning warnings
- curl https://install.meteor.com | /bin/sh
- curl https://install.meteor.com?release=$METEOR_VERSION | /bin/sh
- export PATH="$HOME/.meteor:$PATH"
- pip install --user awscli
- export PATH=$PATH:$HOME/.local/bin
- curl -o $HOME/.local/bin/ecs-cli
https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest &&
chmod +x $HOME/.local/bin/ecs-cli

cache:
directories:
- node_modules

install:
- meteor npm install
# fix Errors and vulnerabilities
#- meteor npm audit fix

script:
- npm t
# Test that our code is working as expected on that image.
- meteor npm run test

matrix:
include:
- env: DEPLOY=none
- env: DEPLOY=dev
- env: DEPLOY=demo
if: tag IS present
deploy:
provider: script
skip_cleanup: true
script: AWS_ACCESS_KEY_ID=$AWS_915001051872_ID AWS_SECRET_ACCESS_KEY=$AWS_915001051872_SECRET ./deploy.sh -d
script: TRAVIS_PROFILE=$AWS_PROFILE_DEMO AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_DEMO AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_DEMO AWS_REGION=$AWS_DEFAULT_REGION ./deploy.sh -d
on:
branch: master
tags: true
- env: DEPLOY=prod
if: tag IS present
deploy:
provider: script
skip_cleanup: true
script: AWS_ACCESS_KEY_ID=$AWS_192458993663_ID AWS_SECRET_ACCESS_KEY=$AWS_192458993663_SECRET ./deploy.sh -p && AWS_ACCESS_KEY_ID=$AWS_192458993663_ID AWS_SECRET_ACCESS_KEY=$AWS_192458993663_SECRET aws cloudfront create-invalidation --distribution-id E173XT6X8V4A18 --paths '/*'
# TODO - Distribution-id uses a hardcoded value
# This will ONLY work for the main Unee-T installation but no other Unee-T Installation
# This is a problem we need to fix
script: TRAVIS_PROFILE=$AWS_PROFILE_PROD AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_PROD AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_PROD AWS_REGION=$AWS_DEFAULT_REGION ./deploy.sh -p && AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_PROD AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_PROD aws cloudfront create-invalidation --distribution-id E173XT6X8V4A18 --paths '/*'
# END - TODO - Distribution-id uses a hardcoded value
on:
tags: true

env:
global:
- COMMIT=${TRAVIS_COMMIT::7}
branch: master
tags: true
83 changes: 83 additions & 0 deletions Dockerfile_WIP.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# We are using an Ubuntu image
FROM ubuntu:16.04

# We need several environment variables
# The folder where the built application will be stored
ENV APP_DIR /mefe

# The port where the built application will be accessible
ENV PORT 3000

# We create a the user and group that we'll use use to do everything
USER meteor:meteor

# We install several things so we can build the application
# Download Meteor
RUN curl https://install.meteor.com | /bin/sh
RUN export PATH="$HOME/.meteor:$PATH"
# Install Meteor
RUN meteor npm install
# Install pip
RUN sudo apt -y install python-pip
# Upgrade pip to the latest version
RUN pip install --upgrade pip
# Install AWS CLI
RUN pip install --user awscli
RUN export PATH=$PATH:$HOME/.local/bin
RUN curl -o $HOME/.local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest && chmod +x $HOME/.local/bin/ecs-cli

# We create the folder where the app will be built
RUN mkdir -p $APP_DIR
# We copy the meteor `build` bundle into the $APP_DIR (make a few things easier)
# We also make sure that the permissions are correct
COPY bundle /app

# We build the Application
RUN cd $APP_DIR/programs/server && npm install

# We make sure the application is accessible
EXPOSE 3000

# We start the app
CMD ["node", "./main.js"]






ENV BUNDLE_DIR /home/node/bundle
ENV SRC_DIR /home/node/src
ENV TMP_DIR /home/node/tmp

USER node:node

RUN mkdir -p $SRC_DIR $BUNDLE_DIR $TMP_DIR
COPY --chown=node:node . $SRC_DIR

RUN curl -o $TMP_DIR/meteor.sh 'https://install.meteor.com?release=1.8.1'; sh $TMP_DIR/meteor.sh

ENV PATH="/home/node/.meteor:${PATH}"
WORKDIR $SRC_DIR
RUN npm i
RUN meteor npm install --production
# We build the application and put everything in a specific folder
RUN meteor build --server-only --directory $BUNDLE_DIR
RUN cd ${BUNDLE_DIR}/bundle/programs/server && npm install

FROM node:8.15.1-slim

ENV APP_DIR /home/node/app
ENV BUNDLE_DIR /home/node/bundle

USER node:node

COPY --from=builder $BUNDLE_DIR $APP_DIR
WORKDIR $APP_DIR/bundle


ENV PORT 3000
EXPOSE 3000


CMD ["node", "./main.js"]
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@babel/runtime": "^7.1.5",
"bcrypt": "^1.0.3",
"bcrypt": "^3.0.6",
"body-parser": "^1.18.2",
"classnames": "^2.2.5",
"hammerjs": "^2.0.8",
Expand Down