Commit Graph

24 Commits

Author SHA1 Message Date
dependabot[bot]
e9b131d650
chore(deps-dev): bump @babel/traverse from 7.19.4 to 7.23.2 in /deploy/docker/fs/opt/appsmith/utils (#28168)
Bumps
[@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse)
from 7.19.4 to 7.23.2.


Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 16:32:16 +05:30
Shrikant Sharat Kandula
b6b64f2f1f
chore: Remove RTS Health check in Docker container 2023-10-21 09:58:40 +05:30
Shrikant Sharat Kandula
1719d73ab6
fix: Fail startup when supervisor creds are missing 2023-10-18 07:58:56 +05:30
Shrikant Sharat Kandula
b414d0746b fix: Remove explicit stats directory for embedded Postgres 2023-10-17 15:00:12 +05:30
Shrikant Sharat Kandula
afd03a526d
chore: Update embedded MongoDB Schema version (#27985) 2023-10-17 06:28:45 +05:30
Shrikant Sharat Kandula
8ea3884632
chore: Support auto-SSL when running behind a forward proxy 2023-10-07 14:21:00 +05:30
Shrikant Sharat Kandula
53bcdafe91
fix: Get Java from GitHub release artifacts directly (#27862)
What are we solving here?

1. Installing Java in the `Dockerfile` by using Adoptium's package
repositories is fragile since they've started blocking some IP addresses
used by GitHub Actions runners. We see a message like this:
   ```
Failed to fetch
https://packages.adoptium.net/artifactory/deb/pool/main/t/temurin-17/temurin-17-jdk_17.0.8.1.0+1_amd64.deb
403 Forbidden [IP: 146.75.107.42 443]
   ```
We're seeing more and more cases of these and PRs are getting blocked.

2. Installing Java via `apt` also installs other packages like X11
libraries, that aren't really relevant to our usage of Java. Yet, these
packages are present in our Docker image, and are the source of several
CVEs to be reported by scanners on our Docker image.

3. This will give us control over trusted CA certificates, which we can
now perform under `$TMP`, which aligns with our move towards supporting
readonly root filesystem. Which is essentially not write to anything in
the Docker image at runtime, except for under `/tmp` and
`/appsmith-stacks`. This will help us move in that direction.
2023-10-06 19:38:19 +05:30
Digvijay Singh
ed3982e534
chore: replaced decommisioned urls with new ones (#27786)
Description:
I've Replaced the old URLs with the new URLs assigned to me provided in
the Spreadsheet.

PR fixes the following issue(s):
Fixes #25513
2023-10-05 12:07:18 +05:30
Shrikant Sharat Kandula
63322193d2
chore: Remove build-essential by default in the Docker image (#27813)
This removes ~70 medium/low severity CVEs reported on our Docker image,
by removing `build-essential` from being installed by default in the
Docker image.

We only need it when compiling Redis, which is needed on _some_ ARM
systems, that re configured with a page-size of greater than 4096. For
example, CentOS 8.
2023-10-05 10:26:39 +05:30
Shrikant Sharat Kandula
e6ca21c34a
fix: Route for HTTP-01 challenge, instead of redirecting (#27788)
In the NGINX configuration we generate, we're redirecting _all_ HTTP
requests to HTTPS, when HTTPS is enabled. But the HTTP-01 challenge
works on port 80 and is getting redirected to 443.

This usually fine, as Let's Encrypt respects that redirect and completes
the challenge on port 443. But, if port 443 is blocked to outside
access, the cert renewal will fail. This PR fixes that.

Tested on a server with port 80 open and 443 closed to outside Internet.
Cert renewal fails without this PR's changes, and works with this PR's
changes.
2023-10-04 15:37:32 +05:30
Shrikant Sharat Kandula
cc2ced886a
fix: Fix backup command getting version (#27780)
This broke when we changed the way RTS stores version information. This
was never the right way to get the version in the `backup` command and
this PR fixes it, by getting the version from `info.json`.

Failure error:

```
Error: ENOENT: no such file or directory, open '/opt/appsmith/rts/version.js'
```
2023-10-04 15:28:26 +05:30
Shrikant Sharat Kandula
164d2e6b65
ci: Use esbuild to build RTS (#27310)
This fixes RTS build to use `esbuild`.

1. This means the whole `node_modules` won't need to be copied over to
the Docker image. There's unused insignifant _test_ files in there, that
don't add any value, but are causing irrelevant CVEs to be reported on
our Docker image. See example at
https://github.com/appsmithorg/appsmith-ee/pull/2349.

2. Much faster. Not that RTS build is our slow point, but still. Perhaps
we can move client to `esbuild` too. 🙂

## Why are we doing this?

The current method of loading RTS into the Docker image means that _all_
contents of _all_ dependencies are copied over. The whole
`node_modules`. But several of these packages include _test_ files too,
that aren't needed at runtime at all. One of such test files is creating
a false alert for a CVE on our Docker image. Has absolutely no relevance
and impact, but it's there.

To fix that, I [had to `rm -rf /opt/appsmith/rts/node_modules/*/test` in
the Docker
image](https://github.com/appsmithorg/appsmith-ee/pull/2349/files). This
felt very hacky, and very dirty. It felt like we're introducing more
debt and more duct tape around the current build process.

So, `esbuild`.

## Where is `esbuild` coming from?

We're using `esbuild` v0.18.20 only, while the latest is v0.19.3. We
need to update `design-system`'s storybook dependency, I think, to get a
more recent version of `esbuild`. I'm yet to figure this out and can use
some help. 🙂
2023-10-03 07:00:40 +05:30
Shrikant Sharat Kandula
2f5405d86d
chore: Run NGINX with readonly root FS support (#27453)
Part of supporting readonly root filesystem, gets NGINX to start without
doing any writes to the filesystem, except for in `/tmp`.
2023-09-27 13:38:47 +05:30
Sumesh Pradhan
9964be125a
fix: Use temporary directory for embedded postgres stats data (#27455)
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2023-09-27 11:35:43 +05:30
Sumesh Pradhan
8e0d3544c9
feat: password updation for supervisor basic auth native (#27267) 2023-09-20 15:52:35 +05:30
Shrikant Sharat Kandula
1774557714
fix: Fix backend failing to start when running with a custom PORT (#27461)
When running with a custom `PORT` env variable, NGINX server will be
listening on this port. In the backend's startup script, `run-java.sh`,
we're checking for RTS being up or not, at `localhost`. So when the port
is not 80, then this will never succeed, because it'll be looking for
NGINX at the wrong port.

Instead, the fix here will make the backend startup script hit RTS
_directly_ on RTS server's own port, instead of going via NGINX. This
means it's independent of both the `PORT` env variable and the NGINX
server, and only dependent on RTS being up, which is really what we want
here.
2023-09-20 10:27:54 +05:30
Shrikant Sharat Kandula
b76e78e006
fix: Postgres permission error in creating the stats folder (#27454)
When PostgreSQL starts, we see the following errors in the logs:

```
mkdir: 
cannot create directory ‘/tmp/appsmith/postgres-stats’
: Permission denied
```

And then this over and over again:

```
postgres stdout | 2023-09-19 15:34:34.504 UTC [1759] LOG:  could not open temporary statistics file "/tmp/appsmith/postgres-stats/global.tmp": No such file or directory
```

The problem is that in `postgres.conf`, we set `user=postgres`, which
doesn't have access to create things in `/tmp`.

This PR removes this configuration and lets the default be, which will
be a temp folders _under_ the data directory.
2023-09-19 21:21:34 +05:30
Sumesh Pradhan
fd5d3a47b5
fix: clear postgres core dumps (#27152)
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2023-09-19 17:34:42 +05:30
Shrikant Sharat Kandula
0e4cd23c0e
fix: Fix escaping for _multiple_ single quotes in env variables (#27368)
[Slack
Conversation](https://theappsmith.slack.com/archives/C0341RERY4R/p1694794275962369).
2023-09-19 09:33:14 +05:30
Shrikant Sharat Kandula
9d68025fd9
feat: Add /info endpoint for details about the Appsmith version running (#27345)
This just responds with the contents of `/opt/appsmith/info.json` as is,
with a JSON content type.

This will enable showing the right date on the frontend, as well as on
Flow. See [this Slack
thread](https://theappsmith.slack.com/archives/C02MUD8DNUR/p1694762058953999?thread_ts=1694757060.520329&cid=C02MUD8DNUR)
for the confusion we're solving for.
2023-09-15 15:50:52 +05:30
Shrikant Sharat Kandula
ab5cc22a6d
chore: Readonly root FS for supervisord configuration (#27171)
This is part of supporting running Appsmith with readonly root FS. This
moves the supervisord configuration, and runtime files, like the unix
socket file, and the PID file, to `$TMP`.
2023-09-14 14:43:06 +05:30
Shrikant Sharat Kandula
1d15570298
chore: Move cleanup logs from cron to backend server (#27156)
This is moving the cleanup script to delete old log files, from being a
cron job, to being a scheduled task in the backend server. Why?

1. We want to support running Appsmith with readonly root, which is a
request from security teams at enterprise companies.
2. Cron doesn't play nice. It wants to save a `.pid` file under
`/var/run`, so it fails to start when running with readonly root. This
is not configurable.
3. Since our use of cron is minimal only, we're moving away from it,
especially since the backend server is already capable of running
scheduled tasks.
4. This moves one job, there's still another. Based on experience from
this, we'll work on the other.

Another advantage to doing this is that since this job is now running in
the backend server, which has access to MongoDB and Redis, we can
coordinate when running as a cluster, that only _one_ backend is running
the clean up job. This is for much later though.

---------

Co-authored-by: Nidhi <nidhi@appsmith.com>
2023-09-11 18:18:16 +05:30
Shrikant Sharat Kandula
55dea43b2d
chore: Place local MongoDB cluster key in /tmp instead of / (#26963)
This is another step towards supporting running with readonly root FS,
and only making runtime changes in the container in `/tmp` or in
`/appsmith-stacks`, and nowhere else.
2023-09-11 12:54:50 +05:30
Shrikant Sharat Kandula
c594699eac
chore: Use single COPY command in Dockerfile for constant/static files (#27127)
Move the files that are copied into the Docker image, into an `fs`
folder, that reflects the folder structure of that in the image. This
means two things right away:

1. A single `COPY` instruction in `Dockerfile` is enough to copy all the
files to their places.
2. The structure of files in the repo reflects that in the Docker image.
This makes working with the files/folders and troubleshooting with them
much easier.

 Note: **There's actually only 3 files changed, rest are just moved.**
2023-09-11 08:43:09 +05:30