-
Notifications
You must be signed in to change notification settings - Fork 454
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
fix: avoid config.yaml modification in standalone mode due to read only file system. #558
Conversation
TheShubhendra
commented
Jul 22, 2024
- Removed modification of config.yaml in standalone mode.
- Added checks to make sure it uses data plane with yaml config provider.
- Added separate config file for standalone mode example.
…in standalone mode. - Removed direct file modifications in read-only environments - Added checks for required fields in config.yaml for standalone mode - Ensure the script exits with an error if the required fields are missing
Can you please review @kayx23 |
the CI is not running, please push an empty commit |
@shreemaan-abhishek I have pushed an empty commit but CI is still not running. |
I had tested workflow |
Can someone please review? |
@TheShubhendra, please check why is the dashboard CI failing. Thank you for your patience. |
As I mentioned before, the same workflow works on my PC, but it gives a segmentation fault on GitHub Actions. https://github.com/TheShubhendra/apisix-docker/actions/runs/10062135660/job/27813891259#:~:text=Segmentation%20fault%20(core%20dumped) This could be due to GitHub's resource limits or possibly another issue not related to apisix, I suppose? |
Why all actions are now failing with the same reason |
@TheShubhendra, thanks for the fix. Please make this fix in another PR and then pull changes from master when the fix PR is merged. One PR for one thing. Thanks for your patience. |
2ef539f
to
b6efaac
Compare
@TheShubhendra, please merge master branch to pull the fix. |
echo "$(sed 's/role: traditional/role: data_plane/g' ${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml | ||
echo "$(sed 's/role_traditional:/role_data_plane:/g' ${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml | ||
echo "$(sed 's/config_provider: etcd/config_provider: yaml/g' ${PREFIX}/conf/config.yaml)" > ${PREFIX}/conf/config.yaml | ||
# Check if the deployment role is set to data_plane and config provider is set to yaml for standalone mode |
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.
this part of code is being repeated across entrypoint scripts. Please DRY.
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.
Thank you for your suggestion. What we can do is extract the logic into a single file and place it in the root directory. Then, we can modify the Makefile to copy this file into the appropriate build context directories (e.g., /debian, /redhat, and /debian-dev) before the Docker build process, and remove it afterward.
Please share your thoughts on this.
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.
#!/bin/bash
check_config() {
local key="$1"
local expected_value="$2"
local error_message="$3"
if ! grep -q "${key}: ${expected_value}" "${PREFIX}/conf/config.yaml"; then
echo "Error: ${PREFIX}/conf/config.yaml does not contain '${key}: ${expected_value}'. ${error_message}"
echo "Please refer to the APISIX documentation for deployment modes: https://apisix.apache.org/docs/apisix/deployment-modes/"
exit 1
fi
}
check_config "role" "data_plane" "Deployment role must be set to 'data_plane' for standalone mode."
check_config "role_data_plane" "" "Role must be set to 'role_data_plane:' for standalone mode."
check_config "config_provider" "yaml" "Config provider must be set to 'yaml' for standalone mode."
This file can be placed into /utils and then sourced into all entrypoint files.
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.
yes
can someone please review this PR |
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time ordiscuss it on the [email protected] list. Thank you for your contributions. |
Any updates on this? |
I would like to vote on this PR, it's really helpful and solves a lot of confusing issues in the current repository state. |