logo

pleroma

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

setting_up_pleroma_dev.md (3737B)


  1. # Setting up a Pleroma development environment
  2. Pleroma requires some adjustments from the defaults for running the instance locally. The following should help you to get started.
  3. ## Installing
  4. 1. Install Pleroma as explained in [the docs](../installation/debian_based_en.md), with some exceptions:
  5. * You can use your own fork of the repository and add pleroma as a remote `git remote add pleroma 'https://git.pleroma.social/pleroma/pleroma'`
  6. * You can skip systemd and nginx and all that stuff
  7. * No need to create a dedicated pleroma user, it's easier to just use your own user
  8. * For the DB you can still choose a dedicated user, the mix tasks set it up for you so it's no extra work for you
  9. * For domain you can use `localhost`
  10. * instead of creating a `prod.secret.exs`, create `dev.secret.exs`
  11. * No need to prefix with `MIX_ENV=prod`. We're using dev and that's the default MIX_ENV
  12. 2. Change the dev.secret.exs
  13. * Change the scheme in `config :pleroma, Pleroma.Web.Endpoint` to http (see examples below)
  14. * If you want to change other settings, you can do that too
  15. 3. You can now start the server `mix phx.server`. Once it's build and started, you can access the instance on `http://<host>:<port>` (e.g.http://localhost:4000 ) and should be able to do everything locally you normally can.
  16. Example config to change the scheme to http. Change the port if you want to run on another port.
  17. ```elixir
  18. config :pleroma, Pleroma.Web.Endpoint,
  19. url: [host: "localhost", scheme: "http", port: 4000],
  20. ```
  21. Example config to disable captcha. This makes it a bit easier to create test-users.
  22. ```elixir
  23. config :pleroma, Pleroma.Captcha,
  24. enabled: false
  25. ```
  26. Example config to change the log level to info
  27. ```elixir
  28. config :logger, :console,
  29. # :debug :info :warning :error
  30. level: :info
  31. ```
  32. ## Testing
  33. 1. Create a `config/test.secret.exs` file with the content as shown below
  34. 2. Create the database user and test database.
  35. 1. You can use the `config/setup_db.psql` as a template. Copy the file if you want and change the database name, user and password to the values for the test-database (e.g. 'pleroma_local_test' for database and user). Then run this file like you did during installation.
  36. 2. The tests will try to create the Database, so we'll have to allow our test-database user to create databases, `sudo -Hu postgres psql -c "ALTER USER pleroma_local_test WITH CREATEDB;"`
  37. 3. Run the tests with `mix test`. The tests should succeed.
  38. Example content for the `test.secret.exs` file. Feel free to use another user, database name or password, just make sure the database is dedicated for the testing environment.
  39. ```elixir
  40. # Pleroma test configuration
  41. # NOTE: This file should not be committed to a repo or otherwise made public
  42. # without removing sensitive information.
  43. import Config
  44. config :pleroma, Pleroma.Repo,
  45. username: "pleroma_local_test",
  46. password: "mysuperduperpassword",
  47. database: "pleroma_local_test",
  48. hostname: "localhost"
  49. ```
  50. ## Updating
  51. Update Pleroma as explained in [the docs](../administration/updating.md). Just make sure you pull from upstream and not from your own fork.
  52. ## Working on multiple branches
  53. If you develop on a separate branch, it's possible you did migrations that aren't merged into another branch you're working on. If you have multiple things you're working on, it's probably best to set up multiple pleroma's each with their own database. If you finished with a branch and want to switch back to develop to start a new branch from there, you can drop the database and recreate the database (e.g. by using `config/setup_db.psql`). The commands to drop and recreate the database can be found in [the docs](../administration/backup.md).