-
Notifications
You must be signed in to change notification settings - Fork 636
Compose dev #3226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Compose dev #3226
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
f8d06cb to
fb811f1
Compare
62afd82 to
c310703
Compare
c310703 to
2300458
Compare
|
As I had time to update the PR, I also optimized some things, like using a Python virtual environment in the Docker image. I thought about:
|
212f1bb to
08e8de9
Compare
|
Thanks for the suggested changes to the development setup @jbaptperez. I appreciate you taking the time to propose these updates to improve the developer experience, especially for those in restricted environments. The changes are quite extensive and touch many core parts of our development setup, so we'll need some time to thoroughly review and test them. While flexibility is important, we aim to maintain a simple and easily reproducible development environment that works out-of-the-box on a typical Linux machine. We generally encourage developers to manage their own custom configurations for specific environments, such as those found in corporate settings. Therefore, we may incorporate some of your proposed changes while declining others to ensure we keep the core setup as straightforward as possible. |
08e8de9 to
fcf14ef
Compare
|
@jkppr, actually, the apparent change is not so big: Everything run into a single container with I paid special attention to keeping default settings so that the behaviour without changes is the same as before. A big change reported by Git is the deletion of the recently added The rest is close to the previous behaviour, with a single real difference: I duplicated the However, I understand your message and I am open to suggestions. |
2161c61 to
94e3cad
Compare
b1dbf22 to
e7afbc6
Compare
e7afbc6 to
0d65e7b
Compare
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request significantly enhances the development environment by overhauling the Docker Compose setup. Key improvements include the adoption of the modern Compose specification, the introduction of a .env file for easier customization of builds, and the use of a Python virtual environment within the container. The changes make the development setup more flexible and robust, especially for environments with network restrictions.
My review focuses on ensuring the new setup is correct and follows best practices. I've found a critical issue in the docker-entrypoint.sh script that would prevent the timesketch container from starting correctly due to an incorrect virtual environment path. I've also identified a couple of high-severity issues related to build reproducibility: the use of a :latest tag for a base image and ignoring package lock files in .gitignore. Finally, I've suggested some improvements to the new README.md for clarity and consistency.
3ed42e7 to
9f0875b
Compare
|
I rebased my branch on top of master.
Note the virtualenv became the standard way to run the application in-between, which is great. I made the following changes:
However, I the work is not over. To do:
|
19ff354 to
a770a1e
Compare
95c40df to
0ade735
Compare
d117702 to
a3de4ea
Compare
|
Hi @jkppr, For information, I'm moving to a new squad, so I won't work on this project anymore. Sorry if I made such a big PR but I ran out of time to properly extract every new features that I added on-the-fly. In the future, if you agree to replace the current Compose setup with the new one of this PR (for now in the I hope you will merge this PR. |
Makes the repository handle file line endings. This helps to make it cross-platform, asserting some files are Unix-ended.
Adds .gitignore files. Dramatically improves an image build in a development context.
Compose standard changes: - Removes the deprecated "version" field, - Adds a toplevel "name" field (prefix of container names nad network), - Adds a toplevel "network" field, with a common "timesketch-dev" network, - Removes container names (depends on and toplevel name and service names), - Do not bind to the 127.0.0.1 interface only (0.0.0.0), - Removes useless "links" (common network), - Refactors environment variables not to use a YAML array, - Removes "restart" fields to detect undesired crashes in development, - Binds ports of other services to the host (opensearch, redis). General changes: - Allows Docker image builds in a restricted company context (limited access to remote Ubuntu, Python or Node repositories) using variables, - Centralizes variables in a .env file (not versioned), - Adds a .env.template file as .env template with predefined variables, - Use a distinct directory for every service dependencies, - Use named volumes for portability and to avoid auto-creation of anonymous ones (PostgreSQL, Redis and Prometheus declare volumes in their Dockerfile; this leads to anonymous volume creations if they are not declared in Compose), - Uses a per-service environment file, - Uses local images that include their healthcheck, - Rename some service names, - Simplifies how development configuration files are transferred to Timesketch, - Simplifies manipulation of containers using Compose CLI instead of the Docker one, - Simplify and optimizes the Timesketch entrypoint, - Updates the Bash scripts to start frontend-ng, - Updates related documentation.
Required to isolate development processes into their own Docker container.
Dockerfile changes: - Switches to optimized multistage build, - Switch to rootless images (user name, UID and GID are configurable), - Use dedicated entrypoints per images, - Add a health check for the Gunicorn image, - Frontend compatible with all 3 versions at build time. Compose changes: - Splits services into multiple ones, - Use a dedicated setup service for data initialization, - Dramatically optimizes the initial setup. README.md changes: - Rewrites everything, clearer.
a3de4ea to
d6e9b24
Compare
IMPORTANT: All Pull Requests should be connected to an issue, if you don't
have an issue, please start by creating an issue and link it to the PR.
Please provide enough information so that others can review your pull request:
.envfile,Checks
Closing issues
Closes #3225.
Changes
.gitattributes and .dockerignore
Adds .gitattributes file to handle line endings, in particular when developing on Windows and building Linux images.
Adds .dockerignore file to limit the context transferred when building Docker images.
New Compose set-up for development
contrib/docker/dev.docker/devset-up for now..envfile, with a.env.templatemodel file.docker compose down -vto reset).tsctlonce to register all rules at once).README.mdto quickly get started.Limits
I used a copy of the
timesketch.conffile to properly set variables required for a local setup.This copy must be updated according to the modification mades to the
data/timesketch.conffile.However, if you decides to replace the current Compose development setup with the new (contrib) one, this can be solved the following way:
contrib/docker/devtodocker/dev,timesketch.conffile,timesketch.confand replace thedata/one,