## Description This PR includes changes for self-hosted instances to utilize an embedded postgres database for the Template's mockdb. After this change, by default Appsmith will always run the embedded Postgres, and connect to it instead of the mockdb cloud instance. **Solves:** Issue[#20107](https://github.com/appsmithorg/appsmith/issues/20107) **Changes:** - [x] Install Postgresql in the Docker container using Dockerfile :- _Updated Docker file to install PostgreSQL v13_ - [x] Add provision to stop/disable Postgresql from booting based on an environment variable :- _To disable embedded postgres, set the **ENV** var `APPSMITH_ENABLE_EMBEDDED_DB` to `0`; Configured supervisord to control the lifecycle of the postgres server ( Supervisor uses user postgres to start the server since root is not allowed)_ - [x] Seed data into the Postgresql DB during first container startup. This ensures that we don't have to ship the Docker container with data & bloat it unnecessarily. :- _Curretly, the SQL dump is baked into the image._ - [x] Persist the Postgresql data in /appsmith-stacks. This ensures that the data is persisted across version upgrades. :- _The postgres uses the file system at` /stacks/data/postgres/main` ; note: The file system owner is user/group postgres_ - [x] Update the mock db endpoint in the product to use the local DB by default instead of the hosted DB for self-hosted instances. The cloud instance should still use the hosted DB :- _The embedded postgres authentication is set to the type `trust`, allowing the existing template mockdb meta data to be used without any update to the existing templates mockdb endpoint and credentials_ **Note: There is an additional table `mydb` added to the mockdb for quickly verifying the db source is the embedded postgres, since the cloud mockdb does not have that table.** --------- Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
16 lines
485 B
Plaintext
16 lines
485 B
Plaintext
[program:postgres]
|
|
directory=/appsmith-stacks/data/postgres/main
|
|
user=postgres
|
|
command=/usr/lib/postgresql/13/bin/postgres -D "/appsmith-stacks/data/postgres/main" -c listen_addresses=127.0.0.1
|
|
autostart=true
|
|
autorestart=true
|
|
stdout_logfile=/appsmith-stacks/logs/%(program_name)s/%(program_name)s.log
|
|
redirect_stderr=true
|
|
stdout_logfile_maxbytes=10MB
|
|
stderr_logfile_maxbytes=10MB
|
|
stdout_logfile_backups=5
|
|
stderr_logfile_backups=5
|
|
stdout_events_enabled=true
|
|
stderr_events_enabled=true
|
|
|