Skip to content

fossasia/eventyay

Repository files navigation

eventyay-tickets (ENext)

Project status & release cycle

Welcome to the Eventyay project! The ticketing component of the system provides options for ticket sales and event-related items such as T-shirts. Eventyay has been in development since 2014. Its ticketing component is based on a fork of Pretix.

ENext is the new and updated version of Eventyay with a unified codebase for the Tickets, Talk, and Videos components.

External Dependencies

The deb-packages.txt file lists Debian packages we need to install. If you are using Debian / Ubuntu, you can install them quickly with this command:

For traditional shell:

$ xargs -a deb-packages.txt sudo apt install

For Nushell:

> open deb-packages.txt | lines | sudo apt install ...$in

If you are using other Linux distros, please guess the corresponding package names for that list.

Other than that, please install uv, the Python package manager.

Getting Started

  1. Clone the repository:
git clone https://github.com/fossasia/eventyay.git
  1. Enter the project directory and app directory:
cd eventyay/app
  1. Switch to the `enext` branch:
git switch enext
  1. Install Python packages

Use uv to create virtual environment and install Python packages at the same time. Make sure you are in app directory

uv sync --all-extras --all-groups
  1. Create a PostgreSQL database

The default database name that the project needs is eventyay-db. If you are using Linux, the simplest way to work with database is to use its "peer" mode (no need to remember password).

Create a Postgres user with the same name as your Linux user:

sudo -u postgres createuser -s $USER

(-s means superuser)

Then just create a database owned by your user:

createdb eventyay-db

From now on, you can do everything with the database without specifying password, host and port.

psql eventyay-db

In case you cannot take advantage of PostgreSQL peer mode, you need to create a eventyay.local.toml file with these values:

postgres_user = 'your_db_user'
postgres_password = 'your_db_password'
postgres_host = 'localhost'
postgres_port = 5432
  1. Install and run Redis
  2. Activate virtual environment

After running uv sync`, activate a virtual environment

. .venv/bin/activate
  1. Initialize the database:
python manage.py migrate
  1. Create a admin user account (for accessing the admin panel):
python manage.py create_admin_user
  1. Run the development server:
python manage.py runserver

Notes: If you get permission errors for eventyay/static/CACHE, make sure that the directory and all below it are own by you.

Docker based development

We assume your current working directory is the checkout of this repo.

  1. Create .env.dev

    cp deployment/env.dev-sample .env.dev
  2. Edit .env.dev

    Only if necessary

  3. Make sure you don't have some old volumes hanging around

    This is only necessary the first time, or if you have strange behaviour. This removes the database volume and triggers a complete reinitialization. After that, you have to run migrate and createsuperuser again!

docker volume rm eventyay_postgres_data_dev eventyay_static_volume
  1. Build and run the images

    docker compose up -d --build
  2. Create a superuser account (for accessing the admin panel):

    This should be necessary only once, since the database is persisted as docker volume. If you see strange behaviour, see the point 3. on how to reset.

docker exec -ti eventyay-next-web python manage.py createsuperuser
  1. Visit the site
Open http://localhost:8000 in a browser.
  1. Checking the logs
docker compose logs -f
  1. Shut down

    To shut down the development docker deployment, run

docker compose down

The directory app/eventyay is mounted into the docker, thus live editing is supported.

Configuration

Our configuration are based on TOML files. First of all, check the BaseSettings class in app/eventyay/config/next_settings.py for possible keys and original values. Other than that, the configuration is divided to three running environments:

  • development: With default values in eventyay.development.toml.
  • production: With default values in eventyay.production.toml.
  • testing: With default values in eventyay.testing.toml.

The values in these files will override ones in BaseSettings.

Running environment is selected via the EVY_RUNNING_ENVIRONMENT environment variable. It is pre-set in manage.py, wsgi.py and asgi.py. For example, if you want to run a command in production environment, you can do:

EVY_RUNNING_ENVIRONMENT=production ./manage.py command

How to override the configuration values

  • Create a file named eventyay.local.toml in the same folder as manage.py file.

  • Add only the values you want to override in this file. For example, to override the debug value in production environment, you only need to add one line:

    debug = true
  • You can also override values via environment variables. The environment variable names are the upper case versions of the setting keys, prefixed by EVY_. For example, to override the debug value in production environment, you can set the environment variable EVY_DEBUG to true.

    export EVY_DEBUG=true
  • Dotenv (.env) file is also supported, but please be aware that the values from .env file will be overriden by environment variables.

  • Sensitive data like passwords, API keys should be provided via files in .secrets directory, each file for a key. The file name follows the pattern of environment variable names above (with prefix), the file content is the value. For example, to provide a value for the secret_key setting, you should create a file named EVY_SECRET_KEY and put the value inside.

  • If you deployed the app via Docker containers, you can provide the secret data via Docker secrets.

Why TOML?

TOML has rich data types. In comparison with ini format that this project used before, ini doesn't have "list" type, we had to define a convention to encode lists in strings. This method is not portable, not understood by other tools and libraries, and error-prone. TOML has dedicated syntax for lists, making it easier to read and write such configurations, and developers can use different tools and libraries without worrying about incompatibility.

Due to this reason, overriding configuration via environment variables are not encouraged. The environment variables only have one data type: string!

Deployment

  • copy all of the deployment directory onto the server (eg. as /home/fossasia/enext)

  • prepare the used volumes in docker-compose: one for static files and one for the postgres database. Create on the server:

    /home/fossasia/enext/data/static /home/fossasia/enext/data/postgres

    and

    chown 100:101 /home/fossasia/enext/data/static

  • copy env.prod-sample to .env in /home/fossasia/enext, and edit it to your liking

  • copy nginx/enext-direct to your system /etc/nginx/sites-available The file needs to be adjusted if the enext dir is NOT in /home/fossasia!

  • Link the enext-direct file into /etc/nginx/sites-enabled

  • Restart nginx

  • Run

    docker compose up -d

Support

This project is free and open-source software. Professional support is available to customers of the hosted Eventyay service or Eventyay enterprise offerings. If you are interested in commercial support, hosting services, or supporting this project financially, please go to eventyay.com.

Contributing

Please look through our issues and start contributing.

License

The code in this repository is published under the terms of the Apache 2 License. See the LICENSE file for the complete license text.

This project is maintained by FOSSASIA. See the AUTHORS file for a list of all the awesome contributors of this project.