I have hosted redash ami in AWS. I want to know the path where all the source code is. Basically I am trying to customize certain features and looking to find source code.
Have you explored the /
root directory in your instance?
Thanks for your reply. I checked the directory. source code is not available.
Will AWS have source code or compiled code. Basically trying to understand if i can edit the code directly in server. I used delivered images from redash installation.
Patching redash with the new system of docker is significantly more complex than before. If you don’t need v8 features, one option is to move back to v7 pre-docker.
If you do need v8 features or don’t mind the extra work, you have a couple of options:
-
Download source code and build your own docker images. You’ll have access to the source code. Down side is that you have to learn extensively how to manage docker / etc. This is a big hassle if all you’re trying to do is a simple patch of this or that.
-
Directly patch the downloaded docker instances. AWS AMI docker images have 2 code locations, they are both located in
/var/lib/docker/overlay2
.
They are locate-able because they have a “Dockerfile” file and “diff” in the path.
For example:
./e4f648da36ce604803f3bc128e0f9afb8a3ecf964064a11129383a2dca5a342e/diff/app/Dockerfile
Within those paths, there are all relevant files you can edit.
I recommend that you copy the file you want to edit, and modify the file in both locations.
here’s a simple bash script to find and patch, for example, modifications to the mysql.py or pg.py files and copy them to the correct place:
patchredash.sh
#!/bin/bash
patharray=$(find /var/lib/docker/overlay2 -maxdepth 4 |grep Dockerfile |grep diff |cut -d '/' -f 6)
for dir in ${patharray[*]}; do
cp mysql.py.8.patched /var/lib/docker/overlay2/$dir/diff/app/redash/query_runner/mysql.py
cp pg.py.8.patched /var/lib/docker/overlay2/$dir/diff/app/redash/query_runner/pg.py
done
docker restart redash_server_1
docker restart redash_adhoc_worker_1
I am sure a dev on the project can probably indicate a much better way to do this, but there is really no documentation for how to do this and you are probably, like me, just looking for cheap and fast.