From ff9e24cbd9548e584604b60d71b03f1a81232ad7 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Mon, 24 Jul 2023 09:56:30 +0530 Subject: [PATCH] chore: Use new Docker image for dev-time server (#25609) We've stopped [building the slim images](https://github.com/appsmithorg/appsmith/pull/25219) now and so the instructions to run server locally, which rely on the slim server image, need to be updated to use the newer `appsmith-ce` image. This PR updates the instructions to use this. --- app/server/docker-compose.yml | 4 +- contributions/ServerSetup.md | 63 ++++++++++++-------------------- deploy/docker/docker-compose.yml | 27 ++++---------- 3 files changed, 33 insertions(+), 61 deletions(-) diff --git a/app/server/docker-compose.yml b/app/server/docker-compose.yml index 6a03a43272..e73ba234df 100644 --- a/app/server/docker-compose.yml +++ b/app/server/docker-compose.yml @@ -1,3 +1,5 @@ +# This is deprecated, and is not recommended anymore. Please refer to ServerSetup.md for the latest instructions. + version: "3.7" services: @@ -33,4 +35,4 @@ services: networks: appsmith: - driver: bridge \ No newline at end of file + driver: bridge diff --git a/contributions/ServerSetup.md b/contributions/ServerSetup.md index ced1f1a682..743c931bc7 100644 --- a/contributions/ServerSetup.md +++ b/contributions/ServerSetup.md @@ -14,40 +14,23 @@ There are two ways to run Appsmith server. ## Setup with Docker -* You can run the server codebase in a docker container. +Running the Appsmith Docker image as a container will grant you a running Appsmith server, along with its dependencies, like MongoDB and Redis. This is the easiest way to get started with Appsmith server. -* This method is recommended if you just want to run the backend server for testing/contributing to frontend code. If you would like to make edits to the source code of server, use [local server method](#local-setup) +1. Clone the Appsmith repository and change into it + ``` + git clone https://github.com/appsmithorg/appsmith.git + cd appsmith + ``` -- ## What's in the docker container - * Appsmith server - * MongoDB database - * Redis instance +2. Change your directory to `deploy/docker` + ```console + cd app/server + ``` -* ## Pre-requisites - - * [Docker](https://docs.docker.com/get-docker/) - -* ## Setup - - 1. Clone the Appsmith repository and `cd` into it - - ``` - git clone https://github.com/appsmithorg/appsmith.git - cd appsmith - ``` - 2. Change your directory to `app/server` - ```console - cd app/server - ``` - 3. Create a copy of the `envs/docker.env.example` - ```console - cp envs/docker.env.example envs/docker.env - ``` - 4. Start up the containers - ```console - docker-compose up -d - ``` - 5. Have fun! +3. Start + ```console + docker-compose up -d + ``` # Local Setup @@ -88,7 +71,7 @@ This document doesn't provide instructions to install Java and Maven because the ``` mongosh ``` - 2. Once you are inside the mongo shell run the below command. + 2. Once you are inside the mongo shell run the below command. ``` rs.initiate({"_id": "rs0", "members" : [{"_id":0 , "host": "localhost:27017" }]}) ``` @@ -96,11 +79,11 @@ This document doesn't provide instructions to install Java and Maven because the - Upgrade the MongoDB version to 5.0 or higher - Close the mongoDB instance running in your local - Start the mongoDB in replica set mode and initiate the replica set - + ``` mongod --port 27017 --dbpath --replSet && mongo --eval “rs.initiate()” ``` - - One can use following commands to check replica set status: + - One can use following commands to check replica set status: ``` mongo appsmith rs.status() @@ -128,7 +111,7 @@ With the prerequisites met, let's build the code. ```console mvn clean compile - ``` + ``` This generates a bunch of classes required by IntelliJ for compiling the rest of the source code. Without this step, your IDE may complain about missing classes and will be unable to compile the code. @@ -156,9 +139,9 @@ With the prerequisites met, let's build the code. - This command will create a `dist` folder which contains the final packaged jar along with multiple jars for plugins as well. - If you want to run the tests, you can remove `-DskipTests` flag from the build cmd. ### Debugging - + - If the volume containing docker's data root path (macOS: ```~/Library/Containers/com.docker.docker/Data/vms/0/```, Ubuntu: `/var/lib/docker/`) has less than 2 GB of free space, then the script may fail with the following error. - + ```console Check failed: Docker environment should have more than 2GB free disk space. ``` @@ -171,7 +154,7 @@ With the prerequisites met, let's build the code. ```console sudo APPSMITH_MONGODB_URI="mongodb://localhost:27017/appsmith" APPSMITH_REDIS_URL="redis://127.0.0.1:6379" APPSMITH_MAIL_ENABLED=false APPSMITH_ENCRYPTION_PASSWORD=abcd APPSMITH_ENCRYPTION_SALT=abcd ./build.sh ``` - + 8. Start the Java server by running @@ -254,7 +237,7 @@ Note that you have to execute further steps into WSL terminal not in CMD. To point to a custom Git Root where the git repositories will be persisted, update the env variable called APPSMITH_GIT_ROOT to point to your custom file path. ```console -APPSMITH_GIT_ROOT=./path/to/repo/directory +APPSMITH_GIT_ROOT=./path/to/repo/directory ``` ## Building and running the code @@ -265,7 +248,7 @@ APPSMITH_GIT_ROOT=./path/to/repo/directory ```console mvn clean compile -``` +``` This generates a bunch of classes required by IntelliJ for compiling the rest of the source code. Without this step, your IDE may complain about missing classes and will be unable to compile the code. diff --git a/deploy/docker/docker-compose.yml b/deploy/docker/docker-compose.yml index 860a7f3adc..0233dcbbdc 100644 --- a/deploy/docker/docker-compose.yml +++ b/deploy/docker/docker-compose.yml @@ -1,28 +1,15 @@ +# Use for running an Appsmith, during development. + version: "3" services: - appsmith: - build: - context: ../../ + image: index.docker.io/appsmith/appsmith-ce:release container_name: appsmith ports: - - "80:80" - - "443:443" + - "8080:80" + environment: + APPSMITH_ENCRYPTION_PASSWORD: abcd + APPSMITH_ENCRYPTION_SALT: abcd volumes: - ./stacks:/appsmith-stacks - # Uncomment the lines below to enable auto-update - #labels: - # com.centurylinklabs.watchtower.enable: "true" - - #auto_update: - # image: containrrr/watchtower - # volumes: - # - /var/run/docker.sock:/var/run/docker.sock - # # Update check interval in seconds. - # command: --schedule "0 0 * ? * *" --label-enable --cleanup - # restart: unless-stopped - # depends_on: - # - appsmith - # environment: - # - WATCHTOWER_LIFECYCLE_HOOKS=true \ No newline at end of file