Skip to content
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

update 301 #1706

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Nginx.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM anroe/nginx-geoip2:1.22.1-alpine-geoip2-3.4

# Replace the default conf.d folder with your local configuration
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx
3 changes: 3 additions & 0 deletions conf/conf.d/client.conf
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ server {
rewrite ^/docs/configure_nats.md /docs/configure_natsmq.md permanent;
rewrite ^/docs/configure_quota_limits.md /docs/configure_quotaandlimits.md permanent;

# 2024 Nov 29
rewrite ^/docs/use_ColPALI_with_milvus.md /docs/use_ColPali_with_milvus.md permanent;

# redirect old replicated links
rewrite ^/docs/text_search_engine.md /docs/build-rag-with-milvus.md permanent;
rewrite ^/docs/question_answering_system.md /docs/build-rag-with-milvus.md permanent;
Expand Down
39 changes: 21 additions & 18 deletions scripts/pre-commit.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
const { execSync } = require('child_process');
const path = require('path');

const execOptions = {
encoding: 'utf8',
};
const execOptions = { encoding: 'utf8' };

const fileString = execSync('git diff --cached --name-only', execOptions);
// Paths
const confDir = path.resolve(__dirname, '../conf');
const dockerfilePath = path.resolve(__dirname, '../Nginx.Dockerfile');
const imageName = 'nginx-geoip2-test';
const containerName = 'nginx-test-container';

const nginxConfChanged = fileString
.trim()
.split('\n')
.some(item => item.includes('client.conf'));
try {
// Build Docker image using Nginx.Dockerfile
console.info('Building Docker image...');
execSync(`docker build -f ${dockerfilePath} -t ${imageName} .`, execOptions);

if (nginxConfChanged) {
try {
execSync('nginx -v', execOptions);
} catch (error) {
console.info('Installing nginx...');
execSync('brew install nginx', execOptions);
}
// Run container to test Nginx configuration
console.info('Running container to test Nginx configuration...');
execSync(
`docker run --rm --name ${containerName} -v ${confDir}:/etc/nginx/conf.d ${imageName} nginx -t`,
execOptions
);

execSync('nginx -t -c $(pwd)/scripts/test.conf', execOptions);
} else {
console.info('Skipping nginx test as client.conf is not changed.');
console.info('Nginx configuration test passed!');
} catch (error) {
console.error('Nginx configuration test failed:', error.stderr || error.message);
process.exit(1);
}