airstate/server

By airstate

Updated 10 months ago

The official AirState Server image

Image
Networking
Web servers
Databases & storage
0

2.5K

airstate/server repository overview

Quick Reference

Supported Tags

  • latest
  • 0.1.11, 0.1, 0
  • 0.1.11-alpine, 0.1-alpine, 0-alpine
  • 0.1.11-alpine3.22, 0.1-alpine3.22, 0-alpine3.22

What is AirState?

AirState is a set of open-source SDKs that help you add real-time collaboration and syncing capabilities into your app.

Quickstart: docker-compose.yml

First create a nats-server.conf file in a directory.

server_name: nats

jetstream {
  store_dir: /data/jetstream
  max_file_store: 10Gb
  max_mem_store: 2Gb
}

http: 8222

The following docker-compose.yml file sets up NATS, Valkey, and AirState server for you.

services:
    valkey:
        restart: unless-stopped
        image: bitnami/valkey:8.1.1
        environment:
            ALLOW_EMPTY_PASSWORD: yes
        volumes:
            - target: /bitnami/valkey/data
              source: valkey-data
              type: volume

    nats:
        restart: unless-stopped
        image: nats:2.11.1-alpine3.21

        volumes:
            - source: ./nats-server.conf
              target: /etc/nats/nats-server.conf
              type: bind

            - target: /data
              source: nats-data
              type: volume

        command: ['-c', '/etc/nats/nats-server.conf', '--server_name', 'nats']

    airstate-server:
        restart: unless-stopped
        image: airstate/server:latest
        environment:
            REDIS_URL: redis://valkey:6379
            NATS_URL: nats://nats:4222
        ports:
            - target: 11001
              published: 11001
              protocol: tcp
        depends_on:
            - valkey
            - nats

volumes:
    # named volumes; they aren't removed on `docker compose down`
    valkey-data:
    nats-data:

Get The Image

docker pull airstate/server:latest

Or if you wanna pull a specific tag that has been listed above.

docker pull airstate/server:[TAG]

How To Use This Image

You'd need at minimum a Redis server (we actually recommend Valkey instead), and a NATS server to connect to. Then use the below command to start a AirState server.

docker run \
  -e NATS_URL=nats://localhost:4222 \
  -e REDIS_URL=redis://localhost:6379 \
  -p 11001:11001 \
  airstate/server

Configuration

Environment VariableDescriptionDefaultRequired
NATS_URLNATS server URL-Yes
REDIS_URLRedis/Valkey server URL-Yes
PORTServer port11001No
SHARED_SIGNING_KEYKey to verify your server's JWTs-No
AIRSTATE_CONFIG_API_BASE_URLAPI base URL for your config server-No
DEFAULT_YJS_READ_PERMISSIONAllow YJS read operations (affects SharedState)trueNo
DEFAULT_YJS_WRITE_PERMISSIONAllow YJS write operations (affects SharedState)trueNo
DEFAULT_PRESENCE_JOIN_PERMISSIONAllow users to join presencetrueNo
DEFAULT_PRESENCE_UPDATE_STATE_PERMISSIONAllow users to update their presence statetrueNo
DEFAULT_PRESENCE_READ_PRESENCE_PERMISSIONAllow users to read presence informationtrueNo
DEFAULT_PRESENCE_READ_SUMMARY_PERMISSIONAllow reading presence summariestrueNo
NODE_ENVRuntime environmentproductionNo

License

MIT

Tag summary

Content type

Image

Digest

sha256:f4966ffd5

Size

80.9 MB

Last updated

10 months ago

docker pull airstate/server:3-alpine3.22