Commit Graph

43 Commits

Author SHA1 Message Date
Arik Fraimovich
7c05a730dc
Remove --max-old-space-size=4096 from npm build command (#4381)
* Remove --max-old-space-size=4096 from build

Looks like it's no longer needed.

* Update to node v12.

* Add build:old-node-version for those who have Node < 12.
2019-12-05 22:41:57 +02:00
Nicolas Le Manchet
246eca1121 Migrate the application to Python 3 (#4251)
* Make core app compatible with Python 3

No backward compatibility with Python 2.7 is kept.
This commit mostly contains changes made with 2to3 and manual
tweaking when necessary.

* Use Python 3.7 as base docker image

Since it is not possible to change redash/base:debian to Python 3
without breaking future relases, its Dockerfile is temporarly
copied here.

* Upgrade some requirements to newest versions

Some of the older versions were not compatible with Python 3.

* Migrate tests to Python 3

* Build frontend on Python 3

* Make the HMAC sign function compatible with Python 3

In Python 3, HMAC only works with bytes so the strings and the
float used in the sign function need to be encoded.
Hopefully this is still backward compatible with already generated
signatures.

* Use assertCountEqual instead of assertItemsEqual

The latter is not available in Python 3.
See https://bugs.python.org/issue17866

* Remove redundant encoding header for Python 3 modules

* Remove redundant string encoding in CLI

* Rename list() functions in CLI

These functions shadow the builtin list function which is
problematic since 2to3 adds a fair amount of calls to the builtin
list when it finds dict.keys() and dict.values().

Only the Python function is renamed, from the perspective of the
CLI nothing changes.

* Replace usage of Exception.message in CLI

`message` is not available anymore, instead use the string
representation of the exception.

* Adapt test handlers to Python 3

* Fix test that relied on dict ordering

* Make sure test results are always uploaded (#4215)

* Support encoding memoryview to JSON

psycopg2 returns `buffer` objects in Python 2.7 and `memoryview`
in Python 3. See #3156

* Fix test relying on object address ordering

* Decode bytes returned from Redis

* Stop using e.message for most exceptions

Exception.message is not available in Python 3 anymore, except
for some exceptions defined by third-party libraries.

* Fix writing XLSX files in Python 3

The buffer for the file should be made of bytes and the actual
content written to it strings.

Note: I do not know why the diff is so large as it's only a two
lines change. Probably a white space or file encoding issue.

* Fix test by comparing strings to strings

* Fix another exception message unavailable in Python 3

* Fix export to CSV in Python 3

The UnicodeWriter is not used anymore. In Python 3, the interface
provided by the CSV module only deals with strings, in and out.
The encoding of the output is left to the user, in our case
it is given to Flask via `make_response`.

* (Python 3) Use Redis' decode_responses=True option (#4232)

* Fix test_outdated_queries_works_scheduled_queries_tracker (use utcnow)

* Make sure Redis connection uses decoded_responses option

* Remove unused imports.

* Use Redis' decode_responses option

* Remove cases of explicit Redis decoding

* Rename helper function and make sure it doesn't apply twice.

* Don't add decode_responses to Celery Redis connection URL

* Fix displaying error while connecting to SQLite

The exception message is always a string in Python 3, so no
need to try to decode things.

* Fix another missing exception message

* Handle JSON encoding for datasources returning bytes

SimpleJSON assumes the bytes it receives contain text data, so it
tries to UTF-8 encode them. It is sometimes not true, for instance
the SQLite datasource returns bytes for BLOB types, which typically
do not contain text but truly binary data.

This commit disables SimpleJSON auto encoding of bytes to str and
instead uses the same method as for memoryviews: generating a
hex representation of the data.

* Fix Python 3 compatibility with RQ

* Revert some changes 2to3 tends to do (#4261)

- Revert some changes 2to3 tends to do when it errs on the side of caution regarding dict view objects.

- Also fixed some naming issues with one character variables in list comprehensions.

- Fix Flask warning.

* Upgrade dependencies

* Remove useless `iter` added by 2to3

* Fix get_next_path tests (#4280)

* Removed setting SERVER_NAME in tests setup to avoid a warning.

* Change get_next_path to not return empty string in case of a domain only value.

* Fix redirect tests:

Since version 0.15 of Werkzeug it uses full path for fixing the location header instead of the root path.

* Remove explicit dependency for Werkzeug

* Switched pytz and certifi to unbinded versions.

* Switch to new library for getting country from IP

`python-geoip-geolite2` is not compatible with Python 3, instead
use `maxminddb-geolite2` which is very similar as it includes
the geolite2 database in the package .

* Python 3 RQ modifications (#4281)

* show current worker job (alongside with minor cosmetic column tweaks)

* avoid loading entire job data for queued jobs

* track general RQ queues (default, periodic and schemas)

* get all active RQ queues

* call get_celery_queues in another place

* merge dicts the Python 3 way

* extend the result_ttl of refresh_queries to 600 seconds to allow it to continue running periodically even after longer executions

* Remove legacy Python flake8 tests
2019-10-24 12:42:13 +03:00
Jianchao Yang
a00c5a8857 Dockerfile front end stage copies client side files only (#3924)
So that changing other files will not trigger the
very expensive rebuild process.
2019-06-23 11:33:52 +03:00
Arik Fraimovich
3f8c7333be
Use the debian flavor of the redash/base image (#3240) 2019-06-02 11:42:19 +03:00
Jannis Leidel
07c9530984 Decouple extensions from Flask app. (#3569)
* Decouple extensions from Flask app.

This separates the extension registry from the Flask app and also introduces a separate registry for preriodic tasks.

Fix #3466.

* Address review feedback.

* Update redash/extensions.py

Co-Authored-By: jezdez <jannis@leidel.info>

* Minor comment in requirements.

* Refactoring after getting feedback.

* Uncoupled bin/bundle-extensions from Flas app instance.

* Load bundles in bundle script and don’t rely on Flask.

* Upgraded to importlib-metadata 0.9.

* Add missing requirement.

* Fix TypeError.

* Added requirements for bundle_extension script.

* Install bundles requirement file correctly.

* Decouple bundle loading code from Redash.

* Install bundle requirements from requirements.txt.

* Use circleci/node for build-docker-image step, too.
2019-05-26 14:56:02 +03:00
koooge
64783b7f06 Switch to MULTI FROM Dockerfile and use Node 10 for builds (#3199) 2018-12-23 15:17:54 +02:00
Marina Samuel
02e919c39b Closes #2565: Add frontend extension capability. (#2799) 2018-10-14 15:53:39 +03:00
Arik Fraimovich
be7f601d21
Speed up builds by skipping installing requirements_all_ds.txt in CI unit tests (#2928)
* Speed up builds by skipping requirements_all_ds.txt

* Update docker compose file version

* Start services before running commands

* Add boto and Athena dependencies to requirements_dev.txt
2018-10-11 14:12:28 +03:00
Arik Fraimovich
fa1b71bc27 Add Zeit now support 2018-07-15 13:39:57 +03:00
Arik Fraimovich
be6426014d Fix Docker file ownership issues:
1. Simplify user creation to create a non system user (so the uid will usually
   match the host user).
2. Set the user to redash & remove the need to change user in docker entrypoint.
2017-03-07 11:37:31 +02:00
Arik Fraimovich
7bbc782e5d Fix npm build command. 2017-02-09 22:22:41 +02:00
Arik Fraimovich
6338596710 Updates to Dockerfile:
- Build frontend assets (needed for standalone use of the image).
- Change ownership of the files to redash user.
2017-02-09 16:53:25 +02:00
Arik Fraimovich
837e3a372a Remove webpack from Docker Compose:
I realized that it makes more sense to run Webpack on the host machine
as usually you will need to install Node's tools on the host to enjoy
better intelisense and eslint support in the editor.

On top of that, installing Node.js on most developer machines should be
relatively easy.
2017-01-19 15:20:52 +02:00
Arik Fraimovich
ddf6fc50a5 New Dockerfile and docker-compose for dev 2017-01-19 15:20:52 +02:00
Arik Fraimovich
68ccf4b13a Remove references to rd_ui 2016-11-26 12:01:42 +02:00
Arik Fraimovich
837073144f Dockerfile: pin setuptools version to 23.1.0 until they resolve bug introduced in 24.0 2016-07-03 13:39:38 +03:00
Arik Fraimovich
c107c94a27 Merge pull request #1077 from nabilblk/master
Fix: install needed dependencies to use Hive in Docker image
2016-06-13 15:22:53 +03:00
Arik Fraimovich
df1e72ca01 Take into account that node_modules moves to root 2016-06-06 09:24:13 +03:00
nabil
2043834ae9 Issue #1076 : addtional dependencies for Hive Datasource 2016-05-26 10:38:07 +01:00
Arik Fraimovich
2a745d5d54 Dockerfile: set the path to static assets 2016-03-12 18:37:20 +02:00
Arik Fraimovich
b222f85d88 Add freetds-dev to Dockerfile 2016-02-03 09:06:01 +02:00
Ryota Arai
ec41077dc1 Run apt-get clean to reduce image size. 2015-12-17 00:07:56 +09:00
Ryota Arai
15f9a063ae Install nodejs, build assets and uninstall it in one instruction. 2015-12-17 00:07:56 +09:00
Ryota Arai
a15085dc93 Run supervisord as root. 2015-12-17 00:07:56 +09:00
Ryota Arai
78ae9ac647 Build dependencies during building Docker image. 2015-12-17 00:07:56 +09:00
Arik Fraimovich
541060c62e Remove latest_release_url.py - docker images will be created with current code base as context 2015-11-23 11:38:16 +02:00
Arik Fraimovich
f3ec0448f5 Updates to Dockerfile:
- No need to pg client anymore.
- Fix path to supervisord.conf.
2015-11-23 11:38:16 +02:00
John Wu
e19962d4e3 Remove unnecessary ENV line
Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-08 13:40:03 -07:00
John Wu
cf6ce0599b Use volume to store postgres data
Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-08 12:14:07 -07:00
John Wu
a699c04ee1 Download and build from latest source instead 2015-10-08 12:09:24 -07:00
John Wu
c854ce3c10 Remove postgres user
Also changed **docker_init_postgres.sh**. Since we don't have postgres
user now, then we cannot use `sudo -u postgres`. The alternative will be
running `psql --username=blahblah`.

Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-07 17:04:27 -07:00
John Wu
ab6cc3f146 Run celery using redash user 2015-10-07 16:21:37 -07:00
John Wu
97d0035f4a Group supervisord installation commands
Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-07 11:16:49 -07:00
John Wu
8108bc7cb1 Group relevant commands
Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-07 11:07:33 -07:00
John Wu
690cb2fccd Group all apt-get commands
Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-07 10:58:52 -07:00
John Wu
d6bb6d33a3 Expose ports in Dockerfile
Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-06 16:30:18 -07:00
John Wu
0c8c196d65 Group apt-get instructions
Given how docker caching works, it is better the group multiple
`apt-get` instructions into one when possible because it prevents docker
from building too many layers.

Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-06 14:13:53 -07:00
John Wu
9d703b44de Create postgres user
Create postgres user because we are now using `postgres-client` packages
which does not create postgres user by default. We need this user when
running `docker_init_postgres.sh`, so let's create it by hand.

Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-06 14:12:48 -07:00
John Wu
fb00350c58 Migrate stuff in bootstrap_docker.sh into Dockerfile
By using Dockerfile `RUN` command, we can enable docker to cache our
build. Also, much more easier to maintain.

Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-06 13:21:09 -07:00
John Wu
407a649d17 Use ubuntu instead
Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-06 11:42:19 -07:00
John Wu
72e48a191b Remove Node.js infra 2015-10-06 11:12:13 -07:00
John Wu
21c413f699 Add CMD to start service since docker doesn't support init scripts
Signed-off-by: John Wu <webmaster@leapoahead.com>
2015-10-05 14:59:52 -07:00
John Wu
1ee05e12fd Docker support 2015-09-30 14:19:22 -07:00