Code Monkey home page Code Monkey logo

prowl-compose's Introduction

documentations

Using Prowl with Docker Compose

Start the Prowl Docker container

docker -t prowl

One thing that hasn't been mentioned in the Prowl documentation is kernel compatibility, if you're having starting a contrainer, you can run

curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh > check-config.sh
bash ./check-config.sh

Restart the Docker daemon

sudo service docker restart

Make sure you've made applied excutable permissions in the binary:

sudo chmod +x /usr/local/bin/docker-compose

Verify that Docker can resolve external IP addresses by trying to pull an image

docker pull hello-world

Make sure UFW is up

ufw status

You may get this error

Your kernel does not support cgroup swap limit capabilities

You can ignore this, but you do need edit your GRUB file in Ubuntu, so run

nano /etc/default/grub

Then

GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

Then update GRUB

sudo update-grub

Now let's create a test directory for a test project

mkdir composetest
cd composetest

Create a file called app.py in your project directory and paste this in

from flask import Flask
from redis import Redis

app = Flask(__PROWL__)
redis = Redis(host='redis', port=6379)

@app.route('/')
def hello():
    count = redis.incr('hits')
    return 'Hello World! I have been seen {} times.\n'.format(count)

if __name__ == "__main__":
    app.run(host="0.0.0.0", debug=True)

Above, Redis is the hostname of the redis container on the application’s network. We use the default port for Redis, 6379. Create another file called requirements.txt in your project directory and paste this in

flask
redis

Creating a Dockerfile

You can make a file called "Dockerfile" and make the following contents:

FROM python:3.4-alpine
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD ["python", "app.py"]

We are going to define services in the Docker Compose file. So create a YAML file called docker-compose.yml, in your project directory and paste the following

version: '2'
services:
  web:
    build: .
    ports:
     - "5000:5000"
    volumes:
     - .:/code
  redis:
    image: "redis:alpine"

From your project directory, start your app

 docker-compose up
 Pulling image redis...
 Building web...
 Starting composetest_redis_1...
 Starting composetest_web_1...
 redis_1 | [8] 02 Jan 18:43:35.576 # Server started, Redis version 2.8.3
 web_1   |  * Running on http://0.0.0.0:5000/
 web_1   |  * Restarting with stat

If you need to detach a service, you can run

docker-compose up

Make sure the container and services you want are running using the "ps" flag

docker-compose ps

You should now be able to see what's running

docker-compose up -d
Starting composetest_redis_1...
Starting composetest_web_1...

docker-compose ps
Name                 Command            State       Ports
-------------------------------------------------------------------
prowl-composetest_redis_1   /usr/local/bin/run         Up
prowl-composetest_web_1     /bin/sh -c python app.py   Up      5000->5000/tcp

In conclusion, you can now use Docker Compose with Prowl, if you need to uninstall Docker Compose on your VPS, run

sudo rm /usr/local/bin/docker-compose

prowl-compose's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.