logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

migrating_from_source_otp_en.md (5401B)


  1. # Switching a from-source install to OTP releases
  2. {! backend/installation/otp_vs_from_source.include !}
  3. In this guide we cover how you can migrate from a from source installation to one using OTP releases.
  4. ## Pre-requisites
  5. You will be running commands as root. If you aren't root already, please elevate your privileges by executing `sudo su`/`su`.
  6. The system needs to have `curl` and `unzip` installed for downloading and unpacking release builds.
  7. === "Alpine"
  8. ```sh
  9. apk add curl unzip
  10. ```
  11. === "Debian/Ubuntu"
  12. ```sh
  13. apt install curl unzip
  14. ```
  15. ## Moving content out of the application directory
  16. When using OTP releases the application directory changes with every version so it would be a bother to keep content there (and also dangerous unless `--no-rm` option is used when updating). Fortunately almost all paths in Pleroma are configurable, so it is possible to move them out of there.
  17. Pleroma should be stopped before proceeding.
  18. ### Moving uploads/custom public files directory
  19. ```sh
  20. # Create uploads directory and set proper permissions (skip if using a remote uploader)
  21. # Note: It does not have to be `/var/lib/pleroma/uploads`, you can configure it to be something else later
  22. mkdir -p /var/lib/pleroma/uploads
  23. chown -R pleroma /var/lib/pleroma
  24. # Create custom public files directory
  25. # Note: It does not have to be `/var/lib/pleroma/static`, you can configure it to be something else later
  26. mkdir -p /var/lib/pleroma/static
  27. chown -R pleroma /var/lib/pleroma
  28. # If you use the local uploader with default settings your uploads should be located in `~pleroma/uploads`
  29. mv ~pleroma/uploads/* /var/lib/pleroma/uploads
  30. # If you have created the custom public files directory with default settings it should be located in `~pleroma/instance/static`
  31. mv ~pleroma/instance/static /var/lib/pleroma/static
  32. ```
  33. ### Moving emoji
  34. Assuming you have all emojis in subdirectories of `priv/static/emoji` moving them can be done with
  35. ```sh
  36. mkdir /var/lib/pleroma/static/emoji
  37. ls -d ~pleroma/priv/static/emoji/*/ | xargs -i sh -c 'mv "{}" "/var/lib/pleroma/static/emoji/$(basename {})"'
  38. ```
  39. But, if for some reason you have custom emojis in the root directory you should copy the whole directory instead.
  40. ```sh
  41. mv ~pleroma/priv/static/emoji /var/lib/pleroma/static/emoji
  42. ```
  43. and then copy custom emojis to `/var/lib/pleroma/static/emoji/custom`.
  44. This is needed because storing custom emojis in the root directory is deprecated, but if you just move them to `/var/lib/pleroma/static/emoji/custom` it will break emoji urls on old posts.
  45. Note that globs have been replaced with `pack_extensions`, so if your emojis are not in png/gif you should [modify the default value](../configuration/cheatsheet.md#emoji).
  46. ### Moving the config
  47. ```sh
  48. # Create the config directory
  49. # The default path for Pleroma config is /etc/pleroma/config.exs
  50. # but it can be set via PLEROMA_CONFIG_PATH environment variable
  51. mkdir -p /etc/pleroma
  52. # Move the config file
  53. mv ~pleroma/config/prod.secret.exs /etc/pleroma/config.exs
  54. # Change `use Mix.Config` at the top to `import Config`
  55. $EDITOR /etc/pleroma/config.exs
  56. ```
  57. ## Installing the release
  58. Before proceeding, get the flavour from [Detecting flavour](otp_en.md#detecting-flavour) section in OTP installation guide.
  59. ```sh
  60. # Delete all files in pleroma user's directory
  61. rm -r ~pleroma/*
  62. # Set the flavour environment variable to the string you got in Detecting flavour section.
  63. # For example if the flavour is `amd64-musl` the command will be
  64. export FLAVOUR="amd64-musl"
  65. # Clone the release build into a temporary directory and unpack it
  66. # Replace `stable` with `unstable` if you want to run the unstable branch
  67. sudo -Hu pleroma "
  68. curl 'https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=$FLAVOUR' -o /tmp/pleroma.zip
  69. unzip /tmp/pleroma.zip -d /tmp/
  70. "
  71. # Move the release to the home directory and delete temporary files
  72. sudo -Hu pleroma "
  73. mv /tmp/release/* ~pleroma/
  74. rmdir /tmp/release
  75. rm /tmp/pleroma.zip
  76. "
  77. # Start the instance to verify that everything is working as expected
  78. sudo -Hu pleroma "./bin/pleroma daemon"
  79. # Wait for about 20 seconds and query the instance endpoint, if it shows your uri, name and email correctly, you are configured correctly
  80. sleep 20 && curl http://localhost:4000/api/v1/instance
  81. # Stop the instance
  82. sudo -Hu pleroma "./bin/pleroma stop"
  83. ```
  84. ## Setting up a system service
  85. OTP releases have different service files than from-source installs so they need to be copied over again.
  86. **Warning:** The service files assume pleroma user's home directory is `/opt/pleroma`, please make sure all paths fit your installation.
  87. === "Alpine"
  88. ```sh
  89. # Copy the service into a proper directory
  90. cp -f ~pleroma/installation/init.d/pleroma /etc/init.d/pleroma
  91. # Start pleroma
  92. rc-service pleroma start
  93. ```
  94. === "Debian/Ubuntu"
  95. ```sh
  96. # Copy the service into a proper directory
  97. cp ~pleroma/installation/pleroma.service /etc/systemd/system/pleroma.service
  98. # Reload service files
  99. systemctl daemon-reload
  100. # Reenable pleroma to start on boot
  101. systemctl reenable pleroma
  102. # Start pleroma
  103. systemctl start pleroma
  104. ```
  105. ## Running mix tasks
  106. Refer to [Running mix tasks](otp_en.md#running-mix-tasks) section from OTP release installation guide.
  107. ## Updating
  108. Refer to [Updating](otp_en.md#updating) section from OTP release installation guide.