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

V2 #90

Merged
merged 25 commits into from
Oct 4, 2019
Merged

V2 #90

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
01004d7
Add TSGI Layer Between Router and Server (#81)
ASverdlov May 18, 2019
6e01b6a
Remove httpd parameter from router init
ASverdlov May 27, 2019
6313f88
Remove tsgi.errors
ASverdlov May 27, 2019
3802b50
Implement Partial-Order Approach to Middleware
ASverdlov May 29, 2019
247138e
Make socket hijacking work again
ASverdlov Jun 12, 2019
5a483bf
Update rockspec
ASverdlov Jun 17, 2019
ed8107c
router: remove duplicate code in matching.lua
ASverdlov Jul 1, 2019
da4cb2f
router: route specificity by symbols known
ASverdlov Jul 1, 2019
3601aee
Rename server :set_router -> :set_handler
ASverdlov Jul 13, 2019
40850b0
router:use(): make handler option a positional argument
ASverdlov Jul 15, 2019
6f398b6
Bless env with request metatable
ASverdlov Aug 21, 2019
42a661f
Update README
ASverdlov Aug 21, 2019
c59e104
Fix cookies formatting (#82)
ASverdlov Aug 26, 2019
4ffd696
Update rockspecs according to new release
Oct 2, 2019
549058d
Port from tap to luatest
Oct 2, 2019
886976a
Add editorconfig to configure indents
Oct 2, 2019
caffb0e
Add changelog for v2
Oct 2, 2019
28f3afe
Fix CMake build and add version information to release
Oct 2, 2019
9b5ff23
Fix RPM spec
Oct 2, 2019
19e3049
Add check dependency in debian build rules
Oct 3, 2019
e3d35f7
Run test before packpack on ci
mmelentiev-mail Oct 3, 2019
c6bd906
Fix FindTarantool.cmake script
rosik Oct 3, 2019
e79db20
Fix some linter warnings
rosik Oct 3, 2019
b49f760
Remove runtime dependency on luatest
rosik Oct 3, 2019
df6ba7d
Remove params to log_requests and log_errors from readme
Oct 4, 2019
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
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

[CMakeLists.txt]
indent_style = space
indent_size = 4

[*.cmake]
indent_style = space
indent_size = 4

[*.lua]
indent_style = space
indent_size = 4

[*.{h,c,cc}]
indent_style = tab
tab_width = 8
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ install_manifest.txt
VERSION
Testing
CTestTestfile.cmake
*.snap
*.xlog
VERSION.lua
.rocks
36 changes: 36 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
redefined = false
include_files = {"**/*.lua", "*.rockspec", "*.luacheckrc"}
exclude_files = {"lua_modules", ".luarocks", ".rocks", "luatest/luaunit.lua", "build"}
new_read_globals = {
'box',
'_TARANTOOL',
'tonumber64',
os = {
fields = {
'environ',
}
},
string = {
fields = {
'split',
'startswith',
},
},
table = {
fields = {
'maxn',
'copy',
'new',
'clear',
'move',
'foreach',
'sort',
'remove',
'foreachi',
'deepcopy',
'getn',
'concat',
'insert',
},
},
}
206 changes: 76 additions & 130 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,146 +2,92 @@ sudo: false
language: C
services:
- docker
dist: xenial

cache:
directories:
- $HOME/.cache
directories:
- $HOME/.cache

git:
depth: 100500
depth: 100500

env:
global:
- PRODUCT=tarantool-http
global:
- PRODUCT=tarantool-http

matrix:
- OS=el DIST=6
- OS=el DIST=7
- OS=fedora DIST=26
- OS=fedora DIST=27
- OS=fedora DIST=28
- OS=fedora DIST=29
- OS=ubuntu DIST=trusty
- OS=ubuntu DIST=xenial
- OS=ubuntu DIST=bionic
- OS=ubuntu DIST=cosmic
- OS=debian DIST=jessie
- OS=debian DIST=stretch
_test: &test
before_install:
- curl http://download.tarantool.org/tarantool/$TARANTOOL_VERSION/gpgkey | sudo apt-key add -
- echo "deb http://download.tarantool.org/tarantool/$TARANTOOL_VERSION/ubuntu/ xenial main" |
sudo tee /etc/apt/sources.list.d/tarantool.list
- sudo apt-get -y update
- sudo apt-get install -y tarantool tarantool-dev
- tarantoolctl rocks make
- tarantoolctl rocks install luatest 0.2.2
script: .rocks/bin/luatest

script:
- git describe --long
- git clone https://github.com/packpack/packpack.git packpack
- packpack/packpack
_deploy: &deploy
provider: packagecloud
username: tarantool
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
branch: master
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"

before_deploy:
- ls -l build/
_packpack: &packpack
stage: deploy
script:
- git describe --long
- git clone https://github.com/packpack/packpack.git packpack
- packpack/packpack
- ls -l build/
deploy:
# Deploy packages to PackageCloud
- <<: *deploy
repository: "1_7"
- <<: *deploy
repository: "1_9"
- <<: *deploy
repository: "1_10"
- <<: *deploy
repository: "2x"
- <<: *deploy
repository: "2_2"

deploy:
# Deploy packages to PackageCloud from master branch
- provider: packagecloud
username: tarantool
repository: "1_7"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
branch: master
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
- provider: packagecloud
username: tarantool
repository: "1_9"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
branch: master
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
- provider: packagecloud
username: tarantool
repository: "1_10"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
branch: master
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
- provider: packagecloud
username: tarantool
repository: "2x"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
branch: master
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
- provider: packagecloud
username: tarantool
repository: "2_2"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
branch: master
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
# Deploy packages to PackageCloud from tags
# see:
# * https://github.com/tarantool/tarantool/issues/3745
# * https://github.com/travis-ci/travis-ci/issues/7780#issuecomment-302389370
- provider: packagecloud
username: tarantool
repository: "1_7"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
tags: true
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
- provider: packagecloud
username: tarantool
repository: "1_9"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
tags: true
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
- provider: packagecloud
username: tarantool
repository: "1_10"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
tags: true
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
- provider: packagecloud
username: tarantool
repository: "2x"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
tags: true
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
- provider: packagecloud
username: tarantool
repository: "2_2"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{deb,rpm}
skip_cleanup: true
on:
tags: true
condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"
jobs:
include:
- <<: *test
env: TARANTOOL_VERSION=1.10
- <<: *test
env: TARANTOOL_VERSION=2x

- <<: *packpack
env: OS=el DIST=6
- <<: *packpack
env: OS=el DIST=7
- <<: *packpack
env: OS=fedora DIST=26
- <<: *packpack
env: OS=fedora DIST=27
- <<: *packpack
env: OS=fedora DIST=28
- <<: *packpack
env: OS=fedora DIST=29
- <<: *packpack
env: OS=ubuntu DIST=trusty
- <<: *packpack
env: OS=ubuntu DIST=xenial
- <<: *packpack
env: OS=ubuntu DIST=bionic
- <<: *packpack
env: OS=ubuntu DIST=cosmic
- <<: *packpack
env: OS=debian DIST=jessie
- <<: *packpack
env: OS=debian DIST=stretch

notifications:
email:
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Added options `log_requests` and `log_errors` to `route()` method for customizing request log output and error log output respectively.
### Added
- Major rewrite since version 1.x
- Ability to be used with internal http server and an nginx upstream module
(without modifying the backend code)
- Standardized request object (similar to WSGI)
- A new router with route priorities inspired by Mojolicious
- Middleware support (for e.g. for centrally handling authorization)

## [1.0.3] - 2018-06-29
### Added
Expand Down
31 changes: 30 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,40 @@ enable_testing()
set (LUA_PATH "LUA_PATH=${PROJECT_SOURCE_DIR}/?.lua\\;${PROJECT_SOURCE_DIR}/?/init.lua\\;\\;")
set (LUA_SOURCE_DIR "LUA_SOURCE_DIR=${PROJECT_SOURCE_DIR}")

add_test(http ${CMAKE_SOURCE_DIR}/test/http.test.lua)
add_test(http ${CMAKE_SOURCE_DIR}/.rocks/bin/luatest)

set_tests_properties(http PROPERTIES ENVIRONMENT "${LUA_PATH};${LUA_SOURCE_DIR}")

# Add `make check`
add_custom_target(check
WORKING_DIRECTORY ${PROJECT_BUILD_DIR}
COMMAND ctest -V)

## VERSION ####################################################################
###############################################################################

execute_process(
COMMAND git describe --tags --always
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE GIT_DESCRIBE
ERROR_QUIET
)

if (NOT GIT_DESCRIBE)
set(GIT_DESCRIBE "unknown")
endif()

configure_file (
"${PROJECT_SOURCE_DIR}/http/VERSION.lua.in"
"${CMAKE_CURRENT_BINARY_DIR}/VERSION.lua"
)


## Install ####################################################################
###############################################################################

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION.lua
DESTINATION ${TARANTOOL_INSTALL_LUADIR}/${PROJECT_NAME}/
)
Loading