Giter Site home page Giter Site logo

anchor's Introduction

WHAT IS ANCHOR?

Anchor is Pow-like DNS responder and port forwarding service. Unlike Pow, Anchor does not have a built-in webserver and won't launch web process for you. You have to run your own development webserver and Anchor will simply forward all requests from .dev domain to any port you defined.

INSTALLATION

Installing Anchor is still somewhat complex at its current state. If you feel advantageous enough, you may follow these instructions. Please make sure you have Python 2.6 (or higher) and pip installed on your system.

Anchor is targeted for Mac OS X but may also work with other UNIX-like systems (you have to use 127.0.0.1:29430 as a DNS server and forward port 80 to 29431).

Try it at your own risk.

Installation on Mac OS X

  1. pip install git+https://github.com/sirn/anchor.git

  2. Create /etc/resolver/dev with following contents:

     nameserver 127.0.0.1
     port 29430
    

    Pow users may have this file created, if you no longer use Pow you can delete it.

  3. In your root directory create /Library/LaunchDaemons/com.gridth.anchorconfig.plist with following contents:

     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     <plist version="1.0">
     <dict>
         <key>Label</key>
         <string>com.gridth.anchorconfig</string>
         <key>ProgramArguments</key>
         <array>
             <string>sh</string>
             <string>-c</string>
             <string>ipfw add fwd 127.0.0.1,29431 tcp from any to me dst-port 80 in &amp;&amp; sysctl -w net.inet.ip.forwarding=1</string>
         </array>
         <key>UserName</key>
         <string>root</string>
         <key>RunAtLoad</key>
         <true />
     </dict>
     </plist>
    
  4. In your home directory create ~/Library/LaunchAgents/com.gridth.anchor.plist with following contents:

     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     <plist>
     <dict>
         <key>Label</key>
         <string>com.gridth.anchor</string>
         <key>ProgramArguments</key>
         <array>
             <string>python</string>
             <string>-m</string>
             <string>anchor</string>
         </array>
         <key>KeepAlive</key>
         <true />
         <key>RunAtLoad</key>
         <true />
     </dict>
     </plist>
    

    You may want to change <string>python</strong> if you're using VirtualEnv.

  5. Run launchctl load -w /Library/LaunchDaemons/com.gridth.anchorconfig.plist and launchctl load -w ~/Library/LaunchAgents/com.gridth.anchor.plist.

USAGE

Put a site configuration file in .anchor/ directory in your home directory. The configuration file must have at least [anchor] declared. For example:

[anchor]
aliases = www
port = 3000

[images]
directory = /srv/http/anchor/images/

Everything in anchor section are mapped to naked domain using filename as its domain: [anchor] section in mysite.conf is mapped to mysite.dev, for example. You may also create subdomain with a new section (in the example above images.mysite.dev will serve static contents from directory) or aliases using aliases directive.

Currently there are three directives available:

  • aliases space-separated list of subdomain aliases.
  • port specify port to to forward.
  • directory serve static content from the following directory.

directory directive and port directive can't be used together.

NOTES

Port usage:

  • 29430 DNS responder
  • 29431 HTTP reverse proxy

Distributed under MIT license.

anchor's People

Contributors

sirn avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.