Code Monkey home page Code Monkey logo

docker-nginx-web2py's Introduction

docker-nginx-web2py

Build Status Layers

Docker container for Nginx with Web2py based on madharjan/docker-nginx

Features

  • Environment variables to set admin password
  • Minimal (for production deploy) version of container docker-nginx-web2py-min for Web2py without admin, example and welcome
  • Bats bats-core/bats-core based test cases

Nginx 1.10.3 & Web2py 2.18.3 (docker-nginx-web2py)

Environment

Variable Default Example
WEB2PY_ADMIN Pa55w0rd
DISABLE_UWSGI 0 1 (to disable)
INSTALL_PROJECT 0 1 (to enable)
PROJECT_GIT_REPO https://github.com/madharjan/web2py-contest
PROJECT_GIT_TAG HEAD v5.1.4

Build

# clone project
git clone https://github.com/madharjan/docker-nginx-web2py
cd docker-nginx-web2py

# build
make

# tests
make run
make test

# clean
make clean

Run

# prepare foldor on host for container volumes
sudo mkdir -p /opt/docker/web2py/applications/
sudo mkdir -p /opt/docker/web2py/log/

docker stop web2py
docker rm web2py

# run container
# Web2py include Admin, Example and Welcome
docker run -d \
  -e WEB2PY_ADMIN=Pa55word \
  -p 80:80 \
  -v /opt/docker/web2py/applications:/opt/web2py/applications \
  -v /opt/docker/web2py/log:/var/log/nginx \
  --name web2py \
  madharjan/docker-nginx-web2py:2.18.5

# run container
# Web2py Minimal
docker run -d \
  -e WEB2PY_ADMIN=Pa55word \
  -p 80:80 \
  -v /opt/docker/web2py/applications:/opt/web2py/applications \
  -v /opt/docker/web2py/log:/var/log/nginx \
  --name web2py \
  madharjan/docker-nginx-web2py-min:2.18.5

Systemd Unit File

Note: update environment variables below as necessary

[Unit]
Description=Web2py Framework

After=docker.service

[Service]
TimeoutStartSec=0

ExecStartPre=-/bin/mkdir -p /opt/docker/web2py/applications
ExecStartPre=-/bin/mkdir -p /opt/docker/web2py/log
ExecStartPre=-/usr/bin/docker stop web2py
ExecStartPre=-/usr/bin/docker rm web2py
ExecStartPre=-/usr/bin/docker pull madharjan/docker-nginx-web2py:2.18.5

ExecStart=/usr/bin/docker run \
  -e WEB2PY_ADMIN=Pa55w0rd \
  -p 80:80 \
  -v /opt/docker/web2py/applications:/opt/web2py/applications \
  -v /opt/docker/web2py/log:/var/log/nginx \
  --name  web2py \
  madharjan/docker-nginx-web2py:2.18.5

ExecStop=/usr/bin/docker stop -t 2 web2py

[Install]
WantedBy=multi-user.target

Generate Systemd Unit File

Variable Default Example
PORT 8080
VOLUME_HOME /opt/docker /opt/data
NAME ngnix
WEB2PY_ADMIN Pa55w0rd
WEB2PY_MIN true false
INSTALL_PROJECT 0 1 (to enable)
PROJECT_GIT_REPO https://github.com/madharjan/web2py-contest
PROJECT_GIT_TAG HEAD v1.0

With deploy web projects

docker run --rm \
  -e PORT=80 \
  -e VOLUME_HOME=/opt/docker \
  -e VERSION=2.18.5 \
  -e WEB2PY_ADMIN=Pa55w0rd \
  -e WEB2PY_MIN=false \
  -e INSTALL_PROJECT=1 \
  -e PROJECT_GIT_REPO=https://github.com/madharjan/web2py-contest.git \
  -e PROJECT_GIT_TAG=HEAD \
  madharjan/docker-nginx-web2py-min:2.18.5 \
  web2py-systemd-unit | \
  sudo tee /etc/systemd/system/web2py.service

sudo systemctl enable web2py
sudo systemctl start web2py

docker-nginx-web2py's People

Contributors

madharjan 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.