Skip to content

jdavid1385/sinatra-docker-kick-start

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sinatra-docker-kick-start

A dockerized "hello world" sinatra app. It is a child of the amazing guide at https://rubyplus.com/articles/2461-Docker-Basics-Running-a-Hello-World-Sinatra-App-in-a-Container.

Build with Ruby v-2.3.3. Use docker-compose; the best way to kick-start it is running docker-componse in a container, for that use the following script:

<<<<<<< HEAD ``

>>>>>>> 868dd7c1d53b59e7c47d2d65934d23d8dfb4b630
$ sudo curl -L --fail https://github.com/docker/compose/releases/download/1.24.0/run.sh -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
``

now just issue:

`docker-compose run`

if you prefer running the hello app manually:

``
docker run --rm -p 3000:3000 jnunez/hello &
docker exec -ti `docker ps -a | grep jnunez/hello | awk '{print $1}'` /bin/bash
``

For the blob persistance we are using mongo's GridFS. For a quick start on mongo visit: https://github.com/mongodb/mongo-ruby-driver/blob/master/docs/quick-start.txt 

 ``docker build --build-arg SSH_KEY="`cat ~/.ssh/id_rsa`" --build-arg SSH_KEY_PASSPHRASE='$secret_key' -t jnunez/mongoapp``

<<<<<<< HEAD
=======
now just issue:

`docker-compose run`

if you prefere running manually the hello app:

docker run --rm -p 3000:3000 jnunez/hello & docker exec -ti e69f82ed874d 9618a98bed8e fc55705f1c2b /bin/bash


For the blob persistance we are using mongo's GridFS. For a quick start on mongo visit: https://github.com/mongodb/mongo-ruby-driver/blob/master/docs/quick-start.txt 


You may want to get into some networking on the containers, introducing sandboxkey:

Create a netns link in /var/run (as su)
   ln -s /var/run/docker/netns/ netns
   ip netns show

To get the sandboxkey for jnunez/hello running image:
``
   ip netns exec `docker ps -a | grep jnunez/hello | awk '{print $1}' | head -n 1 | xargs -I container docker inspect container | grep "SandboxKey" | awk -F: '{print $2}' | awk -F/ '{print $6}'`ip addr show eth0
``

About

A dockerized "hello world" sinatra app

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published