PromucFlow_constructor/deploy/docker/templates
Sumesh Pradhan c3c6218c0f
feat: Embeded PostgreSQL with mockdb data for self-hosted (#21084)
## 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>
2023-03-07 15:22:41 +05:30
..
cron.d docs: Fat container documentation fixes (#7207) 2021-09-14 19:01:06 +05:30
nginx fix: Fix container-internal communication when using IPv6 (#20981) 2023-02-27 19:51:54 +05:30
supervisord feat: Embeded PostgreSQL with mockdb data for self-hosted (#21084) 2023-03-07 15:22:41 +05:30
docker.env.sh Fix sandbox iframe default setting (#17618) 2022-10-17 16:12:56 +05:30
mockdb_postgres.sql feat: Embeded PostgreSQL with mockdb data for self-hosted (#21084) 2023-03-07 15:22:41 +05:30
supervisord.conf Config supervisord to write logs into log files (#8145) 2021-10-19 12:59:55 +05:30
users_postgres.sql feat: Embeded PostgreSQL with mockdb data for self-hosted (#21084) 2023-03-07 15:22:41 +05:30