PromucFlow_constructor/deploy
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
..
ansible fix: issue with ansible deployment (#19974) 2023-01-25 10:45:04 +05:30
aws Encoding the mongo credentials in install.sh script (#310) 2020-08-17 11:10:01 +05:30
aws_ami fix: Change watchtower to latest (#20001) 2023-02-02 06:27:35 +05:30
digital_ocean Packer script to build AWS and DigitalOcean images (#16617) 2022-09-14 11:03:02 +05:30
docker feat: Embeded PostgreSQL with mockdb data for self-hosted (#21084) 2023-03-07 15:22:41 +05:30
helm fix: update chart.lock and app versions (#20105) 2023-02-01 17:12:00 +05:30
heroku Refactor to deploy Heroku using new Docker image (#9127) 2022-03-24 13:17:36 +05:30
packer Packer script to build AWS and DigitalOcean images (#16617) 2022-09-14 11:03:02 +05:30
template fix: Increased Nginx limit to 150 MB to allow 100 MB Base 64 encoded files (#20617) 2023-02-20 20:34:02 +05:30
install.sh Fix variables in docker.env.sh 2021-08-11 19:15:43 +05:30