Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1333 as a shop owner i can present free text questions to plans #1335

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
86a223d
wip Fix #1333 Forms Questions during plan sign up
chrisjsimpson May 21, 2024
cd306bf
WIP #1333 add missing null migration
chrisjsimpson May 24, 2024
c915a5c
WIP Fix #1336 simply stop unlinking the database prematurely TODO tes…
chrisjsimpson May 24, 2024
366cfa2
Fix #1336 Fix pytest tests
chrisjsimpson May 25, 2024
df29a75
format tests/conftest.py
chrisjsimpson May 25, 2024
4acda06
wip #1336 Fix tests
chrisjsimpson May 25, 2024
3a5bcce
#1336 include build tools Dockerfile
chrisjsimpson May 25, 2024
a0a6a76
#1336 format black
chrisjsimpson May 25, 2024
65dd4ea
#1336 black format migrations
chrisjsimpson May 25, 2024
c7fd8ae
#1336 seed.sql remove builder module
chrisjsimpson May 25, 2024
b643c36
#1336 drop breakpoint
chrisjsimpson May 28, 2024
7b6979d
Fix #1339 AttributeError: 'BabelConfiguration' object has no attribut…
chrisjsimpson May 28, 2024
44de4c4
#1336 update testing docs SUBSCRIBER_EMAIL_USER
chrisjsimpson May 28, 2024
c524b4f
Merge branch '1333-as-a-shop-owner-i-can-present-free-test-questions-…
chrisjsimpson May 28, 2024
4541fcb
#1333 default subscription answers to empty list
chrisjsimpson May 28, 2024
da6fb90
#1336 update default datetime to use datetime.UTC
chrisjsimpson May 28, 2024
e813368
#1336 e2e/1219_custom_thank_you_url.spec.js
chrisjsimpson May 28, 2024
5c681fc
Fix #1340 check subscribie_checkout_session_id over stripe_subscripti…
chrisjsimpson May 28, 2024
fd9e077
#1333 fix test revert thankyou url verify
chrisjsimpson May 28, 2024
7f74e1d
#1337 fix test private pages
chrisjsimpson May 28, 2024
3620739
#1336 all tests passing
chrisjsimpson May 29, 2024
99bc505
#1333 black format
chrisjsimpson Jun 4, 2024
2416c84
#1333 tidy
chrisjsimpson Jun 4, 2024
3338d35
#1333 black
chrisjsimpson Jun 4, 2024
f213936
#1333 correct entrypoint debug output
chrisjsimpson Jun 4, 2024
085c2cb
Fix #1333 entrypoint listen on port 80 by default
chrisjsimpson Jun 4, 2024
488bdd8
#1333 improve error_handler for 404s
chrisjsimpson Jun 4, 2024
369e1a2
Revert "Fix #1333 entrypoint listen on port 80 by default"
chrisjsimpson Jun 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ draft.toml
charts/
NOTICE
LICENSE
README.md
data.db*
venv
.venv
__pycache__
dist
.git
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ test-results
tests/browser-automated-tests-playwright/index.spec.js-snapshots/*
tests/browser-automated-tests-playwright/worker*
tests/browser-automated-tests-playwright/e2e/*-snapshots
tests/browser-automated-tests-playwright/test-videos/*
subscribie/static/*
subscribie/custom_pages/*
playwright-report
tests/browser-automated-tests-playwright
.terraform
*.pkl
emails
Expand Down
12 changes: 4 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# syntax = docker/dockerfile:experimental
FROM python:3.9-slim-bullseye
FROM python:3.12-slim-bullseye
WORKDIR /usr/src/app
RUN pip install --upgrade pip
RUN apt-get update && apt-get install -y \
libffi-dev libcurl4-openssl-dev bash git gcc sqlite3 \
libffi-dev libcurl4-openssl-dev bash gcc sqlite3 \
build-essential curl

# Rust is required for Building cryptography (TODO turn this into multistage build)
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs > rustup.sh && sh rustup.sh -y
COPY . /usr/src/app/subscribie/
WORKDIR /usr/src/app/subscribie/
RUN --mount=type=cache,target=/root/.cache/pip . $HOME/.cargo/env && pip install -r requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.lock
RUN --mount=type=cache,target=/root/.cache/pip pip install uwsgi
RUN export FLASK_APP=subscribie;
EXPOSE 80
EXPOSE 5000
ENTRYPOINT [ "./entrypoint.sh" ]
1 change: 1 addition & 0 deletions docs/content/en/docs/Architecture/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ locally.
```
export PLAYWRIGHT_HEADLESS=false
export PLAYWRIGHT_HOST=http://127.0.0.1:5000/
export [email protected]
```

#### Run playwright tests:
Expand Down
36 changes: 17 additions & 19 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,30 @@ set -euxo pipefail
export FLASK_APP=subscribie
export FLASK_DEBUG=1

if [ -a .env ]
if [ -a settings.yaml ]
then
echo ".env exists already so not copying from .env.example"
echo "settings.yaml exists already so not copying from settings.yaml.example"
else
echo ".env not found, so copying from .env.example"
cp .env.example .env
echo "settings.yaml not found, so copying from settings.yaml.example"
cp settings.yaml.example settings.yaml
if [ ! -d "modules" ]; then
echo creating modules directory because it didn\'t exit
mkdir modules
fi

# Set DB URI & PATH
sed -i 's#SQLALCHEMY_DATABASE_URI.*#SQLALCHEMY_DATABASE_URI: "sqlite:////usr/src/app/data.db"#g' settings.yaml
sed -i 's#DB_FULL_PATH.*#DB_FULL_PATH: "/usr/src/app/data.db"#g' settings.yaml

# Set static dir
sed -i 's#TEMPLATE_BASE_DIR.*#TEMPLATE_BASE_DIR: "/usr/src/app/subscribie/subscribie/themes/"#g' settings.yaml
sed -i 's#UPLOADED_IMAGES_DEST.*#UPLOADED_IMAGES_DEST: "/usr/src/app/subscribie/subscribie/static/"#g' settings.yaml
fi

# Set DB URI & PATH
sed -i 's#SQLALCHEMY_DATABASE_URI.*#SQLALCHEMY_DATABASE_URI="sqlite:////usr/src/app/data.db"#g' .env
sed -i 's#DB_FULL_PATH.*#DB_FULL_PATH=/usr/src/app/data.db#g' .env

# Set cookie secure flag to false in development
sed -i 's#SESSION_COOKIE_SECURE.*##g' .env
sed -i 's#SESSION_COOKIE_SAMESITE.*#Lax#g' .env

# Remove SERVER_NAME app config in docker environment
sed -i 's#SERVER_NAME.*##g' .env

# Set static dir
sed -i 's#TEMPLATE_BASE_DIR.*#TEMPLATE_BASE_DIR=/usr/src/app/subscribie/subscribie/themes/#g' .env
sed -i 's#UPLOADED_IMAGES_DEST.*#UPLOADED_IMAGES_DEST=/usr/src/app/subscribie/subscribie/static/#g' .env

flask db upgrade

flask initdb

exec uwsgi --http :80 --workers 1 --threads 2 --wsgi-file subscribie.wsgi --touch-chain-reload subscribie.wsgi --chdir /usr/src/app/subscribie/
exec uwsgi --http :5000 --workers 1 --threads 2 --wsgi-file subscribie.wsgi --touch-chain-reload subscribie.wsgi --chdir /usr/src/app/subscribie/

2 changes: 1 addition & 1 deletion migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def process_revision_directives(context, revision, directives):
connection=connection,
target_metadata=target_metadata,
process_revision_directives=process_revision_directives,
**current_app.extensions["migrate"].configure_args
**current_app.extensions["migrate"].configure_args,
)

with context.begin_transaction():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-07 17:49:50.146114

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-04-07 17:33:30.075127

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""association_table_plan_question

Revision ID: 063ddc60bef1
Revises: c5bec71f1499
Create Date: 2024-05-09 22:00:42.022150

"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "063ddc60bef1"
down_revision = "c5bec71f1499"
branch_labels = None
depends_on = None


def upgrade():
op.create_table(
"plan_question_associations",
sa.Column("question_id", sa.Integer(), nullable=True),
sa.Column("plan_id", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(
["plan_id"],
["plan.id"],
),
sa.ForeignKeyConstraint(
["question_id"],
["question.id"],
),
)


def downgrade():
pass
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2020-12-04 14:59:11.346386

"""

from alembic import op


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-05-04 22:55:42.753614

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2020-11-11 12:08:45.878277

"""

from alembic import op
import sqlalchemy as sa

Expand Down
21 changes: 21 additions & 0 deletions migrations/versions/1d4b6d333c16_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""empty message

Revision ID: 1d4b6d333c16
Revises: c7a493cd99d4
Create Date: 2024-05-18 20:05:40.299194

"""

# revision identifiers, used by Alembic.
revision = "1d4b6d333c16"
down_revision = "c7a493cd99d4"
branch_labels = None
depends_on = None


def upgrade():
pass


def downgrade():
pass
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-09-01 19:35:12.241628

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-03-24 22:54:05.568960

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-05-09 21:28:01.250318

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-12-23 14:50:18.143177

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2020-11-02 11:21:21.027943

"""

from alembic import op


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-02-28 23:13:51.486171

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""add order to association_table_plan_question

Revision ID: 3a54f4b1187d
Revises: 1d4b6d333c16
Create Date: 2024-05-19 18:13:11.397272

"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "3a54f4b1187d"
down_revision = "1d4b6d333c16"
branch_labels = None
depends_on = None


def upgrade():
with op.batch_alter_table("plan_question_associations", schema=None) as batch_op:
batch_op.add_column(sa.Column("order", sa.Integer(), nullable=True))


def downgrade():
pass
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-05-31 21:24:34.681376

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2020-09-23 17:17:30.127947

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-11-17 01:07:18.115335

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-02-11 17:21:19.287478

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-06-07 22:47:55.495926

"""

from alembic import op
import sqlalchemy as sa

Expand Down
1 change: 1 addition & 0 deletions migrations/versions/500f2d55c5d3_add_logintoken_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-02-13 00:04:37.827539

"""

from alembic import op
import sqlalchemy as sa

Expand Down
1 change: 1 addition & 0 deletions migrations/versions/53840eddbb0f_add_taxrate_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2021-03-06 17:26:15.092902

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-05-30 01:22:09.158426

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2020-11-02 11:54:29.263880

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""add primary plan_question_associations

Revision ID: 57b068821280
Revises: 3a54f4b1187d
Create Date: 2024-05-19 19:58:41.527688

"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "57b068821280"
down_revision = "3a54f4b1187d"
branch_labels = None
depends_on = None


def upgrade():
with op.batch_alter_table("plan_question_associations", schema=None) as batch_op:
batch_op.alter_column("question_id", existing_type=sa.INTEGER(), nullable=False)
batch_op.alter_column("plan_id", existing_type=sa.INTEGER(), nullable=False)


def downgrade():
pass
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2022-07-25 22:27:45.930134

"""

from alembic import op
import sqlalchemy as sa

Expand Down
Loading
Loading