Skip to content

Commit 7789dfe

Browse files
authored
Merge branch 'enext' into cfp-flow-movement-preservation
2 parents 71a55f6 + d6b88fc commit 7789dfe

File tree

410 files changed

+2751
-58307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

410 files changed

+2751
-58307
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ src/dist/
1010
.venv
1111
app/.venv
1212
app/eventyay/static/CACHE
13+
app/eventyay/static.dist
14+
*.egg-info
15+
**/__pycache__
16+
**/node_modules

.github/workflows/tests.yml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,34 @@ on:
1414

1515
jobs:
1616
test:
17-
runs-on: ubuntu-22.04
17+
runs-on: ubuntu-24.04
1818
name: Tests
1919
strategy:
2020
matrix:
21-
python-version: [3.11]
22-
database: [sqlite, postgres]
23-
exclude:
24-
- database: sqlite
25-
python-version: 3.11
21+
python-version: [3.12]
22+
database: [postgres]
2623
steps:
2724
- uses: actions/checkout@v4
2825
- uses: harmon758/postgresql-action@v1
2926
with:
30-
postgresql version: '15'
27+
postgresql version: '16'
3128
postgresql db: 'pretix'
3229
postgresql user: 'postgres'
3330
postgresql password: 'postgres'
3431
if: matrix.database == 'postgres'
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v6
34+
with:
35+
version: latest
36+
enable-cache: true
3537
- name: Set up Python ${{ matrix.python-version }}
36-
uses: actions/setup-python@v5
38+
uses: actions/setup-python@v6
3739
with:
3840
python-version: ${{ matrix.python-version }}
39-
- uses: actions/cache@v4
40-
with:
41-
path: ~/.cache/pip
42-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
43-
restore-keys: |
44-
${{ runner.os }}-pip-
4541
- name: Install system dependencies
4642
run: sudo apt update && sudo apt install gettext
4743
- name: Install Python dependencies
48-
run: |
49-
sed -i '/eventyay-stripe/d' pyproject.toml
50-
sed -i '/eventyay-paypal/d' pyproject.toml
51-
pip3 install --ignore-requires-python -e ".[dev]" psycopg2-binary
44+
run: uv sync --all-extras --group test --no-editable
5245
- name: Run checks
5346
run: python manage.py check
5447
working-directory: ./src
@@ -60,10 +53,15 @@ jobs:
6053
run: make all compress
6154
- name: Run tests
6255
working-directory: ./src
63-
run: PRETIX_CONFIG_FILE=tests/travis_${{ matrix.database }}.cfg py.test -n 3 -p no:sugar --cov=./ --cov-report=xml --reruns 3 tests --maxfail=100
56+
run: pytest -n 3 -p no:sugar --cov=./ --cov-report=xml --reruns 3 tests --maxfail=100
6457
- name: Upload coverage
6558
uses: codecov/codecov-action@v1
6659
with:
6760
file: src/coverage.xml
6861
fail_ci_if_error: true
69-
if: matrix.database == 'postgres' && matrix.python-version == '3.11' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master')
62+
if: matrix.database == 'postgres' && matrix.python-version == '3.12' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master')
63+
env:
64+
EVY_POSTGRES_HOST: localhost
65+
EVY_POSTGRES_PORT: 5432
66+
EVY_POSTGRES_USER: postgres
67+
EVY_POSTGRES_DB: pretix

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ deployment/.env.dev
6060
deployment/.env.prod
6161
deployment/.env
6262
deployment/data
63+
*.local.cfg
64+
*.local.toml
65+
.secrets
66+
app/.env
6367

6468
# Emails which are not sent out to Internet are saved here.
6569
dev-sent-emails

README.rst

Lines changed: 98 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
eventyay-tickets (ENext)
22
========================
33

4-
.. image:: https://codecov.io/gh/fossasia/eventyay/branch/enext/graph/badge.svg
5-
:target: https://codecov.io/gh/pretix/pretix
4+
.. image:: https://codecov.io/gh/fossasia/eventyay-tickets/branch/enext/graph/badge.svg
5+
:target: https://codecov.io/gh/pretix/pretix
66

77
Project status & release cycle
88
------------------------------
@@ -12,7 +12,7 @@ Welcome to the **Eventyay** project! The ticketing component of the system provi
1212
ENext is the new and updated version of Eventyay with a unified codebase for the Tickets, Talk, and Videos components.
1313

1414
External Dependencies
15-
---------------------
15+
----------------------
1616

1717
The *deb-packages.txt* file lists Debian packages we need to install.
1818
If you are using Debian / Ubuntu, you can install them quickly with this command:
@@ -21,13 +21,13 @@ For traditional shell:
2121

