2017 © Pedro Peláez
 

library vessel

Simple Docker dev environments

image

shipping-docker/vessel

Simple Docker dev environments

  • Sunday, July 15, 2018
  • by fideloper
  • Repository
  • 26 Watchers
  • 611 Stars
  • 23,720 Installations
  • Shell
  • 2 Dependents
  • 0 Suggesters
  • 65 Forks
  • 13 Open issues
  • 14 Versions
  • 42 % Grown

The README.md

Vessel

Up and running with small Docker dev environments., (*1)

Documentation

Full documentation can be found at https://vessel.shippingdocker.com., (*2)

Install

Vessel is just a small set of files that sets up a local Docker-based dev environment per project. There is nothing to install globally, except Docker itself!, (*3)

This is all there is to using it:, (*4)

composer require shipping-docker/vessel
php artisan vendor:publish --provider="Vessel\VesselServiceProvider"

# Run this once to initialize project
# Must run with "bash" until initialized
bash vessel init

./vessel start

Head to http://localhost in your browser and see your Laravel site!, (*5)

Lumen

If you're using Lumen, you'll need to copy the Vessel files over manually instead of using php artisan vendor:publish. You can do this with this command:, (*6)

cp -R vendor/shipping-docker/vessel/docker-files/{vessel,docker-compose.yml,docker} .

and then you'll be able to install and continue as normal., (*7)

Multiple Environments

Vessel attempts to bind to port 80 and 3306 on your machine, so you can simply go to http://localhost in your browser., (*8)

However, if you run more than one instance of Vessel, you'll get an error when starting it; Each port can only be used once. To get around this, use a different port per project by setting the APP_PORT and MYSQL_PORT environment variables in one of two ways:, (*9)

Within the .env file:, (*10)

APP_PORT=8080
MYSQL_PORT=33060

Or when starting Vessel:, (*11)

APP_PORT=8080 MYSQL_PORT=33060 ./vessel start

Then you can view your project at http://localhost:8080 and access your database locally from port 33060;, (*12)

Sequel Pro

Since we bind the MySQL to port 3306, SequelPro can access the database directly., (*13)

sequel pro access, (*14)

The password for user root is set by environment variable DB_PASSWORD from within the .env file., (*15)

The port setting must match the MYSQL_PORT environment variable, which defaults to 3306., (*16)

Common Commands

Here's a list of built-in helpers you can use. Any command not defined in the vessel script will default to being passed to the docker-compose command. If not command is used, it will run docker-compose ps to list the running containers for this environment., (*17)

Show Vessel Version or Help

# shows vessel current version
$ vessel --version # or [ -v | version ]

# shows vessel help
$ vessel --help # or [ -H | help ]

Starting and Stopping Vessel

# Start the environment
./vessel start

## This is equivalent to
./vessel up -d

# Stop the environment
./vessel stop

## This is equivalent to
./vessel down

Development

# Use composer
./vessel composer <cmd>
./vessel comp <cmd> # "comp" is a shortcut to "composer"

# Use artisan
./vessel artisan <cmd>
./vessel art <cmd> # "art" is a shortcut to "artisan"

# Run tinker REPL
./vessel tinker # "tinker" is a shortcut for "artisan tinker"

# Run phpunit tests
./vessel test

## Example: You can pass anything you would to phpunit to this as well
./vessel test --filter=some.phpunit.filter
./vessel test tests/Unit/SpecificTest.php


# Run npm
./vessel npm <cmd>

## Example: install deps
./vessel npm install

# Run yarn

./vessel yarn <cmd>

## Example: install deps
./vessel yarn install

# Run gulp
./vessel gulp <cmd>

Docker Commands

As mentioned, anything not recognized as a built-in command will be used as an argument for the docker-compose command. Here's a few handy tricks:, (*18)

# Both will list currently running containers and their status
./vessel
./vessel ps

# Check log output of a container service
./vessel logs # all container logs
./vessel logs app # nginx | php logs
./vessel logs mysql # mysql logs
./vessel logs redis # redis logs

## Tail the logs to see output as it's generated
./vessel logs -f # all logs
./vessel logs -f app # nginx | php logs

## Tail Laravel Logs
./vessel exec app tail -f /var/www/html/storage/logs/laravel.log

# Start a bash shell inside of a container
# This is just like SSH'ing into a server
# Note that changes to a container made this way will **NOT**
#   survive through stopping and starting the vessel environment
#   To install software or change server configuration, you'll need to
#     edit the Dockerfile and run: ./vessel build
./vessel exec app bash

# Example: mysqldump database "homestead" to local file system
#          We must add the password in the command line this way
#          This creates files "homestead.sql" on your local file system, not
#          inside of the container
# @link https://serversforhackers.com/c/mysql-in-dev-docker
./vessel exec mysql mysqldump -u root -psecret homestead > homestead.sql

What's included?

The aim of this project is simplicity. It includes:, (*19)

  • PHP 7.4
  • MySQL 5.7
  • Redis (latest)
  • NodeJS (latest), with Yarn & Gulp

How does this work?

If you're unfamiliar with Docker, try out this Docker in Development course, which explains important topics in how this is put together., (*20)

If you want to see how this workflow was developed, check out Shipping Docker and signup for the free course module which explains building this Docker workflow., (*21)

Supported Systems

Vessel requires Docker, and currently only works on Windows, Mac and Linux., (*22)

Windows requires running Hyper-V. Using Git Bash (MINGW64) and WSL are supported. Native Windows is still under development., (*23)

Mac Linux Windows
Install Docker on Mac Install Docker on Debian Install Docker on Windows
Install Docker on Ubuntu
Install Docker on CentOS

The Versions

15/07 2018

dev-resolv

dev-resolv

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

04/07 2018

dev-master

9999999-dev

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

04/04 2018

dev-bionic

dev-bionic

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

19/02 2018

3.0.1

3.0.1.0

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

04/01 2018

dev-php7.2

dev-php7.2

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

16/11 2017

2.1.0

2.1.0.0

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

16/11 2017

3.0.0

3.0.0.0

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

09/11 2017

2.0.0

2.0.0.0

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

21/10 2017

1.1.3

1.1.3.0

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

20/10 2017

1.1.2

1.1.2.0

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

20/10 2017

1.1.1

1.1.1.0

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

10/10 2017

1.1.0

1.1.0.0

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

08/10 2017

1.0.0

1.0.0.0

Simple Docker dev environments

  Sources   Download

MIT

by Chris Fidao

20/09 2017

dev-docs

dev-docs

Simple Docker dev environment

  Sources   Download

MIT

by Avatar fideloper