Service Levels Under Guest: RESTful routing access to execute Linux shell scripts via URLs
597
Docker-compose.yml and suggestions for creating a service environment from SLUG is available on GitHub: https://github.com/BiStormLLC/SLUG
Use Cases
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: http://localhost:9082/my_app_collections/app1/action/star_wars
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"
Run:
$ 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? Tweet @babelfeed
Feedback? Want to hire us for the length of your project or for just a few sprints?
DM @bistormllc
Content type
Image
Digest
Size
142.6 MB
Last updated
over 9 years ago
docker pull bistormllc/slug