-
Notifications
You must be signed in to change notification settings - Fork 1
03 ‐ Installation
Important
These installation instructions cover installing and running a development version of the ISS Analysis Tool. This software is a demonstration and should not yet be considered "production-ready" and further development is required to make it suitable to use in a production environment. For further development, please contact the members of Team Noname
Important
You must have Docker and Docker Compose installed on the host computer for everything to work correctly. Both can be obtained by installing Docker Desktop. If you don't want to install Docker Desktop, follow the installation instructions for installing the Docker Engine and Docker Compose separately.
First, clone or download the project repository. Navigate to a suitable directory on the host machine and run one of the following commands:
# Clone via http
git clone https://github.com/4306-team-noname/barrios.git
# or clone via ssh
git clone git@github.com:4306-team-noname/barrios.git
Once the repository has been cloned or downloaded and extracted onto the host machine, navigate to the barrios
directory to install the project's dependencies and initialize the tool's seed data.
cd <installation_dir>/barrios
Note
The top-level barrios/
project directory contains three subdirectories. Only one of these directories is necessary to run the project — the server/
directory. The archive/
directory is included in the repository as evidence of the team's exploratory work, and the assets/
directory is included to serve images and diagrams to the project wiki. You can safely investigate or delete either directory without affecting the application or its ability to run. All other files in the top-level barrios/
directory are necessary.
barrios/
├── archive/ # Exploratory code and prototypes
├── assets/ # Documentation images and diagrams
└── server/ # Real project code (do not delete)
Run these three commands from the top-level barrios/
directory:
# create a virtual environment
python -m venv .venv
# Activate the virtual environment
source .venv/Scripts/activate # On Windows
source .venv/bin/activate # On Mac/Linux
# Install project dependencies
pip install -r requirements.txt
Open barrios/docker-compose.yml
in a text editor and edit line 9
to add your preferred postgres admin password. You can also leave it as it is if you're only evaluating a development version of this app.
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme} # change password to whatever you want
The postgres password will be referred to as <POSTGRES_PASSWORD>
for the remainder of this guide.
While still in the barrios/
directory, run the following to create a containerized Postgres database:
docker-compose up
This will pull the necessary docker images and set them up so you have a PostgreSQL server and a PGAdmin server running.
-
Connect to the database server with PGAdmin
-
- In a browser, navigate to
localhost:5050
(orhttp://127.0.0.1:5050
, if you're feeling verbose). This will open a setup page for PGAdmin. It will ask you to set a master password. Set it to whatever you want.
- In a browser, navigate to
- In
Quick Links
on the front page, clickAdd New Server
. - On the tab labeled
General
, set theName
topostgres
. - In the
Connection
tab, set theHost name/address
topostgres
, the username topostgres
, and the password to<POSTGRES_PASSWORD>
. You can toggleSave password
if you want. - Click
Save
-
-
Set up the database user
- This will add the
postgres
server you loaded from the docker container. In the left sidebar, clickServers
, thenpostgres
to expand the menu. - Right-click on
Login/Group Roles
, then chooseCreate > Login/Group Role...
- In the
General
tab, set the name tobarrios
. - In the
Definition
tab, set the password tobarrios123
- In the
Privileges
tab, turn onCan log in?
- Click
Save
- This will add the
-
Add the database
- In the left sidebar, under
postgres
, right-click onDatabases
and selectCreate > Database...
- In the
General
tab, set theDatabase
tobarrios
, and theOwner
tobarrios
- Click
Save
- In the left sidebar, under
- Navigate to the
barrios/server/barrios
directory. You're going to need to run one script and one Django command. Before running the script, you should make sure that you have the correct permissions to do so. Run this command to change the script's permissions:
chmod 775 resetdb.sh
-
Open the script in a text editor and change the
ADMIN_EMAIL
andADMIN_USERNAME
variables on lines22
and23
. If you don't change it, the admin username (for testing purposes only) will beadmin
, and the email will be `testadmin@example.com. -
Run the script with the command
./resetdb.sh
. It will ask you if you want to proceed. Typeyes
. The script will then attempt to drop all of the data from an existingbarrios
database and reset all the tables to match the application's models. When it's done, it will prompt you for a password. Enter a password.
- Clone the seed data: A collection of seed data is located in a private repository. If you do not have access to this repository, contact Jeff Caldwell fo access.
git clone https://github.com/4306-team-noname/seed-data.git media/seed-data
- From the
barrios/server/barrios
directory, run the following command to seed the database with the Barrios data:
python manage.py init_data
It will list all of the files being loaded. If there are any errors, or any files don't match expected data types, it will tell you. If everything went well, it will output:
n of n files were saved to the database successfully.
All data loaded successfully!
🙭 Good luck out there!
Important
Files uploaded to or seeded to the IMS Analysis Tool database should conform to specifications defined in the CSV Data Guidelines
Now that the setup is all out of the way, it's time to start the server:
python manage.py runserver
Refer to the User Manual for instructions on running the application.