[Self Hosted] Document Storage

Since I have started using InvoiceNinja in the last couple of months, I have learned quite a lot. I do find the documentation a bit lacking in quite a lot of areas. Some features don’t have a clear explication or none at all. I have been able to fill in the missing information using the topics I have found on the forums. However, this one topic I have not been able to find any information for. Every a quick Google search has failed me, unless I am using the wrong search terms.

In the .env.example file, I have noticed a DOCUMENT_FILESYSTEM= but can’t find documentation for it. That is only one entry that I can’t find documentation on. I see entry’s for S3 & RackSpace. I am guessing this has todo with being able to store documents remotely with S3 or RackSpace. Is there documentation that I am missing related to this?

If I am correct, is this cloud document storage feature limited to the entry’s seen in .env.example?

There isn’t any documentation for this. You can also use Google Cloud.

https://github.com/invoiceninja/invoiceninja/blob/master/config/filesystems.php

The link was helpful for defining the options that are available for the .env variable entry of DOCUMENT_FILESYSTEM (local,s3,rackspace,gcs).

Based on your reply, I am understand that Google Cloud Storage is an option. From the statement in the linked file, here is what I see for the gcs option.

'gcs' => [
			'driver'      => 'gcs',
			'bucket'      => env('GCS_BUCKET', 'cloud-storage-bucket'),
			//'service_account'                      => env('GCS_USERNAME', ''),
			//'service_account_certificate'          => storage_path() . '/credentials.p12',
			//'service_account_certificate_password' => env('GCS_PASSWORD', ''),
			'project_id'  => env('GCS_PROJECT_ID'),
			'credentials' => storage_path() . '/gcs-credentials.json',
        ]

Based on the data, I can tell that I need to define these variables in the .env file:
GCS_BUCKET=(this would be the bucket name that I define in the google console)
GCS_PROJECT_ID=(this would be the project id that the bucket was created under)

I noticed that this file also statements that are commented out. Are any of these needed?
Are my assumptions correct based on the data found in the linked file?
How would I be able to test and see what, if any, errors may occur?

That’s a good question, sorry I’m not sure. I think you’ll need to test to see what works.

To test you would just upload/delete documents and see if the storage provider is updated.

Just as you said, I would have to do some testing to see what works. With the error message out saved to storage/logs/laravel-error.log, I was able to see what specific information was needed. Here are my findings.

To enable Google Cloud Storage Services, you have to make the changes in the .env file. If these variables are not already present, you will need to add them. Positioning in the file does not matter.

DOCUMENT_FILESYSTEM=gcs
GCS_BUCKET=<google-cloud-storage-bucket-name> This is defined when you create the storage bucket in Google Cloud Console
GCS_PROJECT_ID=<google-cloud-project-id> This is can be found on the dashboard of the project that the storage service is being enabled for

Along with these edits, a file will need to be uploaded to the server. This file is a json file and holds the connection and authentication information for the Storage service. Once uploaded, it needs to be saved as storage/gcs-credentials.json. The JSON file is created in Google Cloud Console by creating a Service Account Key under API & Services > Credentials.

Once these changes are made, you will be able to attache documents to records and the files are uploaded to Googles Cloud Storage Service.

In order to test the connection, you will have to attach and save a file. To test for successful delation, you can remove the attached file. If there are any errors, the output will be saved in storage/logs/laravel-error.log

Glad to hear it’s working, thanks for sharing these details!