-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move docker-compose files to root, add npm script, docs
- Loading branch information
Showing
5 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
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
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,41 @@ | ||
version: '3' | ||
|
||
services: | ||
# API Gateway | ||
traefik: | ||
image: traefik:v2.4 | ||
container_name: 'traefik' | ||
restart: unless-stopped | ||
command: | ||
- '--log.level=DEBUG' | ||
- '--api.insecure=true' | ||
- '--providers.docker=true' | ||
- '--providers.docker.exposedbydefault=true' | ||
- '--entrypoints.web.address=:80' | ||
ports: | ||
- '80:80' | ||
- '8080:8080' | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
|
||
# Micro Services | ||
image-dev: | ||
container_name: 'image' | ||
restart: unless-stopped | ||
build: | ||
context: ./src/api/image | ||
dockerfile: Dockerfile | ||
environment: | ||
- IMAGE_PORT=4444 | ||
- SERVICE_NAME=image | ||
depends_on: | ||
traefik: | ||
condition: service_started | ||
ports: | ||
- '4444' | ||
labels: | ||
# Traefik routing | ||
- 'traefik.http.routers.image.rule=Host(`image.docker.localhost`)' | ||
# Enable gzip compression | ||
- 'traefik.http.routers.image.middlewares=test-compress' | ||
- 'traefik.http.middlewares.test-compress.compress=true' |
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,65 @@ | ||
# Docker and Telescope | ||
|
||
## Introduction | ||
|
||
Telescope uses Docker to deploy all the different parts of our app. If you haven't | ||
worked with Docker before, it's worth taking a few minutes to [learn how it works](https://docs.docker.com/get-started/). | ||
|
||
You'll see Docker used in a few places | ||
|
||
## Setup | ||
|
||
See the [environment setup doc](environment-setup.md) for info specific to your platform. | ||
|
||
Once installed, Docker uses the following commands: | ||
|
||
- [`docker`](https://docs.docker.com/engine/reference/commandline/cli/) | ||
- [`docker-compose`](https://docs.docker.com/compose/reference/) | ||
|
||
## Running Telescope via Docker | ||
|
||
We have a number of docker-compose files that control all the apps that we ship: | ||
|
||
- `docker-compose.yml` - the development version of our "classic" Telescope app (front-end and back-end) | ||
- `docker-compose-production.yml` - the production version of our "classic" Telescope app (front-end and back-end) | ||
|
||
We also have files for our new Microservices Back-end: | ||
|
||
- `docker-compose-api.yml` - the development version | ||
- `docker-compose-api-production.yml` - the production version | ||
|
||
The docker-compose files define a set of separate servers and services that can | ||
be run together with a single command. | ||
|
||
``` | ||
# run our development version of the entire Telescope app, building any containers as necessary | ||
docker-compose -f docker-compose.yml up --build | ||
# stop the running containers | ||
docker-compose -f docker-compose.yml down | ||
``` | ||
|
||
If you want to run a specific app or apps, you can name them: | ||
|
||
``` | ||
# run our development version of the entire Telescope app, building any containers as necessary | ||
docker-compose -f docker-compose.yml up --build login redis telescope | ||
``` | ||
|
||
### Running the Microservices | ||
|
||
For your convenience, you can use the following `npm` scripts: | ||
|
||
``` | ||
# start the microservices containers and gateway in development | ||
npm run api:start | ||
# stop the containers | ||
npm run api:stop | ||
``` | ||
|
||
The services will now be available via the defined routes: | ||
|
||
| Service | URL | | ||
| ------------------------ | ------------------------------------ | | ||
| Background Image Service | http://image.docker.localhost/image/ | |
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