There are two ways to run Appsmith server.
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.
Clone the Appsmith repository and change into it
git clone https://github.com/appsmithorg/appsmith.git
cd appsmith
Change your directory to deploy/docker
cd deploy/docker
Start
docker-compose up -d
As the server codebase is written in Java and is powered by Spring + WebFlux we need Java and Maven installed to build the code. In addition we also need one instance of MongoDB and Redis each to run Appsmith server. Lastly, we will set up IntelliJ IDEA to let you edit the code. Let's get those prerequisites installed on your machine.
Before you can start to hack on the Appsmith server, your machine should have the following installed:
Docker
.Docker
.This document doesn't provide instructions to install Java and Maven because these vary between different operating systems and distributions. Please refer to the documentation of your operating system or package manager to install these. Next we will setup MongoDB and Redis using Docker
.
The following command will start a MongoDB docker instance locally:
docker run -d -p 127.0.0.1:27017:27017 --name appsmith-mongodb --hostname=localhost -e MONGO_INITDB_DATABASE=appsmith -v /path/to/store/data:/data/db mongo --replSet rs0
Please change the /path/to/store/data
to a valid path on your system. This is where MongoDB will persist it's data across runs of this container.
Note that this command doesn't set any username or password on the database so we make it accessible only from localhost using the 127.0.0.1:
part in the port mapping argument. Please refer to the documentation of this image to learn how to set a username and password.
MongoDB will now be running on mongodb://localhost:27017/appsmith
.
Mongo running inside docker
Please follow the below steps for enabling the replica set with mongo running inside the docker
mongosh
rs.initiate({"_id": "rs0", "members" : [{"_id":0 , "host": "localhost:27017" }]})
Standalone Mongo running on the system (non-docker based mongo setup)
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 <path/to/db> --replSet <replica-set-name> && mongo --eval “rs.initiate()”
One can use following commands to check replica set status:
mongo appsmith
rs.status()
By this time you should have the mongo running with replica set
Clone Appsmith repository.
Change your directory to app/server
.
Run the following command:
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.
Setup Environment file
Create a copy of the envs/dev.env.example
cp envs/dev.env.example .env
This command creates a .env
file in the app/server
folder. All run scripts pick up environment configuration from this file.
Ensure that the environment variables APPSMITH_MONGODB_URI
and APPSMITH_REDIS_URI
in the file .env
point to your local running instances of MongoDB and Redis.
Update the replica set name with correct value in the mongo connection string in the .env file. The replica name is the same as passed here
APPSMITH_MONGODB_URI="mongodb://localhost:27017/appsmith?replicaSet=<replica-set-name>"
Run the following command to create the final JAR for the Appsmith server:
./build.sh -DskipTests
dist
folder which contains the final packaged jar along with multiple jars for plugins as well.-DskipTests
flag from the build cmd.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.
Check failed: Docker environment should have more than 2GB free disk space.
There are two ways to resolve this issue:
./build.sh
script needs to be run with root privilege as well..env
file, so it is advised that you run the cmd like:
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
Start the Java server by running
./scripts/start-dev-server.sh
By default, the server will start on port 8080.
When the server starts, it automatically runs migrations on MongoDB and will populate it with some initial required data.
You can check the status of the server by hitting the endpoint: http://localhost:8080/api/v1/users/me on your browser.
Before you can start to hack on the Appsmith server, your machine should have the following installed:
This document doesn't provide instructions to install Java and Maven because these vary between different operating systems and distributions. Please refer to the documentation of your operating system or package manager to install these.
Next we will setup MongoDB and Redis using Docker
.
Note that as you have installed Docker Desktop with WSL based engine, you can execute all docker related setup using Windows terminal (CMD). All the docker containers will automatically be available on WSL.
The following command will start a MongoDB docker instance locally:
docker run -p 127.0.0.1:27017:27017 --name appsmith-mongodb --hostname=localhost -e MONGO_INITDB_DATABASE=appsmith -v /path/to/store/data:/data/db mongo mongod --replSet rs0
For M1 chip change the base image to arm64v8 variant
docker run -p 127.0.0.1:27017:27017 --name appsmith-mongodb --hostname=localhost -e MONGO_INITDB_DATABASE=appsmith -v /path/to/store/data:/data/db arm64v8/mongo mongod --replSet rs0
Please change the /path/to/store/data
to a valid path on your C drive (C:/) of your system (e.g. C:\mongodata). This is where MongoDB will persist it's data across runs of this container.
Note that this command doesn't set any username or password on the database so we make it accessible only from localhost using the 127.0.0.1:
part in the port mapping argument. Please refer to the documentation of this image to learn how to set a username and password.
MongoDB will now be running on mongodb://localhost:27017/appsmith
.
The following command will start a Redis docker instance locally:
docker run -p 127.0.0.1:6379:6379 --name appsmith-redis redis
For M1 chip change the base image to arm64v8 variant
docker run -p 127.0.0.1:6379:6379 --name appsmith-redis arm64v8/redis
Redis will now be running on redis://localhost:6379
.
With the initial configuration met, let's build the code.
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.
APPSMITH_GIT_ROOT=./path/to/repo/directory
app/server
.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.
envs/dev.env.example
cp envs/dev.env.example .env
This command creates a .env
file in the app/server
folder. All run scripts pick up environment configuration from this file.
Ensure that the environment variables APPSMITH_MONGODB_URI
and APPSMITH_REDIS_URI
in the file .env
point to your local running instances of MongoDB and Redis.
Run the following command to create the final JAR for the Appsmith server:
./build.sh -DskipTests
This command will create a dist
folder which contains the final packaged jar along with multiple jars for plugins as well.
Note:
-DskipTests
flag from the build cmd.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
~/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:Check failed: Docker environment should have more than 2GB free disk space.
There are two ways to resolve this issue: (1) free up more space (2) change docker's data root path.
./scripts/start-dev-server.sh
By default, the server will start on port 8080.
When the server starts, it automatically runs migrations on MongoDB and will populate it with some initial required data.
You can check the status of the server by hitting the endpoint: http://localhost:8080 on your browser. By default you should see an HTTP 401 error.
Now the last bit, let's get your Intellij IDEA up and running.
To run the project from within the IDE, you will need to make use of the run configuration that is part of the repository. The run configuration uses the EnvFile plugin to include environment variables in the path. Any and all tests can be run within the IDE by cloning this run configuration.
For being able to run or debug plugins, two are especially important:
-Dpf4j.mode=development -Dpf4j.pluginsDir=appsmith-plugins
.appsmith-server
, appsmith-plugins
etc.Please note when setting Working directory option. If the path is not correct, plugins will fail to load and cannot fetch data from mongo, redis
After configuring settings as mentioned above, please also add the following to your IntelliJ IDEA setup.
[Optional] As shown in the image below, please enable the Store as Project checkbox to run the application from the main class specified.
Please enable the Always update snapshots checkbox so that the most recent build is picked up.
Happy hacking ✌️
In case the server doesn't work with the above config, please try re-compiling the code using the steps
mvn -B clean compile && ./build.sh -DskipTests
Ensure that you have Redis running on your local system.
Run the command to execute tests
cd app/server
mvn clean package
support@appsmith.com
. We'll be happy to help you.Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )