GithubHelp home page GithubHelp logo

rails-lambda / tailscale-extension Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 0.0 1.66 MB

Tailscale Lambda Extension for Containers

License: MIT License

Dockerfile 27.58% Shell 72.42%
aws-lambda containers lambda lambda-extensions tailscale

tailscale-extension's Introduction

Tailscale Lambda Extension for Containers

Inspired by Corey Quinn's tailscale-layer project. This project aims to do the same thing but usable for those working with any Lambda Container runtime language. Our extension has been modified from Corey's upstream work. I have removed verbose logging and event lifecycle hooks. This has reduced startup overhead, duplicate tailscale up calls, and more configuration options.

Installation

We have pre-build container packages which include the Tailscale Lambda Extension within a basic Docker scratch image containing everything needed to copy to your /opt directory. For example:

FROM public.ecr.aws/lambda/ruby:3.2
RUN yum install -y curl
COPY --from=ghcr.io/rails-lambda/tailscale-extension-amzn:1 /opt /opt

โš ๏ธ Make sure curl is installed since the Tailscale Extension script will need it.

Environment Variables

You will need to generate an ephemeral key within your Tailscale account. Note, this will expire and need updating depending on the time period you select. List of the environment variables include:

  • TS_KEY - Required. Your ephemeral key.
  • TS_HOSTNAME - Optional. The value of --hostname parameter. Default lambda.

OSs & Architectures

We publish multi-platform images for both linux/amd64 and linux/arm64/v8 and we also have Amazon Linux 2 and Debian/Ubuntu variants.

  • ghcr.io/rails-lambda/tailscale-extension-amzn
  • ghcr.io/rails-lambda/tailscale-extension-debian

Example Usage

๐Ÿ“š Using Tailscale on Lambda for a Live Development Proxy

Once your Lambda function starts, you will have a SOCKS5 proxy which can communicate with your Tailscale tailnet at http://localhost:1055. Here is an example of how to leverage that with Ruby's socksify gem.

Net::HTTP.socks_proxy('localhost', 1055).start(...) do |http|
  # your http code here...
end

Again, this extension is not coupled to any runtime language. So how you use the SOCKS5 proxy is up to you. Enjoy!

tailscale-extension's People

Contributors

metaskills avatar quinnypig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tailscale-extension's Issues

tailscale is outdated

Hi,

First of all, thanks for all that work.

But when using it as recommended COPY --from=ghcr.io/rails-lambda/tailscale-extension-amzn:1 /opt /opt, tailscale version is 1.44 something and requires update.

Could you publish a new version with updated tailscale, please?

What is the consideration of not turning on --accpet-routes by default

First of all, quite appreciate the work you have done.
Just wondering if we can turn on --accpet-routes by default, or add environment variables to toggle it.

From tailscale point, their default behaviour is also different across the platform -- which I am not 100% sure why, most likely for security considerations.

This is just a opinion query so no PR had bene raised for it... but should be just a 1/2 lines of change of code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.