Commit Graph

37 Commits

Author SHA1 Message Date
Shrikant Sharat Kandula
ea16f40f0c
fix: Fix command interpolation error in replicaSet check (#21469)
If the replicaSet check fails, we see the following error:

```
readWrite command not found
```

This is because of using the command interpolation backticks in the
double-quoted string.
2023-03-20 13:18:52 +05:30
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
Shrikant Sharat Kandula
325fcce49f
fix: Check for AVX instruction, and produce a warning (#20463)
When running on CPUs without an AVX instruction, the embedded MongoDB
cannot run. It fails to run with a cryptic error message, and they are
forced to reach out to support for help.

This PR adds a check, and a warning message, if trying to use embedded
MongoDB on a CPU without the AVX instruction.
2023-02-18 06:53:33 +05:30
Shrikant Sharat Kandula
87cffb6a05
fix: Fix replicaset check to not require ClusterMonitor role (#19997)
In the `entrypoint.sh` script, we check if the MongoDB in use, has
replicaSet initiated or not. This is usually done with a `rs.initiate()`
on the cluster.

We need the replicaSet to be enabled on MongoDB, since the backend
server relies on MongoDB `changeStream`s, which is a feature, only
available if replicaSet is enabled.

However, to use the `changeStream` APIs, having the `read` or
`readWrite` role on MongoDB is enough. But the check we do in
`entrypoint.sh`, runs `rs.status()` to see if `replicaSet` is initiated.
This `rs.status()` call, unfortunately, requires the `ClusterMonitor`
role, unlike the `changeStream` API.

To tackle this, we created the `appsmithctl check_replica_set` command.
This command would attempt to use the `changeStream` API, and report
success or failure. But this failed on certain configurations, where
MongoDB was running as a single-node-cluster, on localhost, or a
local/internal network. This was an edge case.

That edge case is solved by this PR. With this, we can use `appsmithctl
check-replica-set` in the `entrypoint.sh` again.
2023-02-07 05:38:37 +05:30
Shrikant Sharat Kandula
f65986c351
fix: Use mongosh instead of mongo in entrypoint (#20055)
Fixes #19969.

The previous PR that fixed this was failing with the way we were
creating the initial user on MongoDB. This PR addresses that.

Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-01-27 16:05:00 +05:30
Shrikant Sharat Kandula
62db0a5c07 Revert "fix: Switched Mongo client to mongosh in Docker entrypoint script to support CPUs without AVX (#19971)"
This reverts commit bf86a693a1.
2023-01-25 05:40:35 +05:30
Jari Maijenburg
bf86a693a1
fix: Switched Mongo client to mongosh in Docker entrypoint script to support CPUs without AVX (#19971)
## Description

The Appsmith Docker image was unable to run on CPUs without AVX
instructions because the entrypoint script was using the legacy `mongo`
client. This PR replaces the `mongo` client with the new `mongosh`
client in the entrypoint, which does not require these instructions. Wit
this fix, the Appsmith Docker image is able to run on CPUs without AVX
instructions.

Fixes #19969

## Type of change
- Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?
- Manual

## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-01-24 07:36:44 +05:30
Sumesh Pradhan
ab5fd20a76
fix: Redis rdb persistance | User session persistance (#19981)
## Description
- Updated redis.conf to set the Redis rdb directory to
`/appsmith-stacks/data/redis` bind-mount directory, so that the data is
persisted after the container restarts/updates. ( This was causing user
sessions on Appsmith installations using the embedded Redis to reset
after every container restart, since the redis data was not being
persisted)
- Updated redis.conf for the embedded Redis to increase the snapshot
frequency to dump after every 15 sec if at least 1 key changed

Fixes #19768

## Type of change
- Bug fix (non-breaking change which fixes an issue)


## How Has This Been Tested?
- Manual
2023-01-23 17:50:37 +05:30
Shrikant Sharat Kandula
3144c0a452
chore: Add role details in replica set error message (#18472) 2022-11-27 13:46:05 +05:30
Sumesh Pradhan
c843f829fd
Set HOSTNAME env for heroku deployment (#17095) 2022-09-29 17:19:24 +05:30
Shrikant Sharat Kandula
6fc2b1680e
Fix key file permissions error on Windows (#16862) 2022-09-19 13:49:27 +05:30
Goutham Pratapa
b1553e946a
fix: docker entrypoint script to check mongo replicaset (#16751)
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2022-09-14 20:30:18 +05:30
Sumesh Pradhan
5a6ab1d094
Fix entrypoint.sh external mongo replica set check (#16151) 2022-09-13 14:14:01 +05:30
Shrikant Sharat Kandula
647b2cd430
If MongoDB key doesn't exist, create it (#15207)
This can happen during a migration from very old slim-container instance to a fat container setup. Besides, for whatever reason, if the key file is missing, then the instance fails to come up. This fix will ensure that we can recover from that state automatically.
2022-07-20 20:42:23 +05:30
Shrikant Sharat Kandula
73e43fadbd
Support for custom CA certificates (#14207)
Signed-off-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2022-06-01 11:14:27 +05:30
Sumesh Pradhan
9f2c5dc5f7
Renamed temporary encryption variables in docker entry-point script (#12187) 2022-04-15 17:44:08 +05:30
Trisha Anand
c37fdb9f1c
fix: Only setting maximum heap size for heroku deployed instances (#12725)
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
2022-04-08 18:48:23 +05:30
geekup-legodevops
2843da9bfd
Refactor initialize env files flow in entrypoint of container (#12585)
Co-authored-by: phat.ct <phat.ct@geekup.vn>
2022-04-05 20:22:52 +05:30
geekup-legodevops
c210857791
Redis running on 64k pagesize (#12264) 2022-04-01 12:28:03 +05:30
geekup-legodevops
382ea53ab3
Refactor to deploy Heroku using new Docker image (#9127) 2022-03-24 13:17:36 +05:30
Shrikant Sharat Kandula
b2e9498f2d
Check Redis URL for localhost as well (#12173) 2022-03-23 17:07:14 +05:30
Shrikant Sharat Kandula
b7884f1feb
Fix replicaset checking with limited permissions (#11969) 2022-03-21 13:47:29 +05:30
Shrikant Sharat Kandula
e732190151
fix: Fix special char handling in pre-define env (#11799) 2022-03-11 21:21:17 +05:30
Khoa Huỳnh
e59c69f915
Fix MongoDB permission issue in checking replica set (#11613) 2022-03-10 10:16:16 +05:30
geekup-legodevops
db7a046116
Refactor entrypoint script to support migrate slim to fat container (#11519) 2022-03-03 08:40:29 +05:30
geekup-legodevops
2d8e7fee0d
Enable replicaset on local MongoDB only (#10010) 2022-02-09 14:32:46 +05:30
geekup-legodevops
e85b34d66e
Add Helm configMap to update application configuration (#10157) 2022-01-31 13:27:01 +05:30
Shrikant Sharat Kandula
42dd099b11
Set MongoDB Key permissions everytime (#10080) 2022-01-10 17:19:29 +05:30
geekup-legodevops
885f9675c2
Add confirmation step in importing DB command (#9265) 2021-11-26 15:40:16 +05:30
Shrikant Sharat Kandula
768885822b
Fix deleting files when they don't exist 2021-11-23 12:13:10 +05:30
geekup-legodevops
5e1a496349
Config for editor program run script instead of nginx (#8922)
Add script to re-generate nginx config file & start nginx

Move function init_ssl_cert into separated file and reuse it in new script and entrypoint

Change command config & add new config to kill all sub-process of a supervisord child program in editor program configure file
2021-11-23 09:39:13 +05:30
geekup-legodevops
d3a491f0b3
Add flow to use custom certificate if provided (#9106)
- Add sub-directory for user to put custom certificate to use inside container
- Add flow to check existing custom certificate & process to use it
- Add section Custom Certificate in README.md
2021-11-16 16:32:28 +05:30
Shrikant Sharat Kandula
eadaa65251
Fix sessions being cleared after fat container is restarted (#9112) 2021-11-15 11:24:45 +05:30
geekup-legodevops
6cbe4b8faf
Config supervisord to write logs into log files (#8145) 2021-10-19 12:59:55 +05:30
Shrikant Sharat Kandula
5a0d04bce6
Apply env variable renaming automatically (#8217) 2021-10-05 20:49:22 +05:30
geekup-legodevops
f37f9451ef
feat: Support building Docker image for ARM arch (#7832) 2021-09-29 14:33:27 +05:30
Shrikant Sharat Kandula
f0a61285a6
docs: Fat container documentation fixes (#7207)
Added additional details about how to use the fat container, and how to manage / maintain it.

Also includes some refactorings that shouldn't affect the functionality significantly.
2021-09-14 19:01:06 +05:30