brand new docker container and updated readme
This commit is contained in:
parent
ccd287491d
commit
fc3b27f0b9
2
.gitignore
vendored
2
.gitignore
vendored
@ -12,6 +12,7 @@
|
||||
/tmp/*
|
||||
!/log/.keep
|
||||
!/tmp/.keep
|
||||
tmux*log
|
||||
|
||||
### Ruby ###
|
||||
*.gem
|
||||
@ -60,3 +61,4 @@ application.yml
|
||||
|
||||
# Ignore application configuration
|
||||
/config/application.yml
|
||||
.container-setup
|
||||
|
@ -1,5 +0,0 @@
|
||||
set -g mode-mouse on
|
||||
set -g mouse-resize-pane on
|
||||
set -g mouse-select-pane on
|
||||
set -g mouse-select-window on
|
||||
set -g history-limit 30000
|
43
Dockerfile
43
Dockerfile
@ -1,43 +0,0 @@
|
||||
FROM mysql:5.7
|
||||
MAINTAINER Mark Moser <markamoser@gmail.com>
|
||||
|
||||
WORKDIR ~/
|
||||
|
||||
ENV MYSQL_ROOT_PASSWORD=root
|
||||
ENV BUILD_PACKAGES="build-essential libmysqlclient-dev openssl graphviz nodejs curl wget zlib1g-dev tmux"
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install --fix-missing -y $BUILD_PACKAGES \
|
||||
&& /usr/sbin/mysqld --initialize --user=mysql \
|
||||
&& service mysql start \
|
||||
&& echo 'gem: --no-document' >> ~/.gemrc \
|
||||
&& cp ~/.gemrc /etc/gemrc \
|
||||
&& chmod uog+r /etc/gemrc \
|
||||
&& mkdir -p /usr/app \
|
||||
&& ln -s /usr/bin/nodejs /usr/bin/node \
|
||||
&& echo "alias ll='ls -Ahl'" >> /root/.bashrc \
|
||||
&& echo "alias la='ls -ahl'" >> /root/.bashrc \
|
||||
&& echo "export HISTCONTROL=ignoredups" >> /root/.bashrc
|
||||
|
||||
# RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
|
||||
# RUN apt-get update\
|
||||
# && apt-get install --yes nodejs
|
||||
|
||||
# install current Ruby
|
||||
RUN curl -L --progress https://github.com/postmodern/ruby-install/archive/v0.6.0.tar.gz | tar xz \
|
||||
&& cd ruby-install-0.6.0 \
|
||||
&& make install \
|
||||
&& cd ../ \
|
||||
&& ruby-install --system ruby \
|
||||
&& gem install bundler
|
||||
|
||||
COPY .tmux.conf /root/
|
||||
COPY Gemfile* /root/
|
||||
RUN cd /root \
|
||||
&& bundle install \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
EXPOSE 3000 3306 35729
|
||||
WORKDIR /usr/app
|
||||
CMD /bin/bash
|
68
README.md
68
README.md
@ -2,34 +2,58 @@
|
||||
|
||||
This application manages quizzes intended to be used as pre-interview skill assessments.
|
||||
|
||||
## Development
|
||||
|
||||
* Please use Guard when you are developing
|
||||
* `bundle exec guard`
|
||||
* Honor RuboCop warnings
|
||||
* Keep tests green
|
||||
* Write tests around new development
|
||||
* Always pull with rebase!
|
||||
* `git config --global pull.rebase true`
|
||||
* Make sure to include any new development data needs in the fixture files
|
||||
* test/fixtures/...
|
||||
* feature branches are nice, but never merge develop down to them. Instead rebase feature branches onto develop.
|
||||
|
||||
# dev
|
||||
* you can dev native, or in docker
|
||||
* use guard
|
||||
* honor RuboCop
|
||||
* keep tests green
|
||||
* pull --rebase !always `git config --global pull.rebase true`
|
||||
### Setup
|
||||
* clone
|
||||
* checkout develop
|
||||
* bundle
|
||||
* npm install
|
||||
* bower install
|
||||
* cd vendor/assets/ && bitters install && cd ../..
|
||||
* place all required dev seed data in fixtures for rails db:fixtures:load
|
||||
* cp config/application.yml.sample config/application.yml
|
||||
* edit and update proper values to application.yml
|
||||
* rake db:setup
|
||||
* rake db:migrate
|
||||
* rake db:fixtures:load
|
||||
|
||||
# Docker
|
||||
## Docker
|
||||
|
||||
* ./start-docker.sh
|
||||
- will build source image, it not exist
|
||||
- created contaier and starts
|
||||
* ./start-dev.sh
|
||||
- after connected to container, run this to spin up a dev session
|
||||
- edit files from host in favorite editor
|
||||
* ./start-server.sh
|
||||
- starts up simple server for viewing/demo sans guard
|
||||
You can develop in this app with a native rails install, if you prefer. However, there is also a docker image setup if you do not want to install all the supporting gems and libraries.
|
||||
|
||||
visit http://localhost:3000
|
||||
To use the docker container, you need to install and launch docker, which can be found here:
|
||||
https://www.docker.com/products/docker
|
||||
|
||||
Once the container is started, you can still edit files from your host project directory.
|
||||
|
||||
visit http://localhost:3000 like normal
|
||||
|
||||
There are some convenience scripts included to make starting the container and rails app easier.
|
||||
|
||||
#### `./start-docker.sh`
|
||||
* Execute from terminal, on the host machine, in the project directory
|
||||
- This will pull the image from dockerhub, if needed
|
||||
- Create and start up container
|
||||
|
||||
#### Once in the container:
|
||||
* `./start-dev.sh`
|
||||
* will spin up a dev session with tmux
|
||||
* `./start-server.sh`
|
||||
- starts up just rails server for viewing application
|
||||
|
||||
|
||||
----
|
||||
|
||||
# Question creation
|
||||
|
||||
* attachments: http://dev.perficientxd.com/skill_assets/
|
||||
## TODOs and notes
|
||||
|
||||
* Question attachment path: http://dev.perficientxd.com/skill_assets/
|
||||
* clean code / [Confident Ruby](http://www.confidentruby.com/)
|
||||
|
11
bower.json
11
bower.json
@ -1,18 +1,11 @@
|
||||
{
|
||||
"name": "skill-assessment-app",
|
||||
"authors": [
|
||||
"Harish Bhavanichikar",
|
||||
"Jennifer Siegfried",
|
||||
"Derek Montgomery",
|
||||
"Mark Moser"
|
||||
],
|
||||
"name": "rails-dev",
|
||||
"authors": [""],
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"jquery": "1.9.1",
|
||||
"handlebars": "3.0.2",
|
||||
"jquery-validate": "",
|
||||
"tota11y": "",
|
||||
"jquery-mockjax": "^2.1.1",
|
||||
"modernizr-lite": "*"
|
||||
},
|
||||
"ignore": [
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "skill-assessment-app",
|
||||
"name": "rails-dev",
|
||||
"version": "1.0.0",
|
||||
"description": "This application manages quizzes intended to be used as pre-interview skill assessments.",
|
||||
"description": "rails-dev assets",
|
||||
"dependencies": {
|
||||
"bower": "^1.7.9",
|
||||
"eslint": "^3.2.2"
|
||||
@ -9,7 +9,7 @@
|
||||
"devDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@gitlab.perficientxd.com:pdr/skill-assessment-app.git"
|
||||
"url": ""
|
||||
},
|
||||
"license": "ISC"
|
||||
}
|
||||
|
21
start-dev.sh
21
start-dev.sh
@ -1,20 +1,29 @@
|
||||
#!/bin/bash
|
||||
if [ -d '/usr/app' ]; then
|
||||
cd /usr/app
|
||||
if [ ! -f 'config/application.yml' ]; then
|
||||
echo ''
|
||||
echo -e "\E[1;31m###################################"
|
||||
echo "Missing application.yml"
|
||||
echo -e "\E[1;32m cp config/application.yml.sample config/application.yml"
|
||||
tput sgr0
|
||||
echo "edit and update proper values"
|
||||
echo ''
|
||||
else
|
||||
if [ ! -f '~/.container-setup' ]; then
|
||||
bundle
|
||||
npm install
|
||||
bower install
|
||||
bower install --allow-root
|
||||
cd vendor/assets/ && bitters install && cd /usr/app
|
||||
|
||||
service mysql start
|
||||
rails db:setup
|
||||
rails db:migrate
|
||||
rails db:fixtures:load
|
||||
|
||||
touch ~/.container-setup
|
||||
fi
|
||||
tmux new-session -d -s 'rails-dev' 'rails s -b 0.0.0.0'
|
||||
tmux split-window -p 15 -v
|
||||
tmux split-window -p 85 -v 'bundle exec guard'
|
||||
tmux split-window -p 20 -v
|
||||
tmux attach -t rails-dev
|
||||
fi
|
||||
else
|
||||
echo "Are you in docker container?"
|
||||
fi
|
||||
|
@ -1,16 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
IMAGE=markamoser/deb-mysql-rails
|
||||
IMAGE=markamoser/rails-dev-mysql:latest
|
||||
CONTAINER=`basename ${PWD}`
|
||||
|
||||
# if [ "$(docker images -q $IMAGE:latest 2> /dev/null)" == "" ]; then
|
||||
# docker build -t $IMAGE .
|
||||
# fi
|
||||
|
||||
STATUS=$(docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null)
|
||||
|
||||
if [ $? -eq 1 ]; then
|
||||
docker run --name $CONTAINER -it -p 3000:3000 -p 35729:35729 -p 3306:3306 -v ${PWD}:/usr/app $IMAGE /bin/bash
|
||||
docker run --name $CONTAINER -it -p 3000:3000 -p 35729:35729 -v ${PWD}:/usr/app $IMAGE /bin/bash -c "service mysql start; /bin/bash"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -1,17 +1,27 @@
|
||||
#!/bin/bash
|
||||
if [ -d '/usr/app' ]; then
|
||||
cd /usr/app
|
||||
if [ ! -f 'config/application.yml' ]; then
|
||||
echo ''
|
||||
echo -e "\E[1;31m###################################"
|
||||
echo "Missing application.yml"
|
||||
echo -e "\E[1;32m cp config/application.yml.sample config/application.yml"
|
||||
tput sgr0
|
||||
echo "edit and update proper values"
|
||||
echo ''
|
||||
else
|
||||
if [ ! -f '~/.container-setup' ]; then
|
||||
bundle
|
||||
npm install
|
||||
bower install
|
||||
bower install --allow-root
|
||||
cd vendor/assets/ && bitters install && cd /usr/app
|
||||
|
||||
service mysql start
|
||||
rails db:setup
|
||||
rails db:migrate
|
||||
rails db:fixtures:load
|
||||
|
||||
touch ~/.container-setup
|
||||
fi
|
||||
echo 'Delete ~/.container-setup and re-run startup script to update app.'
|
||||
rails s -b 0.0.0.0
|
||||
fi
|
||||
else
|
||||
echo "Are you in docker container?"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user