Default Component Installed for open source TYK

HI Team,

Can you Please help with below open source TYK related query:

  1. What all components will get installed when we install TYK open source gateway
  2. How to start and stop TYK server.
  3. What’s the default log location and can we change it (if yes then how).
  4. TYK runs as a service on RHEL automatically when we install?

Hi @saloni512 ,

The answers to your questions depend on how you choose to install tyk. I’m going to assume you will be using the RPMS from https://packagecloud.io/tyk/tyk-gateway but please let me know if I’m wrong.

  1. What all components will get installed when we install TYK open source gateway

Only the tyk gateway will be installed if you only install the tyk-gateway package. It will be installed with a sample config and all the necessary systemd startup scripts and some sample/example files. Here are the full package contents

$ sudo rpm -ql tyk-gateway-3.0.7-1.x86_64
/etc/init.d/tyk-gateway
/lib/systemd/system/tyk-gateway.service
/opt/share/docs/tyk-gateway/LICENSE.md
/opt/share/docs/tyk-gateway/README.md
/opt/tyk
/opt/tyk-gateway/apps/app_sample.json
/opt/tyk-gateway/coprocess/README.md
/opt/tyk-gateway/coprocess/api.h
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_common.pb.cc
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_common.pb.h
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_mini_request_object.pb.cc
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_mini_request_object.pb.h
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_object.pb.cc
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_object.pb.h
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_return_overrides.pb.cc
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_return_overrides.pb.h
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_session_state.pb.cc
/opt/tyk-gateway/coprocess/bindings/cpp/coprocess_session_state.pb.h
/opt/tyk-gateway/coprocess/bindings/java/CoprocessCommon.java
/opt/tyk-gateway/coprocess/bindings/java/CoprocessMiniRequestObject.java
/opt/tyk-gateway/coprocess/bindings/java/CoprocessObject.java
/opt/tyk-gateway/coprocess/bindings/java/CoprocessReturnOverrides.java
/opt/tyk-gateway/coprocess/bindings/java/CoprocessSessionState.java
/opt/tyk-gateway/coprocess/bindings/java/DispatcherGrpc.java
/opt/tyk-gateway/coprocess/bindings/python/.gitignore
/opt/tyk-gateway/coprocess/bindings/python/coprocess_common_pb2.py
/opt/tyk-gateway/coprocess/bindings/python/coprocess_grpc_pb2.py
/opt/tyk-gateway/coprocess/bindings/python/coprocess_mini_request_object_pb2.py
/opt/tyk-gateway/coprocess/bindings/python/coprocess_object_pb2.py
/opt/tyk-gateway/coprocess/bindings/python/coprocess_object_pb2_grpc.py
/opt/tyk-gateway/coprocess/bindings/python/coprocess_response_object_pb2.py
/opt/tyk-gateway/coprocess/bindings/python/coprocess_return_overrides_pb2.py
/opt/tyk-gateway/coprocess/bindings/python/coprocess_session_state_pb2.py
/opt/tyk-gateway/coprocess/bindings/python/sample_server.py
/opt/tyk-gateway/coprocess/bindings/ruby/coprocess_common_pb.rb
/opt/tyk-gateway/coprocess/bindings/ruby/coprocess_mini_request_object_pb.rb
/opt/tyk-gateway/coprocess/bindings/ruby/coprocess_object_pb.rb
/opt/tyk-gateway/coprocess/bindings/ruby/coprocess_response_object_pb.rb
/opt/tyk-gateway/coprocess/bindings/ruby/coprocess_return_overrides_pb.rb
/opt/tyk-gateway/coprocess/bindings/ruby/coprocess_session_state_pb.rb
/opt/tyk-gateway/coprocess/bindings/ruby/dispatcher.rb
/opt/tyk-gateway/coprocess/coprocess_common.pb.go
/opt/tyk-gateway/coprocess/coprocess_mini_request_object.pb.go
/opt/tyk-gateway/coprocess/coprocess_object.pb.go
/opt/tyk-gateway/coprocess/coprocess_response_object.pb.go
/opt/tyk-gateway/coprocess/coprocess_return_overrides.pb.go
/opt/tyk-gateway/coprocess/coprocess_session_state.pb.go
/opt/tyk-gateway/coprocess/coprocess_test.go
/opt/tyk-gateway/coprocess/dispatcher.go
/opt/tyk-gateway/coprocess/grpc/README.md
/opt/tyk-gateway/coprocess/grpc/coprocess_grpc_test.go
/opt/tyk-gateway/coprocess/grpc/doc.go
/opt/tyk-gateway/coprocess/grpc/ruby/sample_server.rb
/opt/tyk-gateway/coprocess/lua/README.md
/opt/tyk-gateway/coprocess/lua/binding.h
/opt/tyk-gateway/coprocess/lua/bundle.lua
/opt/tyk-gateway/coprocess/lua/tyk/core.lua
/opt/tyk-gateway/coprocess/lua/tyk/request.lua
/opt/tyk-gateway/coprocess/proto/.python-version
/opt/tyk-gateway/coprocess/proto/codegen.py
/opt/tyk-gateway/coprocess/proto/coprocess_common.proto
/opt/tyk-gateway/coprocess/proto/coprocess_mini_request_object.proto
/opt/tyk-gateway/coprocess/proto/coprocess_object.proto
/opt/tyk-gateway/coprocess/proto/coprocess_response_object.proto
/opt/tyk-gateway/coprocess/proto/coprocess_return_overrides.proto
/opt/tyk-gateway/coprocess/proto/coprocess_session_state.proto
/opt/tyk-gateway/coprocess/proto/update_bindings.sh
/opt/tyk-gateway/coprocess/python/.gitignore
/opt/tyk-gateway/coprocess/python/README.md
/opt/tyk-gateway/coprocess/python/__init__.py
/opt/tyk-gateway/coprocess/python/binding.h
/opt/tyk-gateway/coprocess/python/coprocess_id_extractor_python_test.go
/opt/tyk-gateway/coprocess/python/coprocess_python_test.go
/opt/tyk-gateway/coprocess/python/dispatcher.h
/opt/tyk-gateway/coprocess/python/dispatcher.py
/opt/tyk-gateway/coprocess/python/doc.go
/opt/tyk-gateway/coprocess/python/proto/coprocess_common_pb2.py
/opt/tyk-gateway/coprocess/python/proto/coprocess_grpc_pb2.py
/opt/tyk-gateway/coprocess/python/proto/coprocess_mini_request_object_pb2.py
/opt/tyk-gateway/coprocess/python/proto/coprocess_object_pb2.py
/opt/tyk-gateway/coprocess/python/proto/coprocess_object_pb2_grpc.py
/opt/tyk-gateway/coprocess/python/proto/coprocess_response_object_pb2.py
/opt/tyk-gateway/coprocess/python/proto/coprocess_return_overrides_pb2.py
/opt/tyk-gateway/coprocess/python/proto/coprocess_session_state_pb2.py
/opt/tyk-gateway/coprocess/python/proto/sample_server.py
/opt/tyk-gateway/coprocess/python/tyk/__init__.py
/opt/tyk-gateway/coprocess/python/tyk/decorators.py
/opt/tyk-gateway/coprocess/python/tyk/event.py
/opt/tyk-gateway/coprocess/python/tyk/gateway.py
/opt/tyk-gateway/coprocess/python/tyk/loader.py
/opt/tyk-gateway/coprocess/python/tyk/middleware.py
/opt/tyk-gateway/coprocess/python/tyk/object.py
/opt/tyk-gateway/coprocess/python/tyk/request.py
/opt/tyk-gateway/coprocess/python/tyk/session.py
/opt/tyk-gateway/event_handlers/sample/firebase_test.js
/opt/tyk-gateway/event_handlers/sample/sample_event_handler.js
/opt/tyk-gateway/event_handlers/sample/session_editor.js
/opt/tyk-gateway/install/before_install.sh
/opt/tyk-gateway/install/data/tyk.self_contained.conf
/opt/tyk-gateway/install/data/tyk.standalone.conf
/opt/tyk-gateway/install/data/tyk.with_dash.conf
/opt/tyk-gateway/install/init_local.sh
/opt/tyk-gateway/install/inits/systemd/default/tyk-gateway
/opt/tyk-gateway/install/inits/systemd/system/tyk-gateway-python.service
/opt/tyk-gateway/install/inits/systemd/system/tyk-gateway.service
/opt/tyk-gateway/install/inits/sysv/default/tyk-gateway
/opt/tyk-gateway/install/inits/sysv/default/tyk-gateway-python
/opt/tyk-gateway/install/inits/sysv/init.d/tyk-gateway
/opt/tyk-gateway/install/inits/sysv/init.d/tyk-gateway-python
/opt/tyk-gateway/install/inits/upstart/default/tyk-gateway
/opt/tyk-gateway/install/inits/upstart/init/0.x/tyk-gateway-python.conf
/opt/tyk-gateway/install/inits/upstart/init/0.x/tyk-gateway.conf
/opt/tyk-gateway/install/inits/upstart/init/1.x/tyk-gateway-python.conf
/opt/tyk-gateway/install/inits/upstart/init/1.x/tyk-gateway.conf
/opt/tyk-gateway/install/post_install.sh
/opt/tyk-gateway/install/post_remove.sh
/opt/tyk-gateway/install/post_trans.sh
/opt/tyk-gateway/install/setup.sh
/opt/tyk-gateway/middleware/ottoAuthExample.js
/opt/tyk-gateway/middleware/sampleMiddleware.js
/opt/tyk-gateway/middleware/samplePostProcessMiddleware.js
/opt/tyk-gateway/middleware/samplePreProcessMiddleware.js
/opt/tyk-gateway/middleware/testPostVirtual.js
/opt/tyk-gateway/middleware/testVirtual.js
/opt/tyk-gateway/policies/policies.json
/opt/tyk-gateway/templates/breaker_webhook.json
/opt/tyk-gateway/templates/default_webhook.json
/opt/tyk-gateway/templates/error.json
/opt/tyk-gateway/templates/monitor_template.json
/opt/tyk-gateway/templates/playground/index.html
/opt/tyk-gateway/templates/playground/playground.js
/opt/tyk-gateway/tyk
/opt/tyk-gateway/tyk.conf
  1. How to start and stop TYK server.

The start and stop procedure is the same as for any other systemd service

$ sudo sysctemctl start tyk-gateway
$ sudo systemctl stop tyk-gateway
  1. What’s the default log location and can we change it (if yes then how).

When installed from an RPM and managed by systemd the logs are handled the same way as other systemd services. They can be seen using journalctl

$ sudo journacltl -u tyk-gateway
  1. TYK runs as a service on RHEL automatically when we install?

Yes, the service is enabled and started as it is installed.

$ sudo systemctl list-unit-files tyk-gateway.service
UNIT FILE           STATE
tyk-gateway.service enabled
$ sudo systemctl status tyk-gateway.service
  tyk-gateway.service - Tyk API Gateway
   Loaded: loaded (/usr/lib/systemd/system/tyk-gateway.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-10-27 12:21:48 BST; 8min ago

Cheers,
Pete

Thanks Pete for reverting.

Is it possible to change log location to particular file?

How many days of logs we can have on the tyk server by default? If we want to change log settings then how we can do?

Hi @saloni512 ,

This is a systemd config question rather than really related to tyk so the answer lies in configuring systemd to put the logs where you want them

Here’s a Stack Overflow discussion which deals with the systemd log locations. Have a read and see if it answers your query.

Cheers,
Pete