Invoiceplane: Difference between revisions

imported>Onny
mNo edit summary
Onny (talk | contribs)
Add dev env example
 
(4 intermediate revisions by 3 users not shown)
Line 10: Line 10:


After that Invoiceplane will be available at http://localhost . Complete the setup by choosing your default language and setting up your user profile.
After that Invoiceplane will be available at http://localhost . Complete the setup by choosing your default language and setting up your user profile.
It is recommended to disable the setup wizard after installation is complete. Add following arguments to the settings option:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
services.invoiceplane.sites."localhost".settings = {
  DISABLE_SETUP=true;
  SETUP_COMPLETED=true;
};
</nowiki>}}


== Configuration ==
== Configuration ==
Line 25: Line 34:
     src = pkgs.fetchgit {
     src = pkgs.fetchgit {
       url = "https://git.project-insanity.org/onny/invoiceplane-vtdirektmarketing.git";
       url = "https://git.project-insanity.org/onny/invoiceplane-vtdirektmarketing.git";
       rev = "0c5807132ea6cecdb9d031d9b61e478d371f7607";
       rev = "0a891d836e199cf0f6bd2c4276991665d5d3405e";
       hash = "sha256-sVunmCWRYcZwADQLhQHiuU4faMB05hEqwH1/os1Rxqo=";
       hash = "sha256-GhKd+dviufeGi3ZnyukzvwzVE5BO7jAx1SdsG/ioSeU=";
     };
     };
     makeFlags = [ "DESTDIR=$(out)" ];
     makeFlags = [ "DESTDIR=$(out)" ];
Line 84: Line 93:
=== Upgrading to new versions ===
=== Upgrading to new versions ===


After upgrading to a new version of Invoiceplane, change following two lines of your Invoiceplane config. The path to the file
After upgrading to a new version of Invoiceplane, change following two lines of your Invoiceplane config to re-enable the setup wizard, required for database upgrades.
<code>ipconfig.php</code> depends on the hostname you configured.
 
{{file|/var/lib/invoiceplane/localhost/ipconfig.php|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
DISABLE_SETUP=false
services.invoiceplane.sites."localhost".settings = {
SETUP_COMPLETED=false
  DISABLE_SETUP=false;
  SETUP_COMPLETED=false;
};
</nowiki>}}
</nowiki>}}


Access your Invoiceplane instance again in your browser and rerun the setup wizard which now reappears. After upgrading the tables you can login as usual. It is now recommended to change both variables in the config file above back to <code>true</code>.
Access your Invoiceplane instance again in your browser and rerun the setup. After upgrading the tables you can login as usual. It is now recommended to change both variables in the config file above back to <code>true</code>.
 
== Tips and tricks ==
 
=== Invoice template development ===
Following <code>flake.nix</code> file helps you spawning a virtual machine running a development environment of Invoiceplane. The local directory <code>/home/user/my_invoiceplane_template</code> containing a modified invoice or quote template will be mounted into the Invoiceplane web app, allowing to change the template and directly render the invoice PDF in the local web server at http://localhost:8080<syntaxhighlight lang="nix">
{
  description = "Invoiceplane invoice template development shell";
 
  inputs.nixpkgs.url = "nixpkgs/nixos-24.11";
 
  outputs = { self, nixpkgs, ... }@inputs:
  let
    pkgs = nixpkgs.legacyPackages.x86_64-linux;
    start =
      pkgs.writeShellScriptBin "start" ''
        set -e
        export QEMU_NET_OPTS="hostfwd=tcp::8080-:80"
        ${pkgs.nixos-shell}/bin/nixos-shell --flake .
      '';
  in {
    nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs.inputs = inputs;
      pkgs = import nixpkgs {
overlays = [
          (self: super: {
            invoiceplane = super.invoiceplane.overrideAttrs (oldAttrs: rec {
              installPhase = oldAttrs.installPhase + ''
                rm -r $out/application/views/invoice_templates/pdf
                ln -sf /var/lib/invoiceplane/localhost/pdf $out/application/views/invoice_templates/pdf
              '';
            });
          })
        ];
      };
      modules = [
        ({ lib, config, pkgs, ... }: {
 
  services.invoiceplane.sites."localhost" = {
    enable = true;
    settings.IP_URL = "http://localhost:8080";
  };
 
          nixos-shell.mounts.extraMounts = {
            "/var/lib/invoiceplane/localhost/pdf" = {
              target = /home/user/my_invoiceplane_template;
              cache = "none";
            };
          };
 
          system.stateVersion = "24.11";
          services.getty.autologinUser = "root";
        })
      ];
    };
 
    packages = { inherit start; };
    defaultPackage.x86_64-linux = start;
 
  };
}
</syntaxhighlight>To run the web server simply execute following command in the same directory as the <code>flake.nix</code> file<syntaxhighlight lang="shell">
nix run
</syntaxhighlight>


== See also ==
== See also ==
* [[Crater]], alternative self-hosted invoicing application
* [[Crater]], alternative self-hosted invoicing application


[[Category:Server]]
[[Category:Web Applications]]
[[Category:Web Applications]]