Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
6674811
Added note about disk space requirement.
wiseman Dec 19, 2019
442ef3f
cópia do Brasil para South America
thiagomiranda3 Jan 28, 2020
644bf6c
pelias.json américa do sul
thiagomiranda3 Jan 28, 2020
edebe6b
change .env pelias
thiagomiranda3 Jan 28, 2020
15c28e7
env data
thiagomiranda3 Jan 28, 2020
372c30e
fix(buffering): disable TTY for prepeare scripts to avoid unsightly b…
missinglink Mar 30, 2020
2218fce
Merge pull request #184 from pelias/disable_tty
missinglink Mar 30, 2020
e8d914b
docs(readme): simplify quick-start docs
missinglink Apr 3, 2020
0ae79ce
fix(france): update oa, now we should use `fr/countrywide.csv`
Joxit Apr 4, 2020
9f3d10b
Merge pull request #188 from pelias/joxit/update/france
orangejulius Apr 6, 2020
aef3042
Merge pull request #170 from DDMXBr/master
missinglink Apr 9, 2020
7164763
Update planet acceptance tests submodule
orangejulius Apr 13, 2020
c54f2bb
fix(buffering): disable TTY for prepeare scripts to avoid unsightly b…
missinglink Apr 23, 2020
74156d5
Merge pull request #189 from pelias/disable_tty
missinglink Apr 23, 2020
c85bf72
Add `countryCode` property to WOF configuration
orangejulius Apr 23, 2020
81ae0c9
There are a lot more country codes for North America than I thought
orangejulius Apr 23, 2020
73ddbd4
Merge pull request #190 from pelias/add-wof-countries
orangejulius Apr 23, 2020
174c5a3
Add missing importers to Australia config
orangejulius Apr 23, 2020
7896318
basic NYC build
blackmad Mar 9, 2020
5d2c255
peter fixes including nyc tests
blackmad Mar 10, 2020
73fbbb2
Add Geonames importer
orangejulius Apr 24, 2020
8167bc2
Add `whosonfirst.countryCode` setting
orangejulius Apr 24, 2020
5573da0
Merge pull request #191 from pelias/new-york-city
orangejulius Apr 24, 2020
d9b0fff
Update pelias.json for Belgium
barthanssens May 2, 2020
aa8e1d3
Merge pull request #194 from barthanssens/patch-1
missinglink May 2, 2020
a3fb934
docs: add project header to readme
missinglink May 12, 2020
ea9d043
Merge pull request #195 from pelias/readme_header
missinglink May 12, 2020
a542af2
Merge branch 'master' into relative_data_dir
missinglink May 12, 2020
355a1eb
Merge pull request #186 from pelias/relative_data_dir
missinglink May 12, 2020
16bc785
docs: resolve inconsistency between differing install directory instr…
missinglink May 18, 2020
214a572
Merge pull request #197 from pelias/readme_install_dir
missinglink May 18, 2020
d2403f9
Allow parallelizing the CSV importer
orangejulius Jun 5, 2020
8e764b1
Merge pull request #199 from pelias/csv-parallelism
orangejulius Jun 9, 2020
2eb0a6e
Add Texas project
orangejulius Jul 8, 2019
61d4c89
Fix some Texas project issues
orangejulius Jun 4, 2020
0f16601
Fix Elasticsearch user
orangejulius Jun 4, 2020
e9fb47b
Copy docker-compose from portland project
orangejulius Jun 4, 2020
3024cfc
Remove some out of date config options for Texas
orangejulius Jun 4, 2020
bb5acc5
Add farm/ranch to market synonyms
orangejulius Jun 5, 2020
cd5ae42
Enable custom synonyms
orangejulius Jun 5, 2020
3dfde03
Add new Texas OA data
orangejulius Jun 5, 2020
439c137
Merge pull request #147 from pelias/texas
orangejulius Jun 9, 2020
01818fc
fix(pelias.json): remove explicit whosonfirst.importVenues from projects
mmmaia Jun 15, 2020
86d71ce
Merge pull request #201 from mmmaia/remove_importvenues_from_pelias_json
orangejulius Jun 15, 2020
865fb22
Add empty CSV section to NA project
orangejulius Jun 23, 2020
627ddab
Update expectations for portland acceptance tests
orangejulius Jun 29, 2020
b14bb7b
Merge pull request #205 from pelias/portland-acceptance-tests
orangejulius Jun 29, 2020
01e872c
fix countryCode to be US in nyc build
blackmad Jul 16, 2020
c6411a7
Merge pull request #206 from pelias/fix-ny
missinglink Jul 16, 2020
dbc946e
Merge pull request #157 from wiseman/patch-2
missinglink Jul 16, 2020
da2291f
Update README.md
acaloiaro Jul 28, 2020
2771fe2
Merge pull request #210 from acaloiaro/patch-1
missinglink Jul 28, 2020
dc53b18
Add 'How long will it take?' docs section
orangejulius Sep 15, 2020
9786416
Merge pull request #215 from pelias/how-long-will-it-take
orangejulius Sep 15, 2020
9d33500
Use latest acceptance-tests
orangejulius Sep 15, 2020
b6d2e53
Clarify that `ln` command may require sudo
orangejulius Sep 15, 2020
58ded1a
Merge pull request #216 from pelias/clarify-sudo
missinglink Oct 12, 2020
d21b7d8
Add one more sudo
orangejulius Sep 15, 2020
392dd5b
feat(permissions): disallow manually defining DOCKER_USER
missinglink Oct 9, 2020
345ccc0
refactor(permissions): remove DOCKER_USER line from .env files
missinglink Oct 9, 2020
9dffa86
Update README for `$DOCKER_USER` deprecation
orangejulius Oct 12, 2020
680f5e1
Add readme section on permissions, non-root Docker
orangejulius Oct 12, 2020
7988a8d
add project for norway
torbjokv Oct 13, 2020
0ac8003
Merge pull request #220 from pelias/docker_permissions
orangejulius Oct 14, 2020
687d4d1
remove coordinates for norway project file
torbjokv Oct 14, 2020
48312f2
Merge pull request #223 from torbjokv/master
missinglink Oct 15, 2020
982fd2e
feat(project): added Austria to projects (#222)
jimmylevell Oct 16, 2020
68cd734
fix(project): remove DOCKER_USER lines from project .env files
missinglink Oct 16, 2020
9066d5f
Increase Elasticsearch `max_clause_count`
orangejulius Oct 22, 2020
568a35a
Merge pull request #225 from pelias/increase_max_clause_count
orangejulius Nov 6, 2020
abfd5d8
feat(germany): Add Germany as a project (#226)
ryanbateman Nov 23, 2020
dfbee17
chore(project): Add `Kreis Viersen` to openaddresses import files (#231)
msschl Nov 25, 2020
4ea60c0
feat(poland): Add Poland as a project
sergiuszkierat Jan 10, 2021
4e36ae0
Restricted pelias+deps port exposure to localhost
Jezternz Feb 11, 2021
e380582
Improved docker container broacast port ip to include all internal ip…
Feb 11, 2021
70bd342
Revert "Improved docker container broacast port ip to include all int…
Feb 11, 2021
9f556d6
Updated pelias api itself to be correctly exposed on 0.0.0.0
Feb 11, 2021
fa360c5
Merge pull request #255 from Jezternz/improved-external-security
orangejulius Jul 9, 2021
312902e
Update README.md
irbian Nov 26, 2021
9273316
Merge pull request #272 from irbian/patch-1
orangejulius Nov 26, 2021
2963651
Upgrade Elasticearch to version 7.16.1
orangejulius Dec 14, 2021
0941ad9
Merge pull request #275 from pelias/elasticsearch-7.16.1
orangejulius Dec 14, 2021
ce5b6b9
projects: portland-metro CSV URL fix
missinglink Jan 27, 2022
73ea850
Adding example for Libpostal Service
andersoncarlosfs May 9, 2022
db80cfe
Merge pull request #289 from andersoncarlosfs/patch-1
orangejulius May 9, 2022
6c50a65
Added Alternative to Valhalla
Tsangares Oct 8, 2022
fcfefd8
portland-metro: fix broken data URLS (#309)
missinglink Feb 1, 2023
9d8d8db
North America Project README.md link fix (#314)
portlandhodl Mar 17, 2023
4ae5830
Add Italy project (#287)
aminato Jul 7, 2023
d91a42e
Add project for Lithuania (#310)
jvitkauskas Jul 7, 2023
f83480d
new project : Israel (#296)
borisPerlov Jul 7, 2023
47f0f98
Added Kyrgyzstan country (#260)
AIDARXAN Jul 8, 2023
78de3e7
projects: Add Denmark (#302)
welrachid Jul 18, 2023
ad4d4c5
Fix typo in readme (#326)
SeanKilleen Oct 31, 2023
2df758b
support modern docker compose
michaelkirk May 31, 2023
5848b66
docker: support modern versions of compose
missinglink Nov 28, 2023
6430b94
feat(ci): github actions workflow for building elastic docker images
missinglink Dec 14, 2021
6a99d38
actions: disable image-builder workflow
missinglink Nov 30, 2023
dd8a298
This test is not failing.
michaelkirk Dec 11, 2023
52bc956
images: add pelias/elasticsearch:8.12.2-beta docker image
missinglink Mar 12, 2024
99f112e
* feat(projects): add las-vegas-metro
eric-hendrickson Jun 30, 2024
4d45ac8
* fix(synonyms): fix 'forth/fourth' typo across projects
eric-hendrickson Jul 4, 2024
bff38d1
feat(projects): update elasticsearch to v7.17.27
missinglink Jan 22, 2025
5cc454b
CI: update Github Action runner Ubuntu versions to 22.04
orangejulius Feb 11, 2025
c5172dd
Merge pull request #368 from pelias/github-actions-ubuntu-22
orangejulius Feb 11, 2025
c476cb6
fix: remove duplicate `csv-importer` service from docker-compose.yml
Feb 25, 2025
d219ed3
Merge pull request #369 from nermin-io/fix-australia-docker-compose
orangejulius Feb 25, 2025
6f68054
refactor: allow configuring ELASTIC_INDEX for elastic_stats command
missinglink Mar 12, 2025
abd54d4
nodejs: initial commit of nodejs port
missinglink Feb 13, 2020
b43c765
feat(cmd)!: Update yargs to 17.7.2
arnesetzer Mar 13, 2025
5a285fe
feat(cmd): Add backwards compability for docker-compose
arnesetzer Mar 13, 2025
44a7c60
fix(cmd): make compose runable
arnesetzer Mar 13, 2025
83e2b84
feat(cmd): Add elastic commands
arnesetzer Mar 13, 2025
e25d07f
fix(cmd): Change elastic default port back to 9200
arnesetzer Mar 14, 2025
f45ef12
feat(cmd): Rewrite elastic status to make it reusable
arnesetzer Mar 14, 2025
2c2aee6
feat(cmd)!: Implement elastic wait
arnesetzer Mar 14, 2025
b7cf595
feat(cmd): Adds elastic stats
arnesetzer Mar 14, 2025
d23291a
fix(cmd): Change default port to 9200
arnesetzer Mar 14, 2025
d21fe3a
feat(cmd): Add elastic info
arnesetzer Mar 14, 2025
e04c45d
fix(cmd): Fix async problem with elastic status/wait
arnesetzer Mar 14, 2025
4b7f266
feat(cmd): Add prepare commands
arnesetzer Mar 14, 2025
5f688c5
fix(projects): Remove accidently pushed project
arnesetzer Mar 14, 2025
5235738
feat(cmd): Add node system commands
arnesetzer Mar 17, 2025
c1196f7
feat(cmd): Add test run command
arnesetzer Mar 17, 2025
6b47f92
feat(cmd): Remove old cmd shell stuff
arnesetzer Mar 17, 2025
78af11a
fix(cmd): Remove double negation in data dir check
arnesetzer Mar 17, 2025
8814dca
fix(cmd): Fix wrong position of !
arnesetzer Mar 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/elasticsearch-image-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# name: Build Docker Images
# on:
# push:
# paths:
# - "images/elasticsearch/**"
# - ".github/workflows/**"
# jobs:
# build:
# if: github.ref == 'refs/heads/master' && needs.unit-tests.result == 'success'
# runs-on: ubuntu-22.04
# strategy:
# matrix:
# elastic-version:
# - "7.17.15"
# env:
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# steps:
# - uses: actions/checkout@v2
# with:
# fetch-depth: 100
# - name: "Build elasticsearch@${{ matrix.elastic-version }}"
# run: |
# cd images/elasticsearch/${{ matrix.elastic-version }}
# curl "https://raw.githubusercontent.com/pelias/ci-tools/master/build-docker-images.sh" | bash -
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
projects/*/data
.DS_Store
node_modules
package-lock.json
122 changes: 86 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
<p align="center">
<img height="100" src="https://raw.githubusercontent.com/pelias/design/master/logo/pelias_github/Github_markdown_hero.png">
</p>
<h3 align="center">A modular, open-source search engine for our world.</h3>
<p align="center">Pelias is a geocoder powered completely by open data, available freely to everyone.</p>
<p align="center">
<a href="https://en.wikipedia.org/wiki/MIT_License"><img src="https://img.shields.io/github/license/pelias/api?style=flat&color=orange" /></a>
<a href="https://hub.docker.com/u/pelias"><img src="https://img.shields.io/docker/pulls/pelias/api?style=flat&color=informational" /></a>
<a href="https://gitter.im/pelias/pelias"><img src="https://img.shields.io/gitter/room/pelias/pelias?style=flat&color=yellow" /></a>
</p>
<p align="center">
<a href="https://github.com/pelias/docker">Local Installation</a> ·
<a href="https://geocode.earth">Cloud Webservice</a> ·
<a href="https://github.com/pelias/documentation">Documentation</a> ·
<a href="https://gitter.im/pelias/pelias">Community Chat</a>
</p>
<details open>
<summary>What is Pelias?</summary>
<br />
Pelias is a search engine for places worldwide, powered by open data. It turns addresses and place names into geographic coordinates, and turns geographic coordinates into places and addresses. With Pelias, you’re able to turn your users’ place searches into actionable geodata and transform your geodata into real places.
<br /><br />
We think open data, open source, and open strategy win over proprietary solutions at any part of the stack and we want to ensure the services we offer are in line with that vision. We believe that an open geocoder improves over the long-term only if the community can incorporate truly representative local knowledge.
</details>

# Pelias in Docker

This repository contains a framework for downloading/preparing and building the [Pelias Geocoder](https://github.com/pelias/pelias) using Docker and [Docker Compose](https://github.com/docker/compose#docker-compose).
This repository contains a framework for downloading/preparing and building the [Pelias Geocoder](https://github.com/pelias/pelias) using Docker and [Docker Compose](https://github.com/docker/compose#docker-compose-v2).

## Projects

Expand All @@ -13,10 +36,21 @@ Once you have successfully completed a small build you can use this as a base to

## Prerequisites

You will need to have a [modern version of `docker`](https://docs.docker.com/engine/release-notes/) and a [modern version of `docker-compose`](https://github.com/docker/compose/blob/master/CHANGELOG.md) installed before continuing. If you are not using the latest version, please mention that in any bugs reports.
You will need to have a [modern version of `docker`](https://docs.docker.com/engine/release-notes/) and a [modern version of `docker compose`](https://github.com/docker/compose/releases) installed before continuing. If you are not using the latest version, please mention that in any bugs reports.

This project supports Linux and Mac OSX operatings systems. Windows is currently [not supported](https://github.com/pelias/docker/issues/124).

### Permissions

In order to ensure security, Pelias docker containers, and the `pelias` helper script, will not run as a root user!

Be sure you are running as a non-root user and that this user can execute `docker` commands. See the Docker documentation article [Manage Docker as a non-root user](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) to do this.

## Requirements for Linux
- Install `util-linux` using your distribution's package manager
- Alpine Linux: `sudo apk add util-linux`
- Debian/Ubuntu: `sudo apt-get install util-linux`

## Requirements for Mac OSX
- install GNU coreutils with [Homebrew](https://brew.sh/): `brew install coreutils`.
- Max-out Docker computing resources( `Memory-RAM and CPUs-Cores` ) dedicated to Docker in `Docker > Preferences > Advanced`.
Expand All @@ -27,36 +61,45 @@ Scripts can easily download tens of GB of geographic data, so ensure you have en

At least 8GB RAM is required.

## How long will it take?

You should be able to get started with the default Portland-metro area build in under an hour with a fast internet connection.

On a machine with ~32 CPU cores, a full planet build can be done in under a day with the right settings.

The interpolation build (`pelias prepare interpolation`), which is [single threaded](https://github.com/pelias/interpolation/issues/264) will take 6+ days
for the full planet. We generally recommend skipping it when you are first
getting started.

For more info on time estimates and hardware requirements for large build see our [full planet considerations](https://github.com/pelias/documentation/blob/master/full_planet_considerations.md) documentation.

## Quickstart build script

The following shell script can be used to quickly get started with a Pelias build.

Feel free to modify the code and data locations to suit your needs.

```bash
#!/bin/bash
set -x

# create directories
mkdir /code /data

# set proper permissions. make sure the user matches your `DOCKER_USER` setting in `.env`
chown 1000:1000 /code /data
# change directory to the where you would like to install Pelias
# cd /path/to/install

# clone repo
cd /code
git clone https://github.com/pelias/docker.git
cd docker
# clone this repository
git clone https://github.com/pelias/docker.git && cd docker

# install pelias script
ln -s "$(pwd)/pelias" /usr/local/bin/pelias
# this is the _only_ setup command that should require `sudo`
sudo ln -s "$(pwd)/pelias" /usr/local/bin/pelias

# cwd
# cd into the project directory
cd projects/portland-metro

# configure environment
# create a directory to store Pelias data files
# see: https://github.com/pelias/docker#variable-data_dir
# note: use 'gsed' instead of 'sed' on a Mac
mkdir ./data
sed -i '/DATA_DIR/d' .env
echo 'DATA_DIR=/data' >> .env
echo 'DATA_DIR=./data' >> .env

# run build
pelias compose pull
Expand All @@ -72,7 +115,6 @@ pelias compose up
pelias test run
```


## Installing the Pelias helper script

This repository makes use of a helper script to make basic management of the Pelias Docker images easy.
Expand All @@ -84,8 +126,14 @@ You can find the `pelias` file in the root of this repository.
Advanced users may have a preference how this is done on their system, but a basic example would be to do something like:

```bash
git clone https://github.com/pelias/docker.git ~/pelias
ln -s ~/pelias/pelias /usr/local/bin/pelias
# change directory to the where you would like to install Pelias
# cd /path/to/install

# clone this repository
git clone https://github.com/pelias/docker.git && cd docker

# install pelias script
sudo ln -s "$(pwd)/pelias" /usr/local/bin/pelias
```

Once the command is correctly installed you should be able to run the following command to confirm the pelias command is available on your path:
Expand Down Expand Up @@ -135,7 +183,6 @@ Then use your text editor to modify the `.env` file to reflect your new path, it
```bash
COMPOSE_PROJECT_NAME=pelias
DATA_DIR=/tmp/pelias
DOCKER_USER=1000
```

You can then list the environment variables to ensure they have been correctly set:
Expand All @@ -152,9 +199,7 @@ Note: changing the `COMPOSE_PROJECT_NAME` variable is not advisable unless you k

### Variable: DOCKER_USER

All processes in Pelias containers are run as non-root users. By default, the UID of the processes will be `1000`, which is the first user ID on _most_ Linux systems and is likely to be a good option. However, if restricting file permissions in your data directory to a different user or group is important, this can be overridden by setting the `DOCKER_USER` variable.

This variable can take just a UID or a UID:GID combination such as `1000:1000`. See the [docker-compose](https://docs.docker.com/compose/compose-file/#domainname-hostname-ipc-mac_address-privileged-read_only-shm_size-stdin_open-tty-user-working_dir) and [docker run](https://docs.docker.com/engine/reference/run/#user) documentation on controlling Docker container users for more information.
This variable is no longer used, and will be ignored. If you still have it in your `.env` file, you can safely remove it.

## CLI commands

Expand All @@ -169,11 +214,11 @@ Usage: pelias [command] [action] [options]
compose logs display container logs
compose ps list containers
compose top display the running processes of a container
compose exec execute an arbitrary docker-compose command
compose run execute a docker-compose run command
compose up start one or more docker-compose service(s)
compose kill kill one or more docker-compose service(s)
compose down stop all docker-compose service(s)
compose exec execute an arbitrary docker compose command
compose run execute a docker compose run command
compose up start one or more docker compose service(s)
compose kill kill one or more docker compose service(s)
compose down stop all docker compose service(s)
download wof (re)download whosonfirst data
download oa (re)download openaddresses data
download osm (re)download openstreetmap data
Expand All @@ -193,6 +238,7 @@ Usage: pelias [command] [action] [options]
import osm (re)import openstreetmap data
import polylines (re)import polylines data
import transit (re)import transit data
import csv (re)import csv data
import all (re)import all data
prepare polylines export road network from openstreetmap into polylines format
prepare interpolation build interpolation sqlite databases
Expand All @@ -205,20 +251,20 @@ Usage: pelias [command] [action] [options]

### Compose commands

The compose commands are available as a shortcut to running `docker-compose` directly, they will also ensure that your environment is correctly configured.
The compose commands are available as a shortcut to running `docker compose` directly, they will also ensure that your environment is correctly configured.

See the docker-compose documentation for more info: https://docs.docker.com/compose/overview/
See the docker compose documentation for more info: https://docs.docker.com/compose/overview/

```bash
pelias compose pull update all docker images
pelias compose logs display container logs
pelias compose ps list containers
pelias compose top display the running processes of a container
pelias compose exec execute an arbitrary docker-compose command
pelias compose run execute a docker-compose run command
pelias compose up start one or more docker-compose service(s)
pelias compose kill kill one or more docker-compose service(s)
pelias compose down stop all docker-compose service(s)
pelias compose exec execute an arbitrary docker compose command
pelias compose run execute a docker compose run command
pelias compose up start one or more docker compose service(s)
pelias compose kill kill one or more docker compose service(s)
pelias compose down stop all docker compose service(s)
```

### Download commands
Expand Down Expand Up @@ -360,3 +406,7 @@ Once all the importers have completed and the Pelias services are running, you c
### Interpolation

- http://localhost:4300/demo/#13/45.5465/-122.6351

### Libpostal

- http://localhost:4400/parse?address=1730+ne+26th+ave,+portland,+or
8 changes: 8 additions & 0 deletions cmd/compose.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
command: 'compose <cmd>',
describe: 'shortcuts to running docker compose directly',
builder: (yargs) => yargs
.commandDir('compose')
.usage('$0 <cmd> [args]')
.demandCommand(1, '')
}
10 changes: 10 additions & 0 deletions cmd/compose/down.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const child = require('child_process')
const options = { stdio: 'inherit' }

module.exports = {
command: 'down',
describe: 'stop all docker-compose service(s)',
handler: (argv) => {
child.spawnSync(oldOrNewCompose(), ['down'], options)
}
}
10 changes: 10 additions & 0 deletions cmd/compose/exec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const child = require('child_process')
const options = { stdio: 'inherit', shell:true }

module.exports = {
command: 'exec',
describe: 'execute an arbitrary docker-compose command',
handler: (argv) => {
child.spawnSync(oldOrNewCompose(), argv._.slice(1), options)
}
}
10 changes: 10 additions & 0 deletions cmd/compose/kill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const child = require('child_process')
const options = { stdio: 'inherit' }

module.exports = {
command: 'kill',
describe: 'kill one or more docker-compose service(s)',
handler: (argv) => {
child.spawnSync(oldOrNewCompose(), argv._.slice(1), options)
}
}
11 changes: 11 additions & 0 deletions cmd/compose/logs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const child = require('child_process')
const oldOrNewCompose = require('./oldOrNewCompose')
const options = { stdio: 'inherit' , shell: true}

module.exports = {
command: 'logs',
describe: 'display container logs',
handler: (argv) => {
child.spawnSync(oldOrNewCompose(), argv._.slice(1), options)
}
}
10 changes: 10 additions & 0 deletions cmd/compose/oldOrNewCompose.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const child = require('child_process')
const oldOrNewCompose = require('./oldOrNewCompose')
const options = { stdio: 'ignore', shell:true }

module.exports = function oldOrNewCompose(){
if(child.spawnSync('docker compose version', options).status==0){
return 'docker compose';
}
return 'docker-compose'
}
11 changes: 11 additions & 0 deletions cmd/compose/ps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const child = require('child_process')
const oldOrNewCompose = require('./oldOrNewCompose')
const options = { stdio: 'inherit' , shell: true}

module.exports = {
command: 'ps',
describe: 'list containers',
handler: (argv) => {
child.spawnSync(oldOrNewCompose(), argv._.slice(1), options)
}
}
11 changes: 11 additions & 0 deletions cmd/compose/pull.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const child = require('child_process')
const oldOrNewCompose = require('./oldOrNewCompose')
const options = { stdio: 'inherit' , shell: true}

module.exports = {
command: 'pull',
describe: 'update all docker images',
handler: (argv) => {
child.spawnSync(oldOrNewCompose(), ['pull'], options)
}
}
18 changes: 18 additions & 0 deletions cmd/compose/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const child = require('child_process')
const oldOrNewCompose = require('./oldOrNewCompose')
const env = require('../../lib/env')()
const options = { stdio: 'inherit' , shell: true}

function net_init() {
const net = `${env.COMPOSE_PROJECT_NAME}_default`
child.spawnSync('docker', ['network', 'create', net], { stdio: 'ignore' })
}

module.exports = {
command: 'run',
describe: 'execute a docker-compose run command',
handler: (argv) => {
net_init()
child.spawnSync(oldOrNewCompose(), ['run', '--rm', ...argv._.slice(2)], options)
}
}
11 changes: 11 additions & 0 deletions cmd/compose/top.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const child = require('child_process')
const oldOrNewCompose = require('./oldOrNewCompose')
const options = { stdio: 'inherit' , shell: true}

module.exports = {
command: 'top',
describe: 'display the running processes of a container',
handler: (argv) => {
child.spawnSync(oldOrNewCompose(), argv._.slice(1), options)
}
}
11 changes: 11 additions & 0 deletions cmd/compose/up.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const child = require('child_process')
const oldOrNewCompose = require('./oldOrNewCompose')
const options = { stdio: 'inherit', shell:true }

module.exports = {
command: 'up',
describe: 'start one or more docker compose service(s)',
handler: (argv) => {
child.spawnSync(oldOrNewCompose(), ['up', '-d', ...argv._.slice(2)], options)
}
}
Loading