Commit 542a8867 authored by Hermann Mayer's avatar Hermann Mayer
Browse files

[Config] Added docker configuration.

parent b328d089
Loading
Loading
Loading
Loading

Dockerfile

0 → 100644
+11 −0
Original line number Diff line number Diff line
FROM php:5.4-apache
MAINTAINER Hermann Mayer <hermann.mayer92@gmail.com>

COPY . /var/www/html/
RUN chmod 755 /var/www/html/var/docker/*
RUN /var/www/html/var/docker/install

EXPOSE 80

ENTRYPOINT ["/var/www/html/var/docker/init"]
CMD ["app:start"]

Makefile

0 → 100644
+64 −0
Original line number Diff line number Diff line
# Commands and Paths
SHELL=/bin/bash

CONTAINER_VERSION := 0.3.1
CONTAINER_REGISTRY := e5.lan:5000
CONTAINER_NAME := ebay-tool
CONTAINER_URI := $(CONTAINER_REGISTRY)/$(CONTAINER_NAME):$(CONTAINER_VERSION)
QUICKSTART_CONTAINER := ebay-tool-quickstart

.PHONY: build-image rebuild-image clean-image start-image start-bash-image stop-image image-logs

all: help
help:
	##### Docker Image Development #####
	# build-image            Build the docker container
	# rebuild-image          Full test cycle, clean, build, start and show logs
	# clean-image            Remove the builded image
	#
	##### Docker Image Process control #####
	# start-image            Start the builded container
	# start-bash-image       Start a bash shell on the builded container
	# stop-image             Stop and remove the builded container
	# image-logs             Show the logs of the container

#####################################
# Docker Image Development
#####################################

build-image:
	time docker build -t "$(CONTAINER_URI)" .

start-image: stop-image
	docker run --name='$(QUICKSTART_CONTAINER)' -d \
		-p 18080:80 \
		-e 'DB_USER=root' \
		-e 'DB_PASS=' \
		-e 'DB_HOST=172.17.42.1' \
		-e 'DB_PORT=3306' \
		-e 'DB_NAME=ebay_tool' \
		-e 'APP_SALT=xxx' \
		-e 'APP_RECAPTCHA_PUBKEY=xxx' \
		-e 'APP_RECAPTCHA_PRIVKEY=xxx' \
		--dns 10.0.0.253 \
		"$(CONTAINER_URI)"
	@make image-logs

start-bash-image:
	docker run -i --name='$(QUICKSTART_CONTAINER)-bash' \
		-p 18080:3000 \
		"$(CONTAINER_URI)" /bin/bash

stop-image:
	docker stop '$(QUICKSTART_CONTAINER)' || exit 0
	docker stop '$(QUICKSTART_CONTAINER)-bash' || exit 0
	docker rm '$(QUICKSTART_CONTAINER)' || exit 0
	docker rm '$(QUICKSTART_CONTAINER)-bash' || exit 0

clean-image: stop-image
	docker rmi "$(CONTAINER_URI)" || exit 0

rebuild-image: clean-image build-image start-image image-logs

image-logs:
	docker logs -f '$(QUICKSTART_CONTAINER)'

README

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
eBay-Tool is a simple product styler for ebay written by Hermann Mayer

README.md

0 → 100644
+117 −0
Original line number Diff line number Diff line
# eBay-Tool

eBay-Tool is a simple product styler for product descriptions on ebay.

- [Requirements](#requirements)
  - [Production](#production)
  - [Development](#development)
- [Getting started](#getting-started)
- [Deployment](#deployment)
  - [Quick Start](#quick-start)
  - [Available Configuration Parameters](#available-configuration-parameters)
    - [Application](#application)
    - [Database](#database)
    - [E-Mail](#e-mail)
  - [Data volumes](#data-volumes)
  - [Development](#development-1)

## Requirements

### Production

* A running MySQL server
* A running mail server

### Development

* A running MySQL server, as well
* [apt-cacher-ng](https://www.unix-ag.uni-kl.de/~bloch/acng/)
    * Disable with `USE_APT_CACHE=0` on [var/docker/install](var/docker/install)

## Getting started

## Deployment

This application is able to be deployed with the help of docker.
The next sections will help you building a shipable image of the app.

### Quick Start

```bash
# Run the container
$ docker run -d \
    -p 10080:80 \
    -e 'DB_USER=root' \
    -e 'DB_PASS=' \
    -e 'DB_HOST=172.17.42.1' \
    -e 'DB_PORT=3306' \
    -e 'DB_NAME=ebay_tool' \
    -e 'APP_SALT=xxx' \
    -e 'APP_RECAPTCHA_PUBKEY=xxx' \
    -e 'APP_RECAPTCHA_PRIVKEY=xxx' \
    "e5.lan:5000/ebay-tool:0.3.1"
```

### Available Configuration Parameters

#### Application

- **APP_SERVERNAME**: Application uri. Defaults to `http://ebay-tool.hermann-mayer.net`.
- **APP_SALT**: Application salt.
- **APP_RECAPTCHA_PUBKEY**: ReCaptcha public key.
- **APP_RECAPTCHA_PRIVKEY**: ReCaptcha private key.

#### Database

- **DB_HOST**: Hostname/IP address of the MySQL server
- **DB_PORT**: Port of the MySQL server. Defaults to `3306`.
- **DB_NAME**: Name of the database. Defaults to `ebay_tool`.
- **DB_USER**: Username for auth. Defaults to `root`.
- **DB_PASS**: Password for auth. Defaults to `~`.

#### E-Mail

- **SMTP_HOST**: SMTP mail server hostname. Defaults to `mail.lan`.
- **SMTP_PORT**: SMTP mail server port. Defaults to `25`.
- **SMTP_SENDER_ADDRESS**: Sender address of any mail. Defaults to `ebay-tool.hermann-mayer.net`.

### Data volumes

Its important to mount a data volume on `/var/www/html/public/extern/images`. This
is the path to all uploaded images. If you don't setup a volume on this path you
will probably loose your uploaded images on a container restart.

Here is simple example:

```bash
# Run the container
$ docker run -d \
    -p 10080:80 \
    -e 'ALL_YOUR_SETTINGS=xxx' \
    -v '/your/host/path:/var/www/html/public/extern/images'
    "e5.lan:5000/ebay-tool:0.3.1"
```

### Development

```bash
# Build the container
$ make build-image

# Start the builded container (quickstart)
$ make start-image

# Stop the container
$ make stop-image

# Purge the build - so you could start over with
# another build
$ make clean-image

# See logs for the running container
$ make image-logs

# Start a bash session on the builded container for debugging.
# This command need **clean** or **stop** like the normal **start**.
$ make start-bash-image
```

TODO

deleted100644 → 0
+0 −7
Original line number Diff line number Diff line
Feature Request:
------------------------------------


Bugs:
------------------------------------
Loading