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

Can't rename db instance #15

Closed
Spy-Shifty opened this issue Mar 22, 2019 · 4 comments
Closed

Can't rename db instance #15

Spy-Shifty opened this issue Mar 22, 2019 · 4 comments

Comments

@Spy-Shifty
Copy link

Spy-Shifty commented Mar 22, 2019

When using docker-compose the database instance has to be "db" because of:

def _update_db_connstring():
    user = os.getenv('GEONODE_DATABASE', 'geonode')
    pwd = os.getenv('GEONODE_DATABASE_PASSWORD', 'geonode')
    dbname = os.getenv('GEONODE_DATABASE', 'geonode')
    connstr = 'postgres://{0}:{1}@db:5432/{2}'.format(
        user,
        pwd,
        dbname
    )
    return connstr


def _update_geodb_connstring():
    geouser = os.getenv('GEONODE_GEODATABASE', 'geonode_data')
    geopwd = os.getenv('GEONODE_GEODATABASE_PASSWORD', 'geonode_data')
    geodbname = os.getenv('GEONODE_GEODATABASE', 'geonode_data')
    geoconnstr = 'postgis://{0}:{1}@db:5432/{2}'.format(
        geouser,
        geopwd,
        geodbname
    )
    return geoconnstr

Please change the code to some thing like this:

def _update_db_connstring():
    geoconnstr = os.getenv('GEONODE_DATABASE_URL', '')
    return geoconnstr


def _update_geodb_connstring():
    geoconnstr = os.getenv('GEONODE_GEODATABASE_URL', '')
    return geoconnstr

Where the environment variables are like:

GEONODE_DATABASE_URL=postgres://geonode:geonode@geoserver-db:5432/geonode
GEONODE_GEODATABASE_URL=postgres://geonode_data:geonode_data@geoserver-db:5432/geonode_data
@francbartoli
Copy link
Member

@Spy-Shifty the database instance is taking the hostname from the service name declared in the docker-compose file. This is by design for docker-compose networking. We actually don't need to have it dynamically defined because it is used only for internal communication among containers. I'm going to close this.

@ingenieroariel
Copy link
Member

ingenieroariel commented Jul 10, 2019 via email

@francbartoli
Copy link
Member

Hi @ingenieroariel no there isn’t but that change doesn’t make sense to me. Why should we make it a variable? What’s the benefit?

@ingenieroariel
Copy link
Member

ingenieroariel commented Jul 10, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants