ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

docker.md 6.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. # Docker guide
  2. This guide requires [docker](https://www.docker.com/community-edition) and
  3. [docker-compose V2](https://docs.docker.com/compose/install/).
  4. ```shell
  5. docker compose version # Must be > 2.x.x
  6. ```
  7. ## Install
  8. **PeerTube does not support webserver host change**. Keep in mind your domain
  9. name is definitive after your first PeerTube start.
  10. #### Go to your workdir
  11. :::info
  12. The guide that follows assumes an empty workdir, but you can also clone the repository, use the master branch and `cd support/docker/production`.
  13. :::
  14. ```shell
  15. cd /your/peertube/directory
  16. ```
  17. #### Get the latest Compose file
  18. ```shell
  19. curl https://raw.githubusercontent.com/chocobozzz/PeerTube/master/support/docker/production/docker-compose.yml > docker-compose.yml
  20. ```
  21. View the source of the file you're about to download: [docker-compose.yml](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/docker-compose.yml)
  22. #### Get the latest env_file
  23. ```shell
  24. curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/docker/production/.env > .env
  25. ```
  26. View the source of the file you're about to download: [.env](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/.env)
  27. #### Tweak the `docker-compose.yml` file there according to your needs
  28. ```shell
  29. sudo nano docker-compose.yml
  30. ```
  31. #### Then tweak the `.env` file to change the environment variables settings
  32. ```shell
  33. sudo nano .env
  34. ```
  35. In the downloaded example [.env](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/.env), you must replace:
  36. - `<MY POSTGRES USERNAME>`
  37. - `<MY POSTGRES PASSWORD>`
  38. - `<MY DOMAIN>` without 'https://'
  39. - `<MY EMAIL ADDRESS>`
  40. - `<MY PEERTUBE SECRET>`
  41. Other environment variables are used in
  42. [/support/docker/production/config/custom-environment-variables.yaml](https://github.com/Chocobozzz/PeerTube/blob/master/support/docker/production/config/custom-environment-variables.yaml) and can be
  43. intuited from usage.
  44. #### Webserver
  45. ::: info
  46. The docker compose file includes a configured web server. You can skip this part and comment the appropriate section in the docker compose if you use another webserver/proxy.
  47. :::
  48. Install the template that the nginx container will use.
  49. The container will generate the configuration by replacing `${WEBSERVER_HOST}` and `${PEERTUBE_HOST}` using your docker compose env file.
  50. ```shell
  51. mkdir -p docker-volume/nginx
  52. curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/nginx/peertube > docker-volume/nginx/peertube
  53. ```
  54. You need to manually generate the first SSL/TLS certificate using Let's Encrypt:
  55. ```shell
  56. mkdir -p docker-volume/certbot
  57. docker run -it --rm --name certbot -p 80:80 -v "$(pwd)/docker-volume/certbot/conf:/etc/letsencrypt" certbot/certbot certonly --standalone
  58. ```
  59. A dedicated container in the docker-compose will automatically renew this certificate and reload nginx.
  60. #### Test your setup
  61. _note_: Newer versions of compose are called with `docker compose` instead of `docker-compose`, so remove the dash in all steps that use this command if you are getting errors.
  62. Run your containers:
  63. ```shell
  64. docker compose up
  65. ```
  66. #### Obtaining your automatically-generated admin credentials
  67. You can change the automatically created password for user root by running this command from peertube's root directory:
  68. ```shell
  69. docker compose exec -u peertube peertube npm run reset-password -- -u root
  70. ```
  71. You can also grep your peertube container's logs for the default `root` password. You're going to want to run `docker-compose logs peertube | grep -A1 root` to search the log output for your new PeerTube's instance admin credentials which will look something like this.
  72. ```bash
  73. docker compose logs peertube | grep -A1 root
  74. peertube_1 | [example.com:443] 2019-11-16 04:26:06.082 info: Username: root
  75. peertube_1 | [example.com:443] 2019-11-16 04:26:06.083 info: User password: abcdefghijklmnop
  76. ```
  77. #### Obtaining Your Automatically Generated DKIM DNS TXT Record
  78. [DKIM](https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail) signature sending and RSA keys generation are enabled by the default Postfix image `mwader/postfix-relay` with [OpenDKIM](http://www.opendkim.org/).
  79. Run `cat ./docker-volume/opendkim/keys/*/*.txt` to display your DKIM DNS TXT Record containing the public key to configure to your domain :
  80. ```bash
  81. cat ./docker-volume/opendkim/keys/*/*.txt
  82. peertube._domainkey.mydomain.tld. IN TXT ( "v=DKIM1; h=sha256; k=rsa; "
  83. "p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Dx7wLGPFVaxVQ4TGym/eF89aQ8oMxS9v5BCc26Hij91t2Ci8Fl12DHNVqZoIPGm+9tTIoDVDFEFrlPhMOZl8i4jU9pcFjjaIISaV2+qTa8uV1j3MyByogG8pu4o5Ill7zaySYFsYB++cHJ9pjbFSC42dddCYMfuVgrBsLNrvEi3dLDMjJF5l92Uu8YeswFe26PuHX3Avr261n"
  84. "j5joTnYwat4387VEUyGUnZ0aZxCERi+ndXv2/wMJ0tizq+a9+EgqIb+7lkUc2XciQPNuTujM25GhrQBEKznvHyPA6fHsFheymOuB763QpkmnQQLCxyLygAY9mE/5RY+5Q6J9oDOQIDAQAB" ) ; ----- DKIM key peertube for mydomain.tld
  85. ```
  86. #### Administrator password
  87. See the production guide ["Administrator" section](https://docs.joinpeertube.org/install/any-os#administrator)
  88. #### What now?
  89. See the production guide ["What now" section](https://docs.joinpeertube.org/install/any-os#what-now).
  90. ## Upgrade
  91. ::: warning
  92. Check the changelog (in particular the *IMPORTANT NOTES* section): https://github.com/Chocobozzz/PeerTube/blob/develop/CHANGELOG.md
  93. :::
  94. Pull the latest images:
  95. ```shell
  96. cd /your/peertube/directory
  97. docker compose pull
  98. ```
  99. Stop, delete the containers and internal volumes (to invalidate static client files shared by `peertube` and `webserver` containers):
  100. ```shell
  101. docker compose down -v
  102. ```
  103. Update the nginx configuration:
  104. ```shell
  105. mv docker-volume/nginx/peertube docker-volume/nginx/peertube.bak
  106. curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/master/support/nginx/peertube > docker-volume/nginx/peertube
  107. ```
  108. Rerun PeerTube:
  109. ```shell
  110. docker compose up -d
  111. ```
  112. ## Build
  113. ### Production
  114. ```shell
  115. git clone https://github.com/chocobozzz/PeerTube /tmp/peertube
  116. cd /tmp/peertube
  117. docker build . -f ./support/docker/production/Dockerfile.bookworm
  118. ```
  119. ### Development
  120. We don't have a Docker image for development. See [the CONTRIBUTING guide](https://github.com/Chocobozzz/PeerTube/blob/develop/.github/CONTRIBUTING.md#develop) for more information on how you can hack PeerTube!