2021-09-29 09:03:27 +00:00
|
|
|
FROM ubuntu:20.04
|
2021-09-01 05:32:08 +00:00
|
|
|
|
|
|
|
|
LABEL maintainer="tech@appsmith.com"
|
|
|
|
|
|
|
|
|
|
# Set workdir to /opt/appsmith
|
|
|
|
|
WORKDIR /opt/appsmith
|
|
|
|
|
|
2021-09-28 05:04:33 +00:00
|
|
|
# The env variables are needed for Appsmith server to correctly handle non-roman scripts like Arabic.
|
2022-04-01 06:58:03 +00:00
|
|
|
ENV LANG C.UTF-8
|
|
|
|
|
ENV LC_ALL C.UTF-8
|
2021-09-28 05:04:33 +00:00
|
|
|
|
2021-09-29 09:03:27 +00:00
|
|
|
# Update APT packages - Base Layer
|
2022-03-31 11:05:11 +00:00
|
|
|
RUN apt-get update \
|
|
|
|
|
&& apt-get upgrade --yes \
|
2022-12-19 09:30:24 +00:00
|
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes \
|
2023-01-02 12:40:59 +00:00
|
|
|
supervisor curl cron certbot nginx gnupg wget netcat openssh-client \
|
|
|
|
|
software-properties-common gettext \
|
2022-06-01 05:44:27 +00:00
|
|
|
python3-pip python-setuptools git ca-certificates-java \
|
2023-01-02 12:40:59 +00:00
|
|
|
&& wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add - \
|
|
|
|
|
&& echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
|
|
|
|
|
&& apt-get update && apt-get install --no-install-recommends --yes temurin-17-jdk \
|
2021-10-19 07:29:55 +00:00
|
|
|
&& pip install --no-cache-dir git+https://github.com/coderanger/supervisor-stdout@973ba19967cdaf46d9c1634d1675fc65b9574f6e \
|
2022-12-19 09:30:24 +00:00
|
|
|
&& apt-get remove --yes git python3-pip
|
|
|
|
|
|
2023-03-07 09:52:41 +00:00
|
|
|
# Install MongoDB v5.0.14, Redis, NodeJS - Service Layer, PostgreSQL v13
|
2022-12-19 09:30:24 +00:00
|
|
|
RUN curl --silent --show-error --location https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add - \
|
|
|
|
|
&& echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list \
|
2023-03-14 11:34:52 +00:00
|
|
|
&& curl --silent --show-error --location https://deb.nodesource.com/setup_16.x | bash - \
|
2023-03-07 09:52:41 +00:00
|
|
|
&& echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \
|
|
|
|
|
&& curl --silent --show-error --location https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
|
|
|
|
|
&& apt update \
|
|
|
|
|
&& apt-get install --no-install-recommends --yes mongodb-org=5.0.14 nodejs redis build-essential postgresql-13 \
|
2021-09-29 09:03:27 +00:00
|
|
|
&& apt-get clean \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2021-09-01 05:32:08 +00:00
|
|
|
|
|
|
|
|
# Clean up cache file - Service layer
|
|
|
|
|
RUN rm -rf \
|
2021-09-29 09:03:27 +00:00
|
|
|
/root/.cache \
|
|
|
|
|
/root/.npm \
|
|
|
|
|
/root/.pip \
|
|
|
|
|
/usr/local/share/doc \
|
|
|
|
|
/usr/share/doc \
|
|
|
|
|
/usr/share/man \
|
|
|
|
|
/var/lib/apt/lists/* \
|
|
|
|
|
/tmp/*
|
2021-09-01 05:32:08 +00:00
|
|
|
|
|
|
|
|
# Define volumes - Service Layer
|
|
|
|
|
VOLUME [ "/appsmith-stacks" ]
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------
|
|
|
|
|
# Add backend server - Application Layer
|
2021-09-23 14:28:53 +00:00
|
|
|
ARG JAR_FILE=./app/server/dist/server-*.jar
|
|
|
|
|
ARG PLUGIN_JARS=./app/server/dist/plugins/*.jar
|
2021-09-01 05:32:08 +00:00
|
|
|
ARG APPSMITH_SEGMENT_CE_KEY
|
|
|
|
|
ENV APPSMITH_SEGMENT_CE_KEY=${APPSMITH_SEGMENT_CE_KEY}
|
|
|
|
|
#Create the plugins directory
|
|
|
|
|
RUN mkdir -p ./backend ./editor ./rts ./backend/plugins ./templates ./utils
|
|
|
|
|
|
|
|
|
|
#Add the jar to the container
|
|
|
|
|
COPY ${JAR_FILE} backend/server.jar
|
|
|
|
|
COPY ${PLUGIN_JARS} backend/plugins/
|
|
|
|
|
|
|
|
|
|
# Add client UI - Application Layer
|
|
|
|
|
COPY ./app/client/build editor/
|
|
|
|
|
|
|
|
|
|
# Add RTS - Application Layer
|
2022-08-17 13:40:10 +00:00
|
|
|
COPY ./app/rts/package.json ./app/rts/dist rts/
|
2021-09-01 05:32:08 +00:00
|
|
|
|
2023-03-07 09:52:41 +00:00
|
|
|
# Nginx, MongoDB and PostgreSQL data config template - Configuration layer
|
2022-01-31 07:57:01 +00:00
|
|
|
COPY ./deploy/docker/templates/nginx/* \
|
|
|
|
|
./deploy/docker/templates/docker.env.sh \
|
2023-03-07 09:52:41 +00:00
|
|
|
./deploy/docker/templates/mockdb_postgres.sql \
|
|
|
|
|
./deploy/docker/templates/users_postgres.sql \
|
2023-04-19 12:50:59 +00:00
|
|
|
./deploy/docker/templates/appsmith_starting.html \
|
|
|
|
|
./deploy/docker/templates/appsmith_initializing.html \
|
2022-01-31 07:57:01 +00:00
|
|
|
templates/
|
2021-09-01 05:32:08 +00:00
|
|
|
|
|
|
|
|
# Add bootstrapfile
|
2023-01-02 09:55:23 +00:00
|
|
|
COPY ./deploy/docker/entrypoint.sh ./deploy/docker/scripts/* ./
|
2021-09-01 05:32:08 +00:00
|
|
|
|
chore: Add dependency to start backend only if rts is ready (#19218)
Fixes: [19207](https://github.com/appsmithorg/appsmith/issues/19207)
**By default on start-up**
```
root@ab348246fff8:/appsmith-stacks/logs# head backend/backend-ab348246fff8.log
Waiting for RTS to start ...
RTS started.
Starting Backend server...
Load environment configuration
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/appsmith/backend/server.jar!/BOOT-INF/lib/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/appsmith/backend/server.jar!/BOOT-INF/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
[2022-12-26 11:39:34,962] - Starting ServerApplication vv1.8.14.1 using Java 11.0.17 on ab348246fff8 with PID 1543 (/opt/appsmith/backend/server.jar started by root in /opt/appsmith/backend)
```
**Upon stopping RTS manually**
```
root@ab348246fff8:/appsmith-stacks/logs# supervisorctl stop rts
rts: stopped
root@ab348246fff8:/appsmith-stacks/logs# supervisorctl status
backend RUNNING pid 1497, uptime 0:01:21
cron RUNNING pid 1505, uptime 0:01:21
editor RUNNING pid 1502, uptime 0:01:21
mongodb RUNNING pid 1491, uptime 0:01:21
redis RUNNING pid 1490, uptime 0:01:21
rts STOPPED Dec 26 11:40 AM
stdout RUNNING pid 1489, uptime 0:01:21
```
**Restart Backend service to check if backend service starts**
```
root@ab348246fff8:/appsmith-stacks/logs# supervisorctl restart backend
backend: stopped
backend: started
root@ab348246fff8:/appsmith-stacks/logs# supervisorctl status
backend RUNNING pid 1802, uptime 0:00:12
cron RUNNING pid 1505, uptime 0:01:43
editor RUNNING pid 1502, uptime 0:01:43
mongodb RUNNING pid 1491, uptime 0:01:43
redis RUNNING pid 1490, uptime 0:01:43
rts STOPPED Dec 26 11:40 AM
stdout RUNNING pid 1489, uptime 0:01:43
root@ab348246fff8:/appsmith-stacks/logs# supervisorctl ^C
root@ab348246fff8:/appsmith-stacks/logs# tail -f backend/backend-ab348246fff8.log
Waiting for RTS to start ...
Waiting for RTS to start ...
Waiting for RTS to start ...
Waiting for RTS to start ...
Waiting for RTS to start ...
Waiting for RTS to start ...
Waiting for RTS to start ...
Waiting for RTS to start ...
Waiting for RTS to start ...
Waiting for RTS to start ...
^C
```
**Upon starting RTS the behaviour of backend immediately**
```
root@ab348246fff8:/appsmith-stacks/logs# supervisorctl start rts
rts: started
root@ab348246fff8:/appsmith-stacks/logs# tail -f backend/backend-ab348246fff8.log
Starting Backend server...
Load environment configuration
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/appsmith/backend/server.jar!/BOOT-INF/lib/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/appsmith/backend/server.jar!/BOOT-INF/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
[2022-12-26 11:41:33,796] - Starting ServerApplication vv1.8.14.1 using Java 11.0.17 on ab348246fff8 with PID 1968 (/opt/appsmith/backend/server.jar started by root in /opt/appsmith/backend)
[2022-12-26 11:41:33,799] - Running with Spring Boot v2.6.5, Spring v5.3.17
[2022-12-26 11:41:33,803] - No active profile set, falling back to 1 default profile: "default"
[2022-12-26 11:41:34,615] - Multiple Spring Data modules found, entering strict repository configuration mode!
[2022-12-26 11:41:34,616] - Bootstrapping Spring Data Reactive MongoDB repositories in DEFAULT mode.
[2022-12-26 11:41:34,859] - Finished Spring Data repository scanning in 239 ms. Found 55 Reactive MongoDB repository interfaces.
[2022-12-26 11:41:35,220] - Multiple Spring Data modules found, entering strict repository configuration mode!
[2022-12-26 11:41:35,221] - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
```
2022-12-29 08:52:41 +00:00
|
|
|
# Add util tools
|
2021-09-14 13:31:06 +00:00
|
|
|
COPY ./deploy/docker/utils ./utils
|
2021-09-01 05:32:08 +00:00
|
|
|
RUN cd ./utils && npm install && npm install -g .
|
|
|
|
|
|
|
|
|
|
# Add process config to be run by supervisord
|
2021-09-14 13:31:06 +00:00
|
|
|
COPY ./deploy/docker/templates/supervisord.conf /etc/supervisor/supervisord.conf
|
|
|
|
|
COPY ./deploy/docker/templates/supervisord/ templates/supervisord/
|
2021-09-01 05:32:08 +00:00
|
|
|
|
|
|
|
|
# Add defined cron job
|
2021-09-14 13:31:06 +00:00
|
|
|
COPY ./deploy/docker/templates/cron.d /etc/cron.d/
|
2021-09-01 05:32:08 +00:00
|
|
|
RUN chmod 0644 /etc/cron.d/*
|
|
|
|
|
|
2023-01-02 09:55:23 +00:00
|
|
|
RUN chmod +x entrypoint.sh renew-certificate.sh healthcheck.sh
|
2021-09-01 05:32:08 +00:00
|
|
|
|
2022-04-27 07:27:57 +00:00
|
|
|
# Disable setuid/setgid bits for the files inside container.
|
2022-04-29 03:31:27 +00:00
|
|
|
RUN find / \( -path /proc -prune \) -o \( \( -perm -2000 -o -perm -4000 \) -print -exec chmod -s '{}' + \) || true
|
2022-04-27 07:27:57 +00:00
|
|
|
|
2021-09-01 05:32:08 +00:00
|
|
|
# Update path to load appsmith utils tool as default
|
|
|
|
|
ENV PATH /opt/appsmith/utils/node_modules/.bin:$PATH
|
2022-07-28 12:15:28 +00:00
|
|
|
LABEL com.centurylinklabs.watchtower.lifecycle.pre-check=/watchtower-hooks/pre-check.sh
|
|
|
|
|
LABEL com.centurylinklabs.watchtower.lifecycle.pre-update=/watchtower-hooks/pre-update.sh
|
|
|
|
|
COPY ./deploy/docker/watchtower-hooks /watchtower-hooks
|
|
|
|
|
RUN chmod +x /watchtower-hooks/pre-check.sh
|
|
|
|
|
RUN chmod +x /watchtower-hooks/pre-update.sh
|
|
|
|
|
|
2021-09-01 05:32:08 +00:00
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
EXPOSE 443
|
|
|
|
|
ENTRYPOINT [ "/opt/appsmith/entrypoint.sh" ]
|
2022-05-06 06:15:56 +00:00
|
|
|
HEALTHCHECK --interval=15s --timeout=15s --start-period=45s CMD "/opt/appsmith/healthcheck.sh"
|
2021-09-14 13:31:06 +00:00
|
|
|
CMD ["/usr/bin/supervisord", "-n"]
|