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

Add script for creating debian package #3189

Merged
merged 54 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
04bc708
Remove typing to support
silentninja Aug 7, 2023
b134abd
Add debian build scripts
silentninja Aug 7, 2023
b0310ea
Move correct directories when building debian package
silentninja Aug 7, 2023
7f1f3c3
Add changelog
silentninja Aug 7, 2023
0389623
Add the script to build virtualenv
silentninja Aug 7, 2023
5a185f9
Include top level packages to the pyproject folder structure
silentninja Aug 8, 2023
3d487f7
Merge branch 'develop' into add-deb-file-script
silentninja Aug 28, 2023
5c990dd
Include all python modules
silentninja Aug 29, 2023
fbb12f3
Add mathesar service to start gunicorn
silentninja Aug 29, 2023
af5daa1
Remove cruft when building debian packages
silentninja Aug 29, 2023
f22fb29
Convert db/functions and db/sql into python package
silentninja Aug 29, 2023
d76b307
Add __init__.py to mathesar/filters
silentninja Aug 29, 2023
4b6515b
Move currency data file inside mathesar module and load using importlib
silentninja Aug 29, 2023
b4a8ca6
Remove type hints
silentninja Aug 29, 2023
36f50df
Use correct environment file for debian packages
silentninja Aug 29, 2023
2d5121b
Prebuild static files for debian packages
silentninja Aug 29, 2023
0e732ad
Remove .deb packages
silentninja Aug 29, 2023
fa42dfa
Merge branch 'develop' into add-deb-file-script
silentninja Aug 29, 2023
ce947fb
Remove python script for creating debian package using docker
silentninja Aug 29, 2023
da1527e
Add a python start script for running gunicorn server.
silentninja Aug 31, 2023
0ed768c
Fix typings
silentninja Aug 31, 2023
d7231c1
Update startup scripts to call install.py as a mathesar module
silentninja Aug 31, 2023
625e43c
Update startup scripts to call install.py as a mathesar module
silentninja Aug 31, 2023
6c3bea0
Set debian package priority as `optional`
silentninja Sep 5, 2023
17d8e69
Remove cruft comments
silentninja Sep 5, 2023
7e4b83a
Configure the correct media directory when using debian package
silentninja Sep 5, 2023
82cface
Override dh_virtualenv option to use custom build script
silentninja Sep 5, 2023
50ba4ce
Remove docker file for building the debian package as we will be usin…
silentninja Sep 5, 2023
484efb6
Rever back the logo images
silentninja Sep 5, 2023
bd03903
Remove cruft comments
silentninja Sep 5, 2023
aa3ec93
Revert back the logo svg to correct location
silentninja Sep 5, 2023
6836fba
Remove cruft
silentninja Sep 7, 2023
8588bb5
Exclude psycopg2_binary from dependency check
silentninja Sep 7, 2023
e50b59d
Set the default env variables to use localhost as the database url
silentninja Sep 7, 2023
dc7304c
Add txt files as supported file type
silentninja Sep 7, 2023
e6920cc
Add static files
silentninja Sep 7, 2023
d10bc66
Fix string interpolation
silentninja Sep 7, 2023
a6acf54
Fix indent
silentninja Sep 7, 2023
119fa91
Remove the generated static files
silentninja Sep 7, 2023
512acdb
Remove cruft
silentninja Sep 7, 2023
47bfb00
Copy static files correctly before building debian package
silentninja Sep 7, 2023
ec8eb58
Avoid running collectstatic when building debian package
silentninja Sep 7, 2023
c26b5b0
Add /etc/mathesar to list of directories to change permissions when s…
silentninja Sep 7, 2023
5bfbd41
Add instructions for building debian package
silentninja Sep 8, 2023
5d1649f
Remove setting debug mode by default on debian packages
silentninja Sep 8, 2023
9167957
Revert back addition of nondeterminism stripping
silentninja Sep 8, 2023
abd055e
Remove unused imports
silentninja Sep 8, 2023
7c97542
Add python3-distutils as a dependency
silentninja Sep 8, 2023
84e9340
Merge branch 'develop' into add-deb-file-script
silentninja Sep 8, 2023
34894d9
Merge branch 'develop' into add-deb-file-script
silentninja Sep 11, 2023
b77f7a4
Merge branch 'develop' into add-deb-file-script
silentninja Sep 18, 2023
ef22367
Update developer guide to add instructions for setting up debian buil…
silentninja Sep 18, 2023
eb72d67
Merge branch 'develop' into add-deb-file-script
silentninja Sep 19, 2023
a343869
Merge branch 'develop' into add-deb-file-script
silentninja Sep 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,37 @@ See our [Live demo mode](./demo/README.md) guide for more information on enablin
docker exec -it mathesar_db psql -U mathesar
```


## Building Debian package

- On a Debian machine, install the following dependencies

```
sudo apt install debhelper-compat dh-virtualenv libsystemd-dev libpq-dev libicu-dev pkg-config lsb-release python3-dev python3 python3-setuptools python3-pip python3-venv tar
```
- Setup Mathesar build environment.
This step is useful only when testing locally is needed for building static files and for collecting them. We won't have a need for this step while using the build service as it will be using the source code from release assets which will contain these static files


- Install Python and Nodejs preferably on a Linux machine
- Run the following commands to set up the environment

```
python3 -m venv ./mathesar-venv
source ./mathesar-venv/bin/activate
pip install -r requirements.txt
sudo npm install -g npm-force-resolutions
cd mathesar_ui && npm install --unsafe-perm && npm run build
cd ..
python manage.py collectstatic
```

- From the mathesar directory, run the build script to generate the debian package

```
cd release-scripts && source build-debian.sh
```

## Troubleshooting

### Permissions within Windows
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include static *
4 changes: 2 additions & 2 deletions config/settings/common_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ def pipe_delim(pipe_string):
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

# Media files (uploaded by the user)

MEDIA_ROOT = os.path.join(BASE_DIR, '.media/')
DEFAULT_MEDIA_ROOT = os.path.join(BASE_DIR, '.media/')
MEDIA_ROOT = decouple_config('MEDIA_ROOT', default=DEFAULT_MEDIA_ROOT)

MEDIA_URL = "/media/"

Expand Down
Empty file.
Empty file added db/sql/__init__.py
Empty file.
2 changes: 0 additions & 2 deletions db/types/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

class DatabaseType(OrderByIds):

value: str # noqa: NT001

@property
def id(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion db/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class OrderByIds:
A mixin for ordering based on ids; useful at least for type enums in testing.
"""

id: str # noqa: NT001
id = None

def __ge__(self, other):
if self._ordering_supported(other):
Expand Down
2 changes: 1 addition & 1 deletion dev-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ cd mathesar_ui
npm run dev &

cd ..
python install.py -s
python -m mathesar.install --skip-confirm
python manage.py createsuperuser --no-input --username admin --email admin@example.com
python manage.py runserver 0.0.0.0:8000 && fg
4 changes: 2 additions & 2 deletions docs/docs/installation/build-from-source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Then press <kbd>Enter</kbd> to customize this guide with your domain name.
1. Install Mathesar functions on the database:

```sh
python install.py --skip-confirm | tee /tmp/install.py.log
python mathesar/install.py --skip-confirm | tee /tmp/install.py.log
```


Expand Down Expand Up @@ -448,7 +448,7 @@ You'll be prompted to set up an admin user account the first time you open Mathe
1. Update Mathesar functions on the database:

```sh
python install.py --skip-confirm >> /tmp/install.py.log
python mathesar/install.py --skip-confirm >> /tmp/install.py.log
```

1. Restart the gunicorn server
Expand Down
11 changes: 9 additions & 2 deletions mathesar/api/display_options.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import json
from importlib import resources as impresources
from mathesar.database.types import UIType
from mathesar import data


def _money_display_options_schema():
with open("currency_info.json", "r") as info_file:
currency_info = json.load(info_file)
try:
inp_file = (impresources.files(data) / 'currency_info.json')
with inp_file.open("rb") as f: # or "rt" as text file with universal newlines
currency_info = json.load(f)
except AttributeError:
# Python < PY3.9, fall back to method deprecated in PY3.11.
currency_info = json.load(impresources.open_text(data, 'currency_info.json'))
currency_codes = list(currency_info.keys())
return {
"options": [
Expand Down
Empty file added mathesar/data/__init__.py
Empty file.