Skip to content

Commit

Permalink
Migrate to Compose 3.3 (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
philtrep authored Feb 8, 2018
1 parent d923526 commit 42d0264
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 89 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ You can use NoDock for simple projects by using one of the [examples](#Examples)
<a name="Requirements"></a>
## Requirements

* [Docker Engine 1.12+](https://docs.docker.com/engine/installation/)
* [Docker Engine 17.06+](https://docs.docker.com/engine/installation/)
* [Docker Compose 1.8+](https://docs.docker.com/compose/install/)

<a name="Installation"></a>
Expand Down Expand Up @@ -176,7 +176,15 @@ To add more node containers, simply add the following to your `docker-compose.ov
# docker-compose.override.yml
[...]
node2: # name of new container
extends: node # extends the settings from the "node" container
build: # reuse the same values from the node service, cannot use extends in docker-compose 3+
context: ./node
args:
- NODE_VERSION=latest
- PROJECT_PATH=/opt/app/
- NODE_ENV=production
- YARN=false
volumes:
- ../:/opt/app
entrypoint: run-nodock "node alternate.js" # the entrypoint for the "node2" container
nginx:
ports:
Expand Down
4 changes: 2 additions & 2 deletions _examples/2-nodes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Copy all the files in this folder to the project root:
```bash
cd <project_folder>/

cp -r nodock/_examples/multiple-node/* .
cp -r nodock/_examples/2-nodes/* .
mv docker-compose.override.yml nodock/
mv node2.conf nodock/nginx/sites/
```
Expand All @@ -20,4 +20,4 @@ cd nodock/
docker-compose up -d node node2 nginx
```

By going to `127.0.0.1` in your browser you should be seeing a nice greeting! By going to `127.0.0.1:10000` in your browser you should be seeing _another_ nice greeting!
By going to `127.0.0.1` in your browser you should be seeing a nice greeting! By going to `127.0.0.1:10000` in your browser you should be seeing _another_ nice greeting!
11 changes: 8 additions & 3 deletions _examples/2-nodes/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# docker-compose.override.yml

version: '2'
version: '3.3'

services:
node2: # name of new container
extends: node # extends the settings from the "node" container
build:
context: ./node
args:
- NODE_VERSION=latest
- PROJECT_PATH=second-app
- NODE_ENV=production
- YARN=false
volumes:
- ../:/opt/app
entrypoint: run-nodock "node index.js" # the entrypoint for the "node2" container

nginx:
ports:
- "10000:10000" # the port(s) to forward for the "node2" container
links:
- node2 # link "nginx" to "node2"
- node2 # link "nginx" to "node2"
21 changes: 0 additions & 21 deletions _examples/rabbitmq/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions _examples/rabbitmq/index.js

This file was deleted.

15 changes: 0 additions & 15 deletions _examples/rabbitmq/package.json

This file was deleted.

5 changes: 3 additions & 2 deletions apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ RUN mkdir /usr/local/apache2/templates \
&& mkdir /usr/local/apache2/sites-available \
&& rm /usr/local/apache2/conf/httpd.conf \
&& rm /usr/local/apache2/conf/extra/*.conf
ADD httpd.conf /usr/local/apache2/conf

COPY httpd.conf /usr/local/apache2/conf/httpd.conf

COPY scripts /root/scripts/
COPY certs/* /etc/ssl/
COPY certs /etc/ssl/

COPY sites /usr/local/apache2/templates

Expand Down
Empty file added apache/certs/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion apache/httpd.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ServerRoot "/usr/local/apache2"

LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
Expand Down Expand Up @@ -28,7 +29,6 @@ LoadModule alias_module modules/mod_alias.so
<IfModule unixd_module>
User www-data
Group www-data

</IfModule>

ServerAdmin you@example.com
Expand Down
39 changes: 14 additions & 25 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3.3'

services:

Expand All @@ -23,17 +23,17 @@ services:
- MYSQL_USER=default_user
- MYSQL_PASSWORD=secret
- MYSQL_ROOT_PASSWORD=root
volumes_from:
- volumes
volumes:
- ./data/mysql/:/var/lib/mysql
expose:
- "3306"

mongo:
build: ./mongo
expose:
- "27017"
volumes_from:
- volumes
volumes:
- ./data/mongo/:/var/lib/mongodb

nginx:
build:
Expand All @@ -43,8 +43,9 @@ services:
- WEB_SSL=false
- SELF_SIGNED=false
- NO_DEFAULT=false
volumes_from:
- volumes
volumes:
- ./data/logs/nginx/:/var/log/nginx
- ./certbot/certs/:/var/certs
ports:
- "80:80"
- "443:443"
Expand All @@ -58,8 +59,9 @@ services:
- WEB_SSL=false
- SELF_SIGNED=false
- NO_DEFAULT=false
volumes_from:
- volumes
volumes:
- ./data/logs/apache/:/usr/local/apache2/logs
- ./certbot/certs/:/var/certs
ports:
- "80:80"
- "443:443"
Expand All @@ -71,8 +73,9 @@ services:
links:
- apache
- nginx
volumes_from:
- volumes
volumes:
- ./certbot/letsencrypt/:/var/www/letsencrypt
- ./certbot/certs/:/var/certs

rabbitmq:
build:
Expand All @@ -95,14 +98,10 @@ services:
- nginx
volumes:
- ../:/opt/app
volumes_from:
- volumes

memcached:
build:
context: ./memcached
volumes_from:
- volumes
expose:
- "11211"

Expand All @@ -116,13 +115,3 @@ services:
- "29015"
ports:
- "28080:8080"

volumes:
image: tianon/true
volumes:
- ./certbot/letsencrypt/:/var/www/letsencrypt
- ./certbot/certs/:/var/certs
- ./data/mysql:/var/lib/mysql
- ./data/mongo:/var/lib/mongodb
- ./data/logs/nginx/:/var/log/nginx
- ./data/logs/apache/:/usr/local/apache2/logs
6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ga('create', 'UA-87277646-1', 'auto');
ga('send', 'pageview');
</script>
<a href="https://github.com/you"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
<a href="https://github.com/Osedea/nodock"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
<div class="top-section">
<div class="container">
<div class="row">
Expand Down Expand Up @@ -59,7 +59,7 @@ <h3>Framework Agnostic</h3>
<div class="col-xs-12 col-sm-4">
<h3>Better, Faster &amp; Stronger</h3>
<p>
Docker + Docker Compose ensures your environment is fast and stable for development, testing and production.
Docker + Docker Compose v3 ensures your environment is fast and stable for development, testing and production.
</p>
</div>
<div class="col-xs-12 col-sm-4">
Expand Down Expand Up @@ -110,4 +110,4 @@ <h5 class="text-right">... with more coming!</h5>
</div>
</footer>
</body>
</html>
</html>

0 comments on commit 42d0264

Please sign in to comment.