2bttns
  • Getting Started
    • What is 2bttns?
    • Quick Start
    • 🆕You Asked We Listened
  • HOW TO
    • Set up your Console
    • Use the API
    • Build a game
    • Manage game data
    • Integrate game via API
    • Retrieve scores via API
  • References
    • APIs
      • Authentication
      • Generate Game URL
      • Games
      • Game Objects
      • Tags
      • Players
      • Admin
      • Export/Import
    • Command Line Interface (CLI)
      • Install
      • Usage
      • Configuration
  • TUTORIALS
    • ✨Personalize profiles with 2bttns and Next.js
Powered by GitBook
On this page
  • Create using 2bttn-cli new
  • Create admin account
  • Clean Up
  • Environment Variables

Was this helpful?

  1. HOW TO

Set up your Console

PreviousYou Asked We ListenedNextUse the API

Last updated 1 year ago

Was this helpful?

2bttns is a containerized application, seamlessly running in the background through Docker.

When you launch 2bttns/2bttns, you gain access to the Console: a built-in admin panel for creating and hosting interactive games. The Console makes it easy to build one or multiple apps through one dashboard, allowing you to manage data, create games, and much more, all with just a couple of clicks. Follow these steps to quickly set up your development environment using 2bttns.

Create using 2bttn-cli new

With the CLI installed, you can now create a new console.

Follow the steps to configure your Console with your DATABASE_URL. As of now, 2bttns exclusively supports PostgreSQL database.

In your terminal, execute:

Make sure Docker is running!🐳

2bttns-cli new

Behind the scenes, this will:

  • create a docker-compose.yml file in the current directory.

  • launch your Console,

  • apply migrations to your specified database,

  • seed the database with examples (optional)

Create admin account

The next step involves setting up an admin account to access your Console securely.

docker compose exec twobttns 2bttns-cli admin create

💡Helpful Tip: We recommend using the Username/Password authentication method. You can achieve this through the following command, executed inside your container using the 2bttns-cli tool:

You're all set! 🎉

To get started, open your Console at http://localhost:3262/auth/signIn?callbackUrl=/

With your Console setup, you're ready to upload data, develop, and host your games.

Clean Up

You can take down the containers using the following command in the same directory as the docker-compose.yml file:

docker-compose down

Running 2bttns-cli new will install, setup, and run your Console. In the future, to start your 2bttns/2bttns container up again, run:

docker-compose up

Running the Container in the Background

To avoid occupying your terminal window while running the container, include the --detach (or -d) flag like this:

docker-compose up -d

Clearing Persisted Data

If you'd like to clear out the persisted data within your Postgres database without affecting the Docker Volume:

docker volume rm 2bttns-docker-compose_db-data

Note: This command removes the volume that stores your database data. Use with caution as this action cannot be undone.

Environment Variables

You can always change these in your docker-compose.ymlfile at any time. These are the environment variables you can configure for your 2bttns admin console.

Variable Name
Description
Example

DATABASE_URL

The URL of the Postgres database to connect to.

postgresql://username:password@db-hostname:port/db

NEXTAUTH_SECRET

The secret used by NextAuth. You can generate a new secret on the command line with: openssl rand -base64 32

placeholder-secret-remember-to-change

NEXTAUTH_URL

The URL of the 2bttns app.

http://localhost:3262

GITHUB_ID

The GitHub OAuth app ID, if you want to allow admin users to sign in via GitHub.

1234567890

GITHUB_SECRET

The GitHub OAuth app secret that corresponds to your GITHUB_ID.

placeholder-secret-remember-to-change

The image comes pre-configured with a Postgres database for an immediate start with 2bttns. For those preferring their own database, 2bttns automatically sets up necessary schemas and tables when connected.

Your Console is successfully set up and running behind the scenes using Docker.
Create an admin user via the 2bttns CLI (included in docker container)
Open your Console at localhost:3262 and log in.