2222
.. code-block:: bash
2323
24-
$ xargs -a deb-packages.txt sudo apt install
24+
$ xargs -a deb-packages.txt sudo apt install
2525
2626
For Nushell:
2727

2828
.. code-block:: nu
2929
30-
> open deb-packages.txt | lines | sudo apt install ...$in
30+
> open deb-packages.txt | lines | sudo apt install ...$in
3131
3232
3333
If you are using other Linux distros, please guess the corresponding package names for that list.
@@ -39,31 +39,31 @@ Getting Started
3939

4040
1. **Clone the repository**:
4141

42-
.. code-block:: bash
42+
.. code-block:: bash
4343
44-
git clone https://github.com/fossasia/eventyay.git
44+
git clone https://github.com/fossasia/eventyay.git
4545
4646
2. **Enter the project directory and app directory**:
4747

48-
.. code-block:: bash
48+
.. code-block:: bash
4949
50-
cd eventyay/app
50+
cd eventyay/app
5151
5252
3. **Switch to the `enext` branch**:
5353

54-
.. code-block:: bash
54+
.. code-block:: bash
5555
56-
git switch enext
56+
git switch enext
5757
5858
5959
4. **Install Python packages**
6060

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

64-
.. code-block:: sh
64+
.. code-block:: sh
6565
66-
uv sync --all-extras --all-groups
66+
uv sync --all-extras --all-groups
6767
6868
6969
5. **Create a PostgreSQL database**
@@ -75,69 +75,58 @@ Create a Postgres user with the same name as your Linux user:
7575

7676
.. code-block:: sh
7777
78-
sudo -u postgres createuser -s $USER
78+
sudo -u postgres createuser -s $USER
7979
8080
(``-s`` means *superuser*)
8181

8282
Then just create a database owned by your user:
8383

8484
.. code-block:: sh
8585
86-
createdb eventyay-db
86+
createdb eventyay-db
8787
8888
From now on, you can do everything with the database without specifying password, host and port.
8989

9090
.. code-block:: sh
9191
92-
psql eventyay-db
93-
94-
In case you cannot take advantage of PostgreSQL *peer* mode, you need to create a *.env* file with these values:
95-
96-
.. code-block:: sh
97-
98-
POSTGRES_USER=
99-
POSTGRES_PASSWORD=
100-
POSTGRES_HOST=
101-
POSTGRES_PORT=
102-
103-
6. **Activate virtual environment**
92+
psql eventyay-db
10493
105-
After running ``uv sync```, activate a virtual environment
106-
107-
.. code-block:: sh
108-
109-
. .venv/bin/activate
94+
In case you cannot take advantage of PostgreSQL *peer* mode, you need to create a *eventyay.local.toml* file with these values:
11095

96+
.. code-block:: toml
11197
112-
7. **Initialize the database**:
98+
postgres_user = 'your_db_user'
99+
postgres_password = 'your_db_password'
100+
postgres_host = 'localhost'
101+
postgres_port = 5432
113102
114-
.. code-block:: bash
103+
6. **Install and run Redis**
115104

116-
python manage.py migrate
105+
7. **Activate virtual environment**
117106

118-
If you see any Redis issues, Install Redis and start it:
107+
After running ``uv sync```, activate a virtual environment
119108

120-
**Update configuration**
109+
.. code-block:: sh
121110
111+
. .venv/bin/activate
122112
123-
Edit ``app/eventyay.cfg`` and change Redis URLs from
124-
``redis://eventyay-next-redis`` **to**
125-
``redis://localhost:6379/``
113+
8. **Initialize the database**:
126114

115+
.. code-block:: bash
127116
128-
Do **not** edit the database numbers (0, 1, etc.).
117+
python manage.py migrate
129118
130-
8. **Create a admin user account** (for accessing the admin panel):
119+
9. **Create a admin user account** (for accessing the admin panel):
131120

132-
.. code-block:: bash
121+
.. code-block:: bash
133122
134-
python manage.py create_admin_user
123+
python manage.py create_admin_user
135124
136-
9. **Run the development server**:
125+
10. **Run the development server**:
137126

138-
.. code-block:: bash
127+
.. code-block:: bash
139128
140-
python manage.py runserver
129+
python manage.py runserver
141130
142131
143132
Notes: If you get permission errors for eventyay/static/CACHE, make sure that the directory and
@@ -166,7 +155,7 @@ We assume your current working directory is the checkout of this repo.
166155

167156
.. code-block:: bash
168157
169-
docker volume rm eventyay_postgres_data_dev eventyay_static_volume
158+
docker volume rm eventyay_postgres_data_dev eventyay_static_volume
170159

