Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker support for the future version
- Loading branch information
Showing
7 changed files
with
130 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +0,0 @@ | ||
REDIS_HOST=${REDIS_PORT_6379_TCP_ADDR} | ||
REDIS_URL=redis://${REDIS_PORT_6379_TCP_ADDR}:${REDIS_PORT_6379_TCP_PORT}/0 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,5 @@ connect.lock | |
sftp-config.json | ||
.ruby-version | ||
jsconfig.json | ||
.vscode/ | ||
.vscode/ | ||
github_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM phusion/baseimage | ||
MAINTAINER Hummingbird Media, Inc. | ||
|
||
# Dependencies: PG client | ||
RUN apt-get update && \ | ||
apt-get install -y curl git postgresql-contrib libpq-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# RVM | ||
RUN command curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \ | ||
curl -L https://get.rvm.io | bash -s stable --ruby=2.2.3 | ||
|
||
# NVM | ||
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash && \ | ||
bash -c "source ~/.nvm/nvm.sh && \ | ||
nvm install v0.12 && \ | ||
nvm alias default v0.12 && \ | ||
npm install -g bower" | ||
|
||
# Dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y python libgmp3-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Hummingbird | ||
RUN mkdir -p /opt/hummingbird/server | ||
WORKDIR /opt/hummingbird/server | ||
|
||
COPY server/Gemfile /opt/hummingbird/server/ | ||
COPY server/Gemfile.lock /opt/hummingbird/server/ | ||
|
||
RUN bash -c "source /usr/local/rvm/scripts/rvm && \ | ||
gem install bundler && \ | ||
bundle install" | ||
|
||
WORKDIR /opt/hummingbird | ||
RUN bash -c "source /usr/local/rvm/scripts/rvm && \ | ||
gem install bundler && \ | ||
gem install foreman" | ||
|
||
COPY . /opt/hummingbird | ||
COPY github_key /root/.ssh/id_rsa | ||
RUN chmod 0600 /root/.ssh/id_rsa | ||
|
||
EXPOSE 3000 | ||
ENTRYPOINT ["/opt/hummingbird/entrypoint.sh"] | ||
CMD ["foreman", "start", "--env=.dockerenv"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
server: cd server && bin/bundle exec puma --port 3000 --environment development | ||
worker: cd server && bin/bundle exec sidekiq -q default -q mailer -q paperclip | ||
client: cd client && ember server --port 4200 --environment development | ||
client: cd client && ./node_modules/.bin/ember server --port 4200 --environment development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
postgres: | ||
image: postgres:9.3 | ||
environment: | ||
POSTGRES_PASSWORD: mysecretpassword | ||
POSTGRES_USER: postgres | ||
redis: | ||
image: redis | ||
web: | ||
build: . | ||
volumes: | ||
- ./:/opt/hummingbird/ | ||
ports: | ||
- 3000 | ||
- 4200 | ||
- 49152:49152 | ||
links: | ||
- postgres | ||
- redis | ||
environment: | ||
RAILS_ENV: development | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
root_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
||
source ${root_path}/server/.env | ||
|
||
export REDIS_HOST=${REDIS_PORT_6379_TCP_ADDR} | ||
export REDIS_URL=redis://${REDIS_PORT_6379_TCP_ADDR}:${REDIS_PORT_6379_TCP_PORT}/0 | ||
|
||
[ -e /usr/local/rvm/scripts/rvm ] && \ | ||
source /usr/local/rvm/scripts/rvm | ||
|
||
ruby --version | ||
|
||
[ -e ~/.nvm/nvm.sh ] && \ | ||
source ~/.nvm/nvm.sh | ||
|
||
node --version | ||
|
||
ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
|
||
pushd ${root_path}/client | ||
|
||
bower install --allow-root | ||
npm install | ||
|
||
popd | ||
|
||
export POSTGRES_HOST=${POSTGRES_PORT_5432_TCP_ADDR} | ||
export POSTGRES_PORT=${POSTGRES_PORT_5432_TCP_PORT} | ||
export POSTGRES_DATABASE=postgres | ||
export POSTGRES_USERNAME=${POSTGRES_ENV_POSTGRES_USER} | ||
export POSTGRES_PASSWORD=${POSTGRES_ENV_POSTGRES_PASSWORD} | ||
export DATABASE_URL=postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE} | ||
|
||
echo "Saving database credentials..." | ||
echo "${POSTGRES_HOST}:${POSTGRES_PORT}:${POSTGRES_DATABASE}:${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}" > \ | ||
~/.pgpass | ||
chmod 0600 ~/.pgpass | ||
|
||
count=$(echo "SELECT COUNT(version) FROM schema_migrations;" | \ | ||
psql -q -d ${POSTGRES_DATABASE} -h ${POSTGRES_HOST} -p ${POSTGRES_PORT} -U ${POSTGRES_USERNAME} -w | \ | ||
tail -n 3 | head -n 1) | ||
status=${PIPESTATUS[0]} | ||
|
||
[ ${status} -ne 0 ] && exit ${status} | ||
|
||
pushd ${root_path}/server | ||
if [ -z "${count}" ]; then | ||
echo "Initializing database..." | ||
bundle exec rake db:create db:schema:load | ||
else | ||
echo "Migrating database..." | ||
bundle exec rake db:migrate | ||
fi | ||
popd | ||
|
||
exec "$@" | ||
|
This file was deleted.
Oops, something went wrong.