WriteFreely: Difference between revisions

From NixOS Wiki
imported>Jakehamilton
An open source platform for building a writing space on the web.
 
Klinger (talk | contribs)
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:


To create your WriteFreely instance, enable the option {{nixos:option|services.writefreely.enable}}.
To create your WriteFreely instance, enable the option {{nixos:option|services.writefreely.enable}}.
{{Evaluate}}


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 32: Line 30:
   services.writefreely = {
   services.writefreely = {
     enable = true;
     enable = true;
     admin = {
     admin = {
       name = "my-username";
       name = "my-username";
Line 182: Line 181:
}
}
</syntaxHighlight>
</syntaxHighlight>
[[Category:ActivityPub]]
[[Category:Server]]

Latest revision as of 19:28, 16 May 2024

WriteFreely is a blogging platform with support for ActivityPub and is available in NixOS starting with release 22.11.

Setup

To create your WriteFreely instance, enable the option services.writefreely.enable.

{
  services.writefreely = {
    # Create a WriteFreely instance.
    enable = true;

    # Create a WriteFreely admin account.
    admin.name = "my-username";
    
    # The public host name to serve.
    host = "blog.example.com";
  };
}

For more specific configuration, see the following sections.

Admin Account

WriteFreely requires an admin account be created to access the web UI. This can be set using the options under services.writefreely.admin.

{
  services.writefreely = {
    enable = true;

    admin = {
      name = "my-username";
      # If not specified, a default password of "nixos" will be used. Your password can be
      # updated using the web interface.
      initialPasswordFile = "/path/to/password.txt";
    };
  };
}

Database

WriteFreely supports multiple database engines. The NixOS module lets you select which you would like to use and enables easy provisioning of local databases. See the options under services.writefreely.database.

SQLite

The default database is SQLite. This can be configured with the following options.

{
  services.writefreely = {
    enable = true;

    database = {
      # This is the default database type.
      type = "sqlite3";

      # This is the file name of the SQLite database, relative to the
      # stateDir (default: /var/lib/writefreely).
      filename = "writefreely.db";

      # The name of the database to create in SQLite.
      database = "writefreely";
    };
  };
}

MySQL

You can choose to use a MySQL database instead of SQLite.

Note: WriteFreely requires a database password to be configured. See writefreely/writefreely#568 for details.
Local MySQL

To create a local MySQL database, see the following example.

{
  services.writefreely = {
    enable = true;

    database = {
      # Use the MySQL database engine.
      type = "mysql";

      # Run MySQL locally.
      createLocally = true;

      # Set a password for the database so WriteFreely can access it.
      passwordFile = "/path/to/password.txt";
    };
  };
}
Remote MySQL

To use a remote MySQL database, see the following example.

{
  services.writefreely = {
    enable = true;

    database = {
      # Use the MySQL database engine.
      type = "mysql";

      # The name of the database to store data in.
      name = "writefreely";
      # The database user to connect as.
      user = "writefreely";
      # The database host to connect to.
      host = "10.0.0.1";
      # The port to connect to the database on.
      port = 3306;

      # Set a password for the database so WriteFreely can access it.
      passwordFile = "/path/to/password.txt";
    };
  };
}

Nginx

Nginx can be used as a reverse proxy for your WriteFreely instance. This can be configured with the options under services.writefreely.nginx.

{
  services.writefreely = {
    enable = true;

    nginx = {
      # Enable Nginx and configure it to serve WriteFreely.
      enable = true;

      # You can force users to connect with HTTPS.
      forceSSL = true;
    };
  };
}

ACME

Automatic SSL certificates can be retrieved using ACME. When used with Nginx, the certificates will be managed by NixOS's default ACME configuration. When not using Nginx, WriteFreely will manage certificates itself.

{
  services.writefreely = {
    enable = true;

    acme = {
      # Automatically fetch and configure SSL certs.
      enable = true;
    };
  };
}

Settings

Settings for WriteFreely's configuration file config.ini can be set using the option services.writefreely.settings. See the WriteFreely documentation for a list of settings.

{
  services.writefreely = {
    enable = true;

    settings = {
      server = {
        port = 8080;
      };
    };
  };
}