diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..df6f090 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +all: build run + +build: + sudo docker build -t adg-fe container + +run: + sudo docker run -p 80:80 -p 8000:8000 -v ${PWD}:/opt/adagios-frontend -d -t adg-fe bash diff --git a/container/000-default.conf b/container/000-default.conf new file mode 100644 index 0000000..8ce2b07 --- /dev/null +++ b/container/000-default.conf @@ -0,0 +1,16 @@ + + ProxyPreserveHost On + + # Servers to proxy the connection, or; + # List of application servers: + # Usage: + # ProxyPass / http://[IP Addr.]:[port]/ + # ProxyPassReverse / http://[IP Addr.]:[port]/ + # Example: + ProxyPass /app http://localhost:8000/app + ProxyPassReverse /app http://localhost:8000/app + + ProxyPass / http://demo.kaji-project.org/ + ProxyPassReverse / http://demo.kaji-project.org/ + + diff --git a/container/Dockerfile b/container/Dockerfile new file mode 100644 index 0000000..70a02e3 --- /dev/null +++ b/container/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:trusty +MAINTAINER Philippe Pepos Petitclerc + +RUN apt-get update +RUN apt-get install -yq apache2 npm nodejs-legacy supervisor +RUN npm install -g grunt-cli +RUN mkdir -p /var/lock/apache2 /var/run/apache2 /var/run/sshd /var/log/supervisor + +# Add supervisor config files +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# Configure Apache2 for reverse-proxying +ADD 000-default.conf etc/apache2/sites-enabled/000-default.conf +RUN a2enmod proxy +RUN a2enmod proxy_http + +# Expose appropriate ports +EXPOSE 80 8000 + +CMD ["/usr/bin/supervisord"] diff --git a/container/supervisord.conf b/container/supervisord.conf new file mode 100644 index 0000000..26d6bd0 --- /dev/null +++ b/container/supervisord.conf @@ -0,0 +1,12 @@ +[supervisord] +nodaemon=true + +[program:apache2] +command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND" + +[program:npm] +command=/bin/bash -c "cd /opt/adagios-frontend && npm start" + +[program:grunt] +command=/bin/bash -c "cd /opt/adagios-frontend && grunt" + diff --git a/readme.rst b/readme.rst index 62683cf..37cc867 100644 --- a/readme.rst +++ b/readme.rst @@ -9,12 +9,10 @@ Installation :: - sudo apt-get install npm nodejs-legacy ruby + sudo apt-get install npm nodejs-legacy git clone https://github.com/titilambert/adagios-frontend.git cd adagios-frontend npm install - npm install grunt-cli - gem install sass Dev @@ -24,13 +22,18 @@ To watch for sass files change and auto-refresh css run : :: + npm install grunt-cli grunt -To compile css files run : +If you wish to develop in a docker container, here is how to proceed (assuming +you already have docker installed) : :: - grunt sass + sed -i "s/localhost/0.0.0.0/" package.json + make build + make run + curl http://localhost/app Coding style =========== @@ -62,27 +65,3 @@ Launch Now, go on http://127.0.0.1:8000 - -Contributing -============ - -To contribute to this project, please fork the repo. Then do your commits (branch as you will) -and then open a pull-request to this repo's master branch. - -:: - - - git clone your-repo/adagios-frontend - git checkout -b dev-new-feature-xx - git commit ... - git push origin dev-new-feature-xx - - -Good practices before opening a pull request: - - - Run tests with `npm test` - - Lint your .js files with `grunt jslint` - - Make sure your directives are prefixed with `adg` - - Make sure your controllers are suffixed with `Ctrl` - - Resolve merge conflicts locally -