BC Archaeology Branch Arches configuration, schemas and extensions for the BC Archaeology Portal.
- Docker Desktop
- Create a directory called
bcap
- Open a terminal and navigate to the
bcap
directory - Run the following to clone the repositories required for this project:
git clone https://github.com/bcgov/arches-dependency-containers
git clone https://github.com/bcgov/arches
git clone https://github.com/bcgov/arches_common
git clone https://github.com/bcgov/nr-bcap
- You should now have the following directory structure:
.
└── 📁 bcap/
├── 📁 arches-dependency-containers/
├── 📁 arches/
├── 📁 arches_common/
└── 📁 nr-bcap/
- Open or navigate to the
bcap
directory in the terminal - Run the following command:
cd arches && git checkout stable/7.6.4.1_bcgov
- We need to load the base dependencies needed for Arches (i.e., Postgres, Elasticsearch, Redis, etc).
- Open or navigate to the
bcap
directory in the terminal - Run the following command to setup the project's dependencies:
cd arches-dependency-containers/arches-7-5-2 && docker compose up -d
- An .env file
- Open or navigate to the
bcap
directory in the terminal - Run the following command:
cd nr-bcap && docker compose up -d
- Let the
bcap7-6
container fully load (i.e., watch the "Logs" tab). There will be a warning about missing environment variables.- You will see:
django.core.exceptions.ImproperlyConfigured: Set the BCGOV_PROXY_PREFIX environment variable
- This can take some time.
- You will see:
- You need to create or move the .env file to
bcap/nr-bcap/.env
- Stop the
bcap-webpack7-6
container - Restart the
bcap7-6
container in Docker Desktop - Open the
bcap7-6
container in Docker Desktop - Go to the "Exec" tab and run the following:
bash
cd bcap && mkdir logs
- Restart the
bcap7-6
container in Docker Desktop
- Create
test_user_list.py
inbcap/nr-bcap/bcap/management/data/test_user_list.py
- Put the following function in the
test_user_list.py
file if you do not have an IDIR username/password:
def get_user_list():
return [
{
"name": "testuser123",
"email": "test@email.com",
"password": "Test12345!",
"is_superuser": True,
"is_staff": True,
"first_name": "Test",
"last_name": "User",
"groups": [
"Resource Editor",
"Resource Reviewer",
"Archaeology Branch",
"Resource Exporter"
]
}
]
- Put the following function in the
test_user_list.py
file if you do have an IDIR username/password:
def get_user_list():
return [
{
"name": "<idir username>@idir",
"email": "<email>",
"password": "Test12345!",
"is_superuser": True,
"is_staff": True,
"first_name": "<first name>",
"last_name": "<last name>",
"groups": [
"Resource Editor",
"Resource Reviewer",
"Archaeology Branch",
"Resource Exporter",
],
},
]
- The password is a dummy password so it can be left as is.
- OIDC is used so when authenticating you will use your IDIR username and password.
- The
@idir
suffix is necessary - The
<idir username>
must be in lowercase
- Start and open the
bcap7-6
container in Docker Desktop - Go to the "Exec" tab and run the following:
python3.11 manage.py bc_test_users --refresh
-
Open the "Inspect" tab in the container
-
Ctrl + F
forNetworks
and look forIPAddress
-
Copy the IP Address and open the
bcap/nr-bcap/.env
file -
Add the IP Address to the
AUTH_BYPASS_HOSTS
variable:AUTH_BYPASS_HOSTS = ... ... <IPAddress>
-
Open the
bcap7-6
container in Docker Desktop -
Go to the "Exec" tab and run the following:
npm run build_development
python3.11 manage.py setup_db
- Open
bcap/nr-bcap/bcap/settings.py
andbcap/nr-bcap/bcap/urls.py
- Find
AUTHENTICATION_BACKENDS
in thesettings.py
file
- Comment out the following:
"oauth2_provider.backends.OAuth2Backend",
"bcap.util.external_oauth_backend.ExternalOauthAuthenticationBackend",
- Uncomment the following:
"django.contrib.auth.backends.ModelBackend"
- Uncomment the following:
"oauth2_provider.backends.OAuth2Backend",
"bcap.util.external_oauth_backend.ExternalOauthAuthenticationBackend",
- Comment out the following:
"django.contrib.auth.backends.ModelBackend"
- You must also add the secret to the
OAUTH_CLIENT_SECRET
variable in the .env file
-
Go to the
urls.py
file -
If you are using...
- Django Auth, then comment out the following:
- OAuth2, then uncomment the following:
re_path(
bc_path_prefix(r"^admin/login/$"),
ExternalOauth.start,
name="external_oauth_start",
),
re_path(
bc_path_prefix(r"^auth/$"),
ExternalOauth.start,
name="external_oauth_start"
),
re_path(
bc_path_prefix(r"^auth/eoauth_cb$"),
ExternalOauth.callback,
name="external_oauth_callback",
),
re_path(
bc_path_prefix(r"^auth/eoauth_start$"),
ExternalOauth.start,
name="external_oauth_start",
),
re_path(
bc_path_prefix(r"^unauthorized/"),
UnauthorizedView.as_view(),
name="unauthorized",
),
- You should now be able to access BCAP at http://localhost:82/bcap
- If it doesn't work, then open or navigate to the
bcap
directory in the terminal - Restart the
bcap7-6
container or run the following command:
cd nr-bcap && docker compose up -d
- After logging into BCAP, the map will initially be blank.
- You must navigate to the "System Settings" from the menu on the left-hand side, and enter your
Mapbox
token there.
- You must navigate to the "System Settings" from the menu on the left-hand side, and enter your
- RabbitMQ is not being used
- We do not use the Django template engine, therefore changes to the Django code need to be rebuilt with the webpack