Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Starting implementation of the setup method and revision images in th…
Browse files Browse the repository at this point in the history
…e readme
  • Loading branch information
Sven Speckmaier committed Jun 2, 2016
1 parent d07f026 commit d72f11e
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# rancherize

[![Latest Stable Version](https://poser.pugx.org/ipunkt/rancherize/v/stable.svg)](https://packagist.org/packages/ipunkt/rancherize) [![Latest Unstable Version](https://poser.pugx.org/ipunkt/rancherize/v/unstable.svg)](https://packagist.org/packages/ipunkt/rancherize) [![License](https://poser.pugx.org/ipunkt/rancherize/license.svg)](https://packagist.org/packages/ipunkt/rancherize) [![Total Downloads](https://poser.pugx.org/ipunkt/rancherize/downloads.svg)](https://packagist.org/packages/ipunkt/rancherize)
Rancherize your development workflow

## Features
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 6 additions & 3 deletions rancherize
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ svn status | egrep -v '\bdeploy' | egrep -v '\bdocker' | awk '{ print $1; }' | e
#
#
source deploy/config.cfg

source $SCRIPTPATH/usage.sh
source $SCRIPTPATH/setup.sh

function getWebId {
docker ps | grep Web_ | awk '{ print $1; }'
Expand Down Expand Up @@ -301,16 +303,17 @@ case $1 in
usage $PARAMETERS
exit 0
;;
# init)
setup)
setup
# Concept:
# Copies files from the docker script directory to the destination directory and fills in project name and some other
# configuration variables
# Note: Ask for project name and fill them in the config file
# Generate secure password for environments
# fill DB_USER and DB_PASSWORD with PROJECTNAME_somestring
# TODO: Switch laravel-nginx database Variable names to DB_HOST, DB_USERNAME, DB_PASSWORD
# exit 0
# ;;
exit 0
;;
*)
usage
exit 0
Expand Down
69 changes: 69 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

#
# Setup
#
# Initialize an app for use with rancherize
#

#
# collect_data
#
# Ask the user for all necesasry information
#
function collect_data {
echo "PROJECT_NAME"
echo
echo "The project name is used by docker-compose to identify Containers."
echo "So if projectA and projectB both have a mysql container named"
echo "MySQL and share the same PROJECT_NAME then docker-compose will try"
echo "to reuse the already created container which leads to problems"
read -e -p "PROJECT_NAME: " PROJECT_NAME

echo ""
echo "DOCKER_REPOSITORY_USER"
echo ""
echo "The user to which your docker image should be pushed to"
read -e -p "DOCKER_REPOSITORY_USER: " DOCKER_REPOSITORY_USER

echo ""
echo "DOCKER_REPOSITORY_NAME"
echo ""
echo "The repository name to which your docker image should be pushed to"
read -e -p "DOCKER_REPOSITORY_NAME: " DOCKER_REPOSITORY_NAME

echo ""
echo "RANCHER_SERVICE_NAME"
echo ""
echo ""
read -e -p "RANCHER_SERVICE_NAME: " RANCHER_SERVICE_NAME
}

#
# do_copy
#
# Create the files based on the users answers
#
function do_copy {

if [ ! -d deploy ] ; then
mkdir deploy
fi

sed \
-e "s/%DOCKER_REPOSITORY_USER%/$DOCKER_REPOSITORY_USER/g" \
-e "s/%DOCKER_REPOSITORY_NAME%/$DOCKER_REPOSITORY_NAME/g" \
-e "s/%PROJECT_NAME%/$PROJECT_NAME/g" \
$SCRIPTPATH/templates/config.cfg > deploy/config.cfg

cp $SCRIPTPATH/templates/Dockerfile .
}

function setup {

echo "=== Setup wizard ==="

collect_data

do_copy
}
File renamed without changes.
27 changes: 27 additions & 0 deletions templates/config.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# The docker-compose project name
PROJECT_NAME=%PROJECT_NAME%


#
# Dockerhub Configuration
#
# The docker image will be published to
# DOCKER_REPOSITORY_USER/DOCKER_REPOSITORY_NAME:PROJECT_PREFIX$VERSION
#

# The docker username to which the image should be published
DOCKER_REPOSITORY_USER=%DOCKER_REPOSITORY_USER%

# The docker
DOCKER_REPOSITORY_NAME=%DOCKER_REPOSITORY_NAME%

# The docker tag prefix. Will be added in front of all docker tags when building
# or commiting
PROJECT_PREFIX=%DOCKER_TAG_PREFIX%

#
# Rancher Configuration
#

# The rancher service name to use. Will be suffixed by -VERSION
SERVICE_NAME=%RANCHER_SERVICE_NAME%
7 changes: 7 additions & 0 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM busybox
ADD . /var/www/laravel
VOLUME /var/www/laravel
ADD nginx-conf/laravel.conf.tpl /etc/nginx/conf.template.d/
VOLUME /etc/nginx/conf.template.d
RUN sh -c 'if [ -f "/var/www/laravel/docker-prepare.sh" ] ; then sh /var/www/laravel/docker-prepare.sh ; fi'
CMD /bin/dc
27 changes: 27 additions & 0 deletions test/deploy/config.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# The docker-compose project name
PROJECT_NAME=testproject


#
# Dockerhub Configuration
#
# The docker image will be published to
# DOCKER_REPOSITORY_USER/DOCKER_REPOSITORY_NAME:PROJECT_PREFIX$VERSION
#

# The docker username to which the image should be published
DOCKER_REPOSITORY_USER=ipunkt

# The docker
DOCKER_REPOSITORY_NAME=%DOCKER_REPOSITORY_NAME%

# The docker tag prefix. Will be added in front of all docker tags when building
# or commiting
PROJECT_PREFIX=%DOCKER_TAG_PREFIX%

#
# Rancher Configuration
#

# The rancher service name to use. Will be suffixed by -VERSION
SERVICE_NAME=%RANCHER_SERVICE_NAME%

0 comments on commit d72f11e

Please sign in to comment.