npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@matthew-p/docker-server

v1.5.6

Published

Universal docker server, Nginx, Node, MySql, Redis

Downloads

32

Readme

Universal docker server

Nginx (1.17.8), PHP (7.4) / Node (13.10), MySql (5.7), Redis (5.0.7)

Installation

The preferred way to install this extension.

Either run

  • for composer

    php composer.phar require --prefer-dist matthew-p/docker-server

    or add

    "matthew-p/docker-server": "^5.1.0"

    to the require section of your composer.json file.

  • for npm

    npm i --save @matthew-p/docker-server@latest

    or add

    "@matthew-p/docker-server": "^1.1.1"

    to the dependencies section of your package.json file.

After install package:

  1. Add or update section scripts in composer.json or package.json:

    • for composer.json
      {
          "scripts": {
              "server": "vendor/bin/site-start.sh --env-file=docker/.env.local",
              "server-run": "vendor/bin/site-run.sh --env-file=docker/.env.local",
              "server-exec": "vendor/bin/site-exec.sh --env-file=docker/.env.local",
        
              // (optional)
              "server-prod": "vendor/bin/site-aws.sh --env-file=docker/.env.prod",
              // (optional)
              "server-deploy-dev": "vendor/bin/site-deploy.sh --env-file=docker/.env.dev"
          }
      }
    • for package.json
      {
          "scripts": {
              "server": "docker-server-start --env-file=docker/.env.local",
              "server-run": "docker-server-run --env-file=docker/.env.local",
              "server-exec": "docker-server-exec --env-file=docker/.env.local",
       
              // (optional)
              "server-prod": "docker-server-aws --env-file=docker/.env.prod",
              // (optional)
              "server-deploy-dev": "docker-server-deploy --env-file=docker/.env.dev"
          }
      }

    where "docker/.env.local" relative path to your local env config (will be created in next step).

  2. Run: composer server init or npm run server init. This will create a docker folder in your project root directory.

  3. Change root-path in docker/nginx/conf-dynamic.d/sample.conf

  4. See supported os and config docker/.env.local according to your operating system

  5. Run server: composer server up or npm run server up

Supported OS

Environments && Commands

PhpStorm samples

Latest docker images

  • NGINX
    • matthewpatell/universal-docker-nginx:3.7
  • SERVER
    • matthewpatell/universal-docker-server:4.0
    • matthewpatell/universal-docker-server:4.0-dev
    • matthewpatell/universal-docker-server:4.0-jre (with java)
  • PHP-FPM:
    • matthewpatell/universal-docker-server-php-fpm:4.0
  • NODE:
    • node:13.10-alpine

FEATURES

  • Multiple config: vendor/bin/site-start.sh --env-file=docker/.env.dev,docker/.env.local
  • Use environment, extends, overriding between configs
    # Simple usage
    SERVICES="$SERVICES -f my.yml"
      
    # Will be recompiled (bad example)
    SERVICES="${SERVICES} -f my.yml"
      
    # Will be recompiled (good example)
    SERVICES="${SERVICES_EXTERNAL} -f my.yml"
  • Use all environments in docker-compose files
  • Overriding, extends docker-compose files
  • Run container and execute command: composer server-run server "ls && top"
  • Run command in working container: composer server-exec server "composer install"
  • AWS create/update "Task Definitions"
  • Auto update /etc/hosts file on host machine
  • Auto create nginx proxies on host machine
  • Deploy
  • And etc.

LIFEHACKS

  • Configure hosts file:

    1. Check nginx container IP and add to hosts file:

      docker inspect sample_nginx

      view "IPAddress" and add to:

      sudo nano /etc/hosts

      172.18.0.4 sample.io (for example)
      save and check it.

    2. Open browser and check sample.io

    OR see below static network layer

  • Add static network layer (only for Linux)

    1. Change SERVICES variable in your local env (docker/.env.local) to:
      SERVICES="$SERVICES -f docker/docker-compose.common.yml -f docker/docker-compose.static-network.yml"
    2. Run: composer server restart and check it.
  • Update package without composer install and depencies

    • with composer image:
    docker run --rm --interactive --volume $PWD:/app composer update --ignore-platform-reqs --no-scripts
    • with server images:
    docker run --rm --interactive --volume $PWD:/app matthewpatell/universal-docker-server:4.0 bash -c 'cd /app && composer install --no-scripts'
    • with server image and additional global packages:
    docker run --rm --interactive --volume $PWD:/app matthewpatell/universal-docker-server:4.0 bash -c 'cd /app && composer global require "fxp/composer-asset-plugin:^1.4.2" && composer global require "hirak/prestissimo:~0.3.7" && composer install --no-scripts'
  • Use git-container instead of git itself


docker run -it --rm \
        --user $(id -u):$(id -g) \
        -v $HOME:$HOME:rw \
        -v /etc/passwd:/etc/passwd:ro \
        -v /etc/group:/etc/group:ro \
        -v $PWD:$PWD:rw \
        -w $PWD \
        alpine/git \
        clone [command]

# Or add alias in ~/.profile (change `git` to any another keyword if git actually installed)
cat >> ~/.profile << EOF
    function git () {
        (docker run -it --rm --user \$(id -u):\$(id -g) -v \$HOME:\$HOME:rw -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v \$PWD:\$PWD:rw -w \$PWD alpine/git "\$@")
    }
EOF
source ~/.profile
# and use via alias
git clone [email protected]:foob/bar.git .
git pull

That's all. Check it. :)