Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
5 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. Pinry Docker
  2. ============
  3. .. image:: https://travis-ci.org/pinry/docker-pinry.svg?branch=master
  4. :target: https://travis-ci.org/pinry/docker-pinry
  5. A nice and easy way to get a Pinry instance up and running using docker. For
  6. help on getting started with docker see the `official getting started guide`_.
  7. For more information on Pinry and a demo check out it's `website`_.
  8. Getting Pinry Docker
  9. ---------------------
  10. Running this will get the latest version of pinry itself::
  11. git clone https://github.com/pinry/pinry
  12. cd pinry
  13. ./docker/bootstrap.sh
  14. Now you can start your container by command like this::
  15. # this is where your database and pins localted
  16. mkdir data
  17. # use absolute path for docker to avoid using default data-volume (we use directory instead)
  18. ./docker/start_docker.sh `readlink -f data`
  19. Please visit `http://your-ip` to visit your instance and register a new account, enjoy it.
  20. Configuring docker-pinry
  21. ------------------------
  22. Enable signups for new users by editing ``pinry/local_settings.py``::
  23. ALLOW_NEW_REGISTRATIONS = True
  24. `Additional pinry configuration settings`_
  25. Building docker-pinry again
  26. ---------------------------
  27. Running this will build you a docker image with the latest version of pinry::
  28. ./docker/build_docker.sh
  29. Running docker-pinry in manual way
  30. ----------------------------------
  31. Running the start command for the first time will setup your production secret
  32. key, database and static files. It is important that you decide what port you
  33. want and what location on the host machine you wish to store your files. If this
  34. is the only thing running on your system and you wish to make it public without
  35. a proxy then you can set ``-p=80:80``. The setting ``-p=10000:80`` assumes you
  36. are wanting to proxy to this instance using something like nginx. Also note that
  37. you must have your host mount directory created first (``mkdir -p /mnt/pinry``)
  38. Then you have two choice to run docker-pinry
  39. Fist one, with automaticlly configured default arguments::
  40. ./docker/start_docker.sh /mnt/pinry
  41. Second one, start docker by hand with customized arguments::
  42. SETTINGS_PATH=$(readlink -f docker/pinry/local_settings.py) \
  43. DATA_PATH=$(readlink -f /mnt/pinry) \
  44. sudo docker run -d=true -p=10000:80 \
  45. -v=${DATA_PATH}:/data \
  46. -v=${SETTINGS_PATH}:/srv/www/pinry/pinry/settings/local_settings.py \
  47. pinry/pinry /scripts/start.sh
  48. If it's the first run it'll take a few seconds but it will print out your
  49. container ID which should be used to start and stop the container in the future
  50. using the commands::
  51. sudo docker start <container_id>
  52. sudo docker stop <container_id>
  53. Running docker-pinry with docker-compose
  54. -----------------------------------------
  55. Just config your ``docker-compose.yml`` and then run::
  56. sudo pip install -U docker-compose
  57. sudo docker-compose --project-directory docker up -d
  58. Notes on the run commands
  59. `````````````````````````
  60. * ``-v`` is the volume you are mounting ``-v=host_dir:docker_dir``
  61. * ``pinry/pinry`` is simply what I called my docker build of this image
  62. * ``-d=true`` allows this to run cleanly as a daemon, remove for debugging
  63. * ``-p`` is the port it connects to, ``-p=host_port:docker_port``
  64. * Follow comments in ``local_settings.py`` to understand how the site configured
  65. Using docker-pinry
  66. ------------------
  67. Open a browser to ``http://<YOUR-HOSTNAME>:10000`` and register. Replace YOUR-HOSTNAME with the name
  68. of the machine docker is running on, likely localhost.
  69. You can map ``http://localhost:10000`` to your outer nginx for SSL or just change
  70. the default port-mapping to ``80:80`` to serve your site directly, just enjoy!
  71. Why include nginx and not just map to gunicorn directly?
  72. -----------------------------------------------------------
  73. Because gunicorn/django can't serve static files very well and it is unwise to do
  74. so for security reasons. I built this so that people can have a full hosted
  75. solution in a container. If you have a host machine running nginx then of course
  76. there is no point to run nginx in the container as well, you can simply disable
  77. nginx, map gunicorn to a port and then set your host machine's nginx to display
  78. your media and static files since that directory is shared between the container
  79. and host.
  80. Why use sqlite3?
  81. ----------------
  82. Because it has a very low resource cost and most pinry websites are small
  83. personal ones. Why have a full on database for that? If you need more power
  84. than you can easily modify the `pinry/local_settings.py` to point to a
  85. stronger database solution.
  86. .. Links
  87. .. _official getting started guide: http://www.docker.io/gettingstarted/
  88. .. _website: http://getpinry.com/
  89. .. _additional pinry configuration settings: https://github.com/pinry/pinry/blob/master/docker/pinry/local_settings.example.py