Service Levels Under Guest
Docker-compose.yml and suggestions for creating a service environment from SLUG is available on GitHub:
- Host a service shortcut that curls an outside vendor's API and returns a JSON response.
- Access Linux command-line environment tools on SLUG without needing to install them on your production server
- Preserve a collection of microservice solutions in an environment that can easily be installed on any host with Docker Machine installed.
- Create a bundle of URL shortcuts to automation scripts that you can share with your team, hosted on your machine or in the cloud.
- Provide a generic service gateway to mask the use of multiple languages and technologies
To create a SLUG services environment including the slug:nginx server, run these commands in terminal with Docker running in the background
"The Easy Way"
$ git clone https://github.com/BiStormLLC/SLUG.git && cd SLUG $ docker-compose up
You should then be able to access the Star Wars API shortcut script by entering this URL into your browser:
SLUG RESTful API files are contained in /var/www/html. You will only need to change these files if you are creating pull requests for changes to the SLUG API.
SLUG can execute shell scripts using virtual directory mappings found in slug/sample/slug.json. These scripts can then call NodeJS, Ruby, php-fpm, bash or shell files: these languages are recognized and preinstalled inside of the SLUG image.
All of the SLUG RESTful API runs within slug.php, which is referenced through index.php. The SLUG configuration file, slug.json provides configuration information for routing HTTP requests to the shared volume (or to the Docker container's /slug folder, if you are building a new image). You can also modify slug.json for additional attributes, like turning off the output of your executable that SLUG does through a JSON response.
Bring Your Own HTTP Server
The bistormllc/slug:latest image does not have an HTTP server. This is to allow you to run a Docker swarm or multi-container environment without generating useless, duplicate installs of Apache or Nginx. It is however recommended that you get started by using the bistormllc/slug:nginx image in conjunction with the slug:latest image to create a one-off services application tier. By using the GitHub repository along with docker-compose, you can download both images and build off of the included slug/sample/slug.json file to create your first service.
"The Hard Way"
- Make sure MyScriptsFolder has a properly formatted slug.json file
- A slug.json template is available to download here: https://github.com/BiStormLLC/SLUG/blob/master/slug/sample/slug.json
$ docker pull bistormllc/slug $ docker pull bistormllc/slug:nginx $ docker run -d -p 9000 --name php -v MyScriptsFolder:/slug bistormllc/slug $ docker run -d -p 9082:9082 --name slug_nginx bistormllc/slug:nginx
After running these commands, you should have a SLUG PHP and a SLUG Nginx container running in daemon mode. You should then be able to access your SLUG scripts using http://locahost:9082/yourvirtualpathmapping
Questions? Need help?
Feedback? Want to hire us for the length of your project or for just a few sprints?