Advertisement
Guest User

pleroma install script (incomplete)

a guest
Jun 12th, 2021
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. #/bin/bash
  2. #
  3. # Install dependencies
  4. apt install curl unzip libncurses5 postgresql postgresql-contrib nginx certbot libmagic-dev -y
  5. #
  6. # Install optional dependencies (# next line if you don't want them)
  7. apt install imagemagick ffmpeg libimage-exiftool-perl -y
  8. sleep 3
  9. clear
  10. #
  11. # Time to start setup
  12. echo "Let's begin setup shall we"
  13. sleep 3
  14. # Installing Postgresql RUM indexes
  15. # Available only on Buster/19.04
  16. # NOTE: Check version manually. install instructions said 11 but i had to get 12.
  17. #
  18. apt install postgresql-12-rum -y
  19. # Restart Postgresql
  20. systemctl restart postgresql
  21. #
  22. # Installing Pleroma (script coppied from website instructions below)
  23. # Create a Pleroma user
  24. adduser --system --shell /bin/false --home /opt/pleroma pleroma
  25. #
  26. # Set the flavour environment variable to the string you got in Detecting flavour section.
  27. # For example if the flavour is `amd64-musl` the command will be
  28. # NOTE: change to proper arch
  29. export FLAVOUR="amd64-musl"
  30. #
  31. # Clone the release build into a temporary directory and unpack it
  32. su pleroma -s $SHELL -lc "
  33. curl 'https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=$FLAVOUR' -o /tmp/pleroma.zip
  34. unzip /tmp/pleroma.zip -d /tmp/
  35. "
  36. #
  37. # Move the release to the home directory and delete temporary files
  38. su pleroma -s $SHELL -lc "
  39. mv /tmp/release/* /opt/pleroma
  40. rmdir /tmp/release
  41. rm /tmp/pleroma.zip
  42. "
  43. # Create uploads directory and set proper permissions (skip if planning to use a remote uploader)
  44. # Note: It does not have to be `/var/lib/pleroma/uploads`, the config generator will ask about the upload directory later
  45. #
  46. mkdir -p /var/lib/pleroma/uploads
  47. chown -R pleroma /var/lib/pleroma
  48. #
  49. # Create custom public files directory (custom emojis, frontend bundle overrides, robots.txt, etc.)
  50. # Note: It does not have to be `/var/lib/pleroma/static`, the config generator will ask about the custom public files directory later
  51. mkdir -p /var/lib/pleroma/static
  52. chown -R pleroma /var/lib/pleroma
  53. #
  54. # Create a config directory
  55. mkdir -p /etc/pleroma
  56. chown -R pleroma /etc/pleroma
  57. #
  58. # Run the config generator
  59. touch /etc/pleroma/config.exs
  60. chown -R pleroma /etc/pleroma
  61. su pleroma -s $SHELL -lc "./bin/pleroma_ctl instance gen --force --output /etc/pleroma/config.exs --output-psql /tmp/setup_db.psql"
  62. #
  63. # Create the postgres database
  64. su postgres -s $SHELL -lc "psql -f /tmp/setup_db.psql"
  65. #
  66. # Create the database schema
  67. su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate"
  68. #
  69. # If you have installed RUM indexes uncommend and run
  70. # su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
  71. #
  72. # Start the instance to verify that everything is working as expected
  73. su pleroma -s $SHELL -lc "./bin/pleroma daemon"
  74. #
  75. # Wait for about 20 seconds and query the instance endpoint, if it shows your uri, name and email correctly, you are configured correctly
  76. sleep 20 && curl http://localhost:4000/api/v1/instance
  77. #
  78. # Stop the instance
  79. su pleroma -s $SHELL -lc "./bin/pleroma stop"
  80. #
  81. # Setup Lets Encrypt
  82. # NOTE: change yourinstance.tld to your domain name below
  83. systemctl stop nginx.service
  84. certbot certonly --standalone --preferred-challenges http -d yourinstance.tld
  85. #
  86. # Copy Pleroma nginx configuration to the nginx folder
  87. cp /opt/pleroma/installation/pleroma.nginx /etc/nginx/sites-available/pleroma.conf
  88. ln -s /etc/nginx/sites-available/pleroma.conf /etc/nginx/sites-enabled/pleroma.conf
  89. #
  90. #
  91. # visit https://docs.pleroma.social/backend/installation/otp_en/
  92. # Refer to the section titled "Edit the nginx config"
  93. # NOTE: you need to replace yourinstance.tld with the domain name in /etc/nginx/sites-availible/pleroma.conf
  94. # That line appears a number of times. use the find command in your editor.
  95. #
  96. #
  97. #systemctl start nginx.service
  98. #
  99. #Setup Pleroma service at boot (copied from install instructions)
  100. # Copy the service into a proper directory
  101. #cp /opt/pleroma/installation/pleroma.service /etc/systemd/system/pleroma.service
  102. #
  103. # Start pleroma and enable it on boot
  104. #systemctl start pleroma
  105. #systemctl enable pleroma
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement