CodeWithAloha / uipa

Helping submit, track, and share public records requests in Hawaii
http://uipa.org
MIT License
10 stars 6 forks source link

46 updated use GitHub codespaces #103

Open kobebuckley opened 4 months ago

kobebuckley commented 4 months ago

Start a Fresh Codespace ( ~ 5 minutes )

  1. Open a new branch from an issue
  2. Click on the 'Code' Dropdown arrow
  3. Click on the '...' to the right of 'Codespaces'
  4. Select 'New with Options'
  5. Select the proper branch for the issue you will work on > region that is closest to you > then choose '8 core with 32 gb'
  6. Create Codespace & wait for everything to load ( around 5 minutes )
  7. A terminal should open that says ' Finishing up > Running postCreateCommand > and Running PostStartCommand'
  8. Once the 'PostStartCommand' has a Green checkmark > we then follow the next steps

Run the Codespace ( ~ 15 minutes )

Steps based on the 'Quick Start' guide from the 'Getting Started' documentation https://github.com/CodeWithAloha/uipa/blob/main/docs/Getting-Started.md

  1. In a terminal window, run docker ps. (if this is not running, then run docker-compose up)
  2. In another terminal window, yarn build.
  3. In another terminal window, run bash data/seed/init_db.sh.
  4. Enter your email address ( or random fake email ) > Enter a username > Enter at least a 9-character password
  5. In that same terminal window, run python manage.py runserver.
  6. Click on the 'Open in Browser' prompt on the bottom right of your codespace for http://127.0.0.1:8000/ .
russtoku commented 3 months ago

Opening the 46-Update-use-github-codespaces branch in a codespace results in no joy. I can open a terminal but python manage.py check results in an error:

(venv) @russtoku ➜ /workspaces/uipa (46-Updated-use-github-codespaces) $ python manage.py check
/workspaces/uipa/uipa_org/settings/base.py:105: SyntaxWarning: invalid escape sequence '\.'
  greetings=[rec(u"Aloha (?:Mr\.?|Ms\.? .*?)")],
/workspace/venv/lib/python3.12/site-packages/floppyforms/__init__.py:20: UserWarning: Unable to import floppyforms.gis, geometry widgets not available
  warnings.warn(
Traceback (most recent call last):
  File "/workspaces/uipa/manage.py", line 13, in <module>
    execute_from_command_line(sys.argv)
  File "/workspace/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/workspace/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/workspace/venv/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/workspace/venv/lib/python3.12/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/workspace/venv/lib/python3.12/site-packages/django/apps/config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/auth/models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/auth/base_user.py", line 57, in <module>
    class AbstractBaseUser(models.Model):
  File "/workspace/venv/lib/python3.12/site-packages/django/db/models/base.py", line 143, in __new__
    new_class.add_to_class("_meta", Options(meta, app_label))
  File "/workspace/venv/lib/python3.12/site-packages/django/db/models/base.py", line 371, in add_to_class
    value.contribute_to_class(cls, name)
  File "/workspace/venv/lib/python3.12/site-packages/django/db/models/options.py", line 243, in contribute_to_class
    self.db_table, connection.ops.max_name_length()
                   ^^^^^^^^^^^^^^
  File "/workspace/venv/lib/python3.12/site-packages/django/utils/connection.py", line 15, in __getattr__
    return getattr(self._connections[self._alias], item)
                   ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/workspace/venv/lib/python3.12/site-packages/django/utils/connection.py", line 62, in __getitem__
    conn = self.create_connection(alias)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/venv/lib/python3.12/site-packages/django/db/utils.py", line 193, in create_connection
    backend = load_backend(db["ENGINE"])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/venv/lib/python3.12/site-packages/django/db/utils.py", line 113, in load_backend
    return import_module("%s.base" % backend_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 7, in <module>
    from .adapter import PostGISAdapter
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/db/backends/postgis/adapter.py", line 5, in <module>
    from django.contrib.gis.geos import GEOSGeometry
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/geos/__init__.py", line 5, in <module>
    from .collections import (  # NOQA
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/geos/collections.py", line 6, in <module>
    from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/geos/geometry.py", line 8, in <module>
    from django.contrib.gis import gdal
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/gdal/__init__.py", line 28, in <module>
    from django.contrib.gis.gdal.datasource import DataSource
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/gdal/datasource.py", line 40, in <module>
    from django.contrib.gis.gdal.driver import Driver
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
    from django.contrib.gis.gdal.prototypes import ds as vcapi
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
    from django.contrib.gis.gdal.libgdal import lgdal
  File "/workspace/venv/lib/python3.12/site-packages/django/contrib/gis/gdal/libgdal.py", line 64, in <module>
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal3.6.0", "gdal3.5.0", "gdal3.4.0", "gdal3.3.0", "gdal3.2.0", "gdal3.1.0", "gdal3.0.0", "gdal2.4.0", "gdal2.3.0", "gdal2.2.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.

There are libraries that are missing in the dev container.

The database and search engine are not accessible from the dev container.

russtoku commented 3 months ago

What state do we want the dev container to be in after it's been started up and attached to by the GitHub web interface?

I think that there are two audiences with different needs:

The non-developer would like to be able to go to the web app and start playing with it; not open a terminal window and type commands in.

The developer should be OK with opening a terminal window and typing in commands.

I think that both can be accomodated.

It's very important that a document that provides guidance be provided so that new contributors can come up to speed quickly and easily.