Bläddra i källkod

Update scripts and instructions for using/building Docker image

pull/142/head
Raymond Tau 5 år sedan
förälder
incheckning
f070c76417
4 ändrade filer med 27 tillägg och 26 borttagningar
  1. +1
    -1
      README.rst
  2. +14
    -16
      docker-contents/README.rst
  3. +10
    -8
      docker-contents/bootstrap.sh
  4. +2
    -1
      docker-contents/build_docker.sh

+ 1
- 1
README.rst Visa fil

@@ -20,7 +20,7 @@ Feature
Setup Guide for users
--------------------------

Please use docker to install `docker-pinry <https://github.com/pinry/docker-pinry>`_
Please use docker to install `pinry <https://github.com/pinry/pinry>`_

Developers or users who are familiar with python/nginx could setup Pinry with following guide : )



+ 14
- 16
docker-contents/README.rst Visa fil

@@ -1,30 +1,29 @@
docker-pinry
Pinry Docker
============

.. image:: https://travis-ci.org/pinry/docker-pinry.svg?branch=master
:target: https://travis-ci.org/pinry/docker-pinry

A nice and easy way to get a pinry instance up and running using docker. For
A nice and easy way to get a Pinry instance up and running using docker. For
help on getting started with docker see the `official getting started guide`_.
For more information on Pinry and a demo check out it's `website`_.


Getting docker-pinry
Getting Pinry Docker
---------------------

Running this will get the latest version of both
docker-pinry and pinry itself::
Running this will get the latest version of pinry itself::

git clone https://github.com/pinry/docker-pinry
cd docker-pinry
./bootstrap.sh
git clone https://github.com/pinry/pinry
cd pinry
./docker-contents/bootstrap.sh

Now you can start your container by command like this::

# this is where your database and pins localted
mkdir data
# use absolute path for docker to avoid using default data-volume (we use directory instead)
./start_docker.sh `readlink -f data`
./docker-contents/start_docker.sh `readlink -f data`

Please visit `http://your-ip` to visit your instance and register a new account, enjoy it.

@@ -40,10 +39,9 @@ Enable signups for new users by editing ``pinry/local_settings.py``::
Building docker-pinry again
---------------------------

Running this will build you a docker image with the latest version of both
docker-pinry and pinry itself::
Running this will build you a docker image with the latest version of pinry::

./build_docker.sh
./docker-contents/build_docker.sh


Running docker-pinry in manual way
@@ -61,12 +59,12 @@ Then you have two choice to run docker-pinry

Fist one, with automaticlly configured default arguments::

./start_docker.sh /mnt/pinry
./docker-contents/start_docker.sh /mnt/pinry


Second one, start docker by hand with customized arguments::

SETTINGS_PATH=$(readlink -f ./pinry/local_settings.py) \
SETTINGS_PATH=$(readlink -f docker-contents/pinry/local_settings.py) \
DATA_PATH=$(readlink -f /mnt/pinry) \
sudo docker run -d=true -p=10000:80 \
-v=${DATA_PATH}:/data \
@@ -88,7 +86,7 @@ Running docker-pinry with docker-compose
Just config your ``docker-compose.yml`` and then run::

sudo pip install -U docker-compose
sudo docker-compose up -d
sudo docker-compose --project-directory docker-contents up -d


Notes on the run commands
@@ -134,4 +132,4 @@ stronger database solution.

.. _official getting started guide: http://www.docker.io/gettingstarted/
.. _website: http://getpinry.com/
.. _additional pinry configuration settings: https://github.com/pinry/docker-pinry/blob/master/pinry/local_settings.example.py
.. _additional pinry configuration settings: https://github.com/pinry/pinry/blob/master/docker-contents/pinry/local_settings.example.py

+ 10
- 8
docker-contents/bootstrap.sh Visa fil

@@ -1,12 +1,13 @@
#!/bin/bash

script_dir="$( dirname "${0}" )"
# Force users to login before seeing any pins.
if [ "${ALLOW_NEW_REGISTRATIONS}" = "" ]; then
ALLOW_NEW_REGISTRATIONS=true
fi

if [[ "$(docker images -q pinry/pinry 2> /dev/null)" == "" ]]; then
echo "No docker image found, building..." && ./build_docker.sh
echo "No docker image found, building..." && "${script_dir}/build_docker.sh"
fi

echo "=================================================================================="
@@ -25,25 +26,26 @@ echo ""
echo ${SECRET_KEY}
echo "=================================================================================="

local_settings_file="${script_dir}/pinry/local_settings.py"
# Create local_settings.py
if [ ! -f ./pinry/local_settings.py ];
if [ ! -f "${local_settings_file}" ];
then
cp ./pinry/local_settings.example.py ./pinry/local_settings.py
sed -i "s/secret\_key\_place\_holder/${SECRET_KEY}/" ./pinry/local_settings.py
cp "${script_dir}/pinry/local_settings.example.py" "${local_settings_file}"
sed -i "s/secret\_key\_place\_holder/${SECRET_KEY}/" "${local_settings_file}"

# Force users to login before seeing any pins.
if [ "${PRIVATE}" = "true" ]; then
sed -i "s/PUBLIC = True/PUBLIC = False/" ./pinry/local_settings.py
sed -i "s/PUBLIC = True/PUBLIC = False/" "${local_settings_file}"
fi

# Enable people from creating new accounts.
if [ "${ALLOW_NEW_REGISTRATIONS}" = "true" ]; then
sed -i "s/ALLOW_NEW_REGISTRATIONS = False/ALLOW_NEW_REGISTRATIONS = True/" ./pinry/local_settings.py
sed -i "s/ALLOW_NEW_REGISTRATIONS = False/ALLOW_NEW_REGISTRATIONS = True/" "${local_settings_file}"
fi
fi

# Copy to docker-compose.yml
if [ ! -f ./docker-compose.yml ];
if [ ! -f "${script_dir}/docker-compose.yml" ];
then
cp ./docker-compose.example.yml ./docker-compose.yml
cp "${script_dir}/docker-compose.example.yml" "${script_dir}/docker-compose.yml"
fi

+ 2
- 1
docker-contents/build_docker.sh Visa fil

@@ -1,3 +1,4 @@
#!/bin/bash

sudo docker build --no-cache -t pinry/pinry${@} .
script_dir="$( dirname "${0}" )"
sudo docker build -t pinry/pinry${@} "${script_dir}/../" -f "${script_dir}/../Dockerfile.autobuild"

Laddar…
Avbryt
Spara