Skip to content
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ngx-rust"
version = "1.13.5"
version = "0.1.0"
authors = ["Sehyo Chang sehyo@nginx.com"]

[lib]
Expand Down
39 changes: 14 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,29 @@
# Rust Wrapper for Nginx
# ngx-rust

Please follow steps
Module development kit for Nginx using Rust

## Install Rust tooling
## Requirement

Follow instruction here to install rust tooling
this crate use bazel to install nginx source and generate bindings. Please follow https://docs.bazel.build/versions/master/install.html.

https://www.rust-lang.org/en-US/install.html
## Usage

## Configure Rust module
First, add this to your 'Cargo.toml';

This project need to be configured for specific OS in order to build other module which depends on this module.

This will generate 'nginx' directory which contains configured version of nginx for each of the OS.

### For Linux development

If you want to target your module to run on linux, please perform one-time setup. This will download nginx source and configure to compile on linux.

```bash
make linux-setup
```toml
[dependencies]
ngix-rust = "0.1"
```

### For Mac development
Next, add this to your crate:

```bash
make darwin-setup
```rust
extern crate ngx-rust;
```

## Clean configuration
## Limitation

This will remove all Rust artifacts as well generated NGINX build artifacts
```bash
make super_clean
```

Currently only Darwin (Mac OSX) and Linux platform are supported



Expand Down
Empty file added WORKSPACE
Empty file.
7 changes: 0 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ fn make(arg: &str) -> Result<Output> {
}



#[cfg(target_os = "macos")]
fn configure() -> Result<Output> {
make("nginx-test")
}

#[cfg(target_os = "linux")]
fn configure() -> Result<Output> {
make("nginx-setup")
}
Expand Down
4 changes: 2 additions & 2 deletions nginx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ifeq ($(UNAME_S),Darwin)
NGX_OPT= $(NGX_MODULES)
endif
NGX_DEBUG="--with-debug"
RUST_COMPILER_TAG = 1.20.0
RUST_COMPILER_TAG = 1.21.0
RUST_TOOL = nginmesh/ngx-rust-tool:${RUST_COMPILER_TAG}
export ROOT_DIR=$(shell dirname $$PWD)
DOCKER_TOOL=docker run -it -v ${ROOT_DIR}:/src -w /src/${MODULE_PROJ_NAME} ${RUST_TOOL}
Expand All @@ -44,7 +44,7 @@ nginx-source: setup-nginx

nginx-configure:
cd nginx/${NGINX_SRC}; \
./configure --add-dynamic-module=../../module $(NGX_OPT)
./configure $(NGX_OPT)


nginx-setup: nginx-source nginx-configure
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion tool/rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:16.04

MAINTAINER Sehyo Chang "sehyo@nginx.com"

ENV RUST_VERSION=1.20.0
ENV RUST_VERSION=1.21.0

# install nginx required libraries

Expand Down Expand Up @@ -48,3 +48,10 @@ RUN curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/protoc-
RUN unzip protoc-3.3.0-linux-x86_64.zip -d protoc3
RUN mv protoc3/bin/* /usr/local/bin/
RUN rm protoc-3.3.0-linux-x86_64.zip

# install bazel
RUN apt-get update; apt-get install -y openjdk-8-jdk
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
RUN apt-get update && apt-get install -y bazel
RUN bazel version
2 changes: 1 addition & 1 deletion tool/rust/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

TAG = 1.20.0-C
TAG = 1.21.0
NAME = nginmesh/ngx-rust-tool


Expand Down