171160
4. **Build and run the images**
172161

@@ -180,31 +169,84 @@ We assume your current working directory is the checkout of this repo.
180169
as docker volume. If you see strange behaviour, see the point 3.
181170
on how to reset.
182171

183-
.. code-block:: bash
172+
.. code-block:: bash
184173
185-
docker exec -ti eventyay-next-web python manage.py createsuperuser
174+
docker exec -ti eventyay-next-web python manage.py createsuperuser
186175

187176
6. **Visit the site**
188177

189-
Open `http://localhost:8000` in a browser.
178+
Open `http://localhost:8000` in a browser.
190179

191180
7. **Checking the logs**
192181

193-
.. code-block:: bash
182+
.. code-block:: bash
194183
195-
docker compose logs -f
184+
docker compose logs -f
196185

197186

198187
8. **Shut down**
199188

200189
To shut down the development docker deployment, run
201190

202-
.. code-block:: bash
191+
.. code-block:: bash
203192
204-
docker compose down
193+
docker compose down
205194

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

197+
Configuration
198+
-------------
199+
200+
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.
201+
Other than that, the configuration is divided to three running environments:
202+
203+
* ``development``: With default values in *eventyay.development.toml*.
204+
* ``production``: With default values in *eventyay.production.toml*.
205+
* ``testing``: With default values in *eventyay.testing.toml*.
206+
207+
The values in these files will override ones in ``BaseSettings``.
208+
209+
Running environment is selected via the ``EVY_RUNNING_ENVIRONMENT`` environment variable. It is pre-set in *manage.py*, *wsgi.py* and *asgi.py*.
210+
For example, if you want to run a command in production environment, you can do:
211+
212+
.. code-block:: bash
213+
214+
EVY_RUNNING_ENVIRONMENT=production ./manage.py command
215+
216+
How to override the configuration values
217+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
218+
219+
- Create a file named *eventyay.local.toml* in the same folder as *manage.py* file.
220+
- 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:
221+
222+
.. code-block:: toml
223+
224+
debug = true
225+
226+
- You can also override values via environment variables. The environment variable names are the upper case versions of the setting keys, prefixed by ``EVY_``.
227+
For example, to override the ``debug`` value in production environment, you can set the environment variable ``EVY_DEBUG`` to ``true``.
228+
229+
.. code-block:: bash
230+
231+
export EVY_DEBUG=true
232+
233+
- Dotenv (*.env*) file is also supported, but please be aware that the values from *.env* file will be overriden by environment variables.
234+
235+
- Sensitive data like passwords, API keys should be provided via files in *.secrets* directory, each file for a key.
236+
The file name follows the pattern of environment variable names above (with prefix), the file content is the value.
237+
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.
238+
239+
- If you deployed the app via Docker containers, you can provide the secret data via `Docker secrets`_.
240+
241+
Why TOML?
242+
~~~~~~~~~
243+
244+
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.
245+
This method is not portable, not understood by other tools and libraries, and error-prone.
246+
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.
247+
248+
Due to this reason, overriding configuration via environment variables are not encouraged. The environment variables only have one data type: string!
249+
208250

209251
Deployment
210252
----------
@@ -247,5 +289,4 @@ This project is maintained by **FOSSASIA**. See the AUTHORS file for a list of a
247289
.. _installation guide: https://docs.eventyay.com/en/latest/admin/installation/index.html
248290
.. _eventyay.com: https://eventyay.com
249291
.. _blog: https://blog.eventyay.com
250-
251-
292+
.. _Docker secrets: https://docs.docker.com/engine/swarm/secrets/

app/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ ENV PYTHONDONTWRITEBYTECODE=1
1010
ENV PYTHONUNBUFFERED=1
1111

1212
# install system dependencies
13-
RUN apt-get update && apt-get install --no-install-recommends -y netcat-traditional git build-essential gettext make npm
13+
RUN apt-get update && apt-get install -y wget gnupg
14+
# Repo for newer NodeJS
15+
RUN wget -qO- https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
16+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" > /etc/apt/sources.list.d/nodesource.list
17+
RUN apt-get update && apt-get install --no-install-recommends -y netcat-traditional git build-essential gettext make nodejs
1418

1519
# copy project files
1620
COPY . .
1721

1822
# install dependencies
1923
RUN --mount=type=cache,target=/root/.cache/uv \
20-
--mount=type=bind,source=uv.lock,target=uv.lock \
21-
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
2224
uv sync --all-extras --all-groups
2325

2426
# copy entrypoint.sh

0 commit comments

Comments
 (0)