Skip to content

Commit

Permalink
lets deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahalwy committed Aug 7, 2016
1 parent 0ded384 commit 49067c9
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 34 deletions.
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM node:6.3

ENV NODE_ENV production
ENV API_URL http://localhost:8080
ENV SENTRY_KEY_CLIENT https://[email protected]/80639
ENV SENTRY_KEY_SERVER https://44c105328ae544ae9928f9eb74b40061:[email protected]/80639
ENV PORT 8000

RUN apt-get -y update && apt-get -y install supervisor ssh rsync

# logrotate
RUN apt-get -y install logrotate
COPY docker/supervisord.conf /etc/supervisor/supervisord.conf
COPY docker/pm2.logrotate.conf /etc/logrotate.d/pm2
RUN cp /etc/cron.daily/logrotate /etc/cron.hourly

# cache npm install when package.json hasn't changed
WORKDIR /tmp
ADD package.json package.json
RUN npm install
RUN npm install -g pm2

RUN mkdir /quran
RUN cp -a /tmp/node_modules /quran

WORKDIR /quran
ADD . /quran/
RUN npm run build

# ssh keys
WORKDIR /root
RUN mv /quran/.ssh /root/

# upload js and css
WORKDIR /quran/static/dist
RUN rsync --update --progress -raz . [email protected]:zones/assets/

# go back to /quran
WORKDIR /quran

EXPOSE 8000
CMD ["supervisord", "--nodaemon", "-c", "/etc/supervisor/supervisord.conf"]
31 changes: 15 additions & 16 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"name": "react-redux-universal-hot-example",
"description": "Example of an isomorphic (universal) webapp using react redux and hot reloading",
"repository": "https://github.com/erikras/react-redux-universal-hot-example",
"logo": "http://node-js-sample.herokuapp.com/node.svg",
"keywords": [
"react",
"isomorphic",
"universal",
"webpack",
"express",
"hot reloading",
"react-hot-reloader",
"redux",
"starter",
"boilerplate",
"babel"
"apps": [
{
"name": "API",
"script": "./bin/api.js",
"env": {
"NODE_PATH": "./api"
}
},
{
"name": "CLIENT",
"script": "./bin/server.js",
"env": {
"NODE_PATH": "./src"
}
}
]
}
17 changes: 0 additions & 17 deletions circle.yml

This file was deleted.

11 changes: 11 additions & 0 deletions docker/pm2.logrotate.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/root/.pm2/logs/*.log {
hourly
missingok
rotate 8760
dateext
compress
delaycompress
notifempty
create 0640 www-data adm
copytruncate
}
11 changes: 11 additions & 0 deletions docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[supervisord]
nodaemon=true

[program:pm2]
command=pm2 start app.json -i 0 --no-daemon
directory=/quran
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
auto_start=true
autorestart=true
2 changes: 1 addition & 1 deletion webpack/prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
cache: false,
entry: [
'bootstrap-sass!./bootstrap.config.prod.js',
'./client.js',
'./src/client.js',
],
stats: {
colors: true,
Expand Down

0 comments on commit 49067c9

Please sign in to comment.