Skip to content

Commit

Permalink
README and LICENSE
Browse files Browse the repository at this point in the history
  • Loading branch information
maiorano84 committed Dec 17, 2020
1 parent 95bc894 commit 4a42490
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 1 deletion.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2020 Matt Maiorano

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Bedrock Project

A project scaffold for getting up and running quickly with
a [Roots/Bedrock](https://roots.io/bedrock/) project over Docker Compose

# Requirements

* [Docker Desktop](https://www.docker.com/products/docker-desktop) (Win/OSX/Linux)
* [Composer](https://getcomposer.org/)

**NOTE**: `composer` commands can also be substituted for the official
[Composer Docker Image](https://hub.docker.com/_/composer).

All commands in this README assume that Composer is installed natively on your system

# Basic Usage

All references to `<project-name>` can be replaced with the name of your project.

1. Run `composer create-project maiorano84/bedrock-project <project-name> && cd <project-name>`
2. Replace any variables in the `.env` file with your own configuration
3. Run `docker-compose up -d`

Once complete, your Bedrock site will be available at http://localhost

# Pretty URLs

A separate configuration has been provided to enable pretty URLs through
[Traefik](https://traefik.io/)

If you would like to use custom URLs, then you will need to prepare an external Docker Network
and ensure that no other services are running on your host's Port 80 (ie: NGINX, Apache, etc.).

Preparing the Traefik network is only necessary once. Once these commands are complete, any
subsequent Bedrock projects running the Traefik configuration will automatically be served over
that network.

Once the network and the Traefik container are both up and running, you can run the project
with the following: `docker-compose -f docker-compose.traefik.yml up -d`

Once complete, your Bedrock site will be available at `http://${NGINX_SERVER_NAME}`

# Setting up Traefik

The provided Traefik configuration is set up to respond to `*.docker.localhost` and will
automatically proxy requests to the running NGINX configuration.

## Network

```
docker network create -d bridge traefik-network
docker build -t traefik-web ./docker/traefik
```

## Container

```
docker run -itd --restart unless-stopped \
-p 80:80 -p 8080:8080 \
-v /var/run/docker.sock:/var/run/docker.sock \
--name=traefik --network=traefik-network traefik-web
```

Once running, you may also access the Traefik Dashboard by navigating to http://localhost:8080
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
}
],
"scripts": {
"post-root-package-install": "composer create-project roots/bedrock code ; php -r \"copy('.env.example', '.env');\""
"post-root-package-install": "composer create-project --no-scripts --remove-vcs roots/bedrock code ; php -r \"copy('.env.example', '.env');\""
}
}
2 changes: 2 additions & 0 deletions docker/traefik/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM traefik:2.2
COPY ./traefik.yml /etc/traefik/traefik.yml
16 changes: 16 additions & 0 deletions docker/traefik/traefik.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## traefik.yml

# Docker configuration backend
providers:
docker:
defaultRule: "Host(`{{ trimPrefix `/` .Name }}.docker.localhost`)"

# API and dashboard configuration
api:
insecure: true

entryPoints:
web:
address: ":80"
websecure:
address: ":443"

0 comments on commit 4a42490

Please sign in to comment.