Skip to content

Commit 232ab3f

Browse files
committed
Add local postgresql instructions
1 parent 9377a65 commit 232ab3f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ If it doesn't work for some reason, you may have to globally install gulp throug
4747
npm install -g gulp
4848
```
4949

50+
### Local Development
51+
* PostgreSQL
52+
You'll need a postgres instance to use as a development DB.
53+
You can use an existing database, like the instance used for the dev branch, use a database on another server, or spin up a container using docker or podman.
54+
To get setup using docker, run
55+
```bash
56+
docker run --name packet-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres
57+
```
58+
After the container starts up, you should be able to connect with the connection string `postgresql://postgres:mysecretpassword@localhost:5432/postgres`, which is the default connection string in `config.env.py`.
59+
Once the container is up, run the following to set up the database tables.
60+
```bash
61+
flask db upgrade
62+
```
63+
5064
### Secrets and configuration
5165
Packet supports 2 primary configuration methods:
5266
1. Environment variables - See `config.env.py` for the expected names and default values.

config.env.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
See the readme for more information
44
"""
55
from distutils.util import strtobool
6-
from os import environ
6+
from os import environ, path, getcwd
77

88
# Flask config
99
DEBUG = False
@@ -25,7 +25,7 @@
2525
OIDC_CLIENT_SECRET = environ.get("PACKET_OIDC_CLIENT_SECRET", "PLEASE_REPLACE_ME")
2626

2727
# SQLAlchemy config
28-
SQLALCHEMY_DATABASE_URI = environ.get("PACKET_DATABASE_URI", None)
28+
SQLALCHEMY_DATABASE_URI = environ.get("PACKET_DATABASE_URI", "postgresql://postgres:mysecretpassword@localhost:5432/postgres")
2929
SQLALCHEMY_TRACK_MODIFICATIONS = False
3030

3131
# LDAP config

0 commit comments

Comments
 (0)