Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
laradock
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kerwin
laradock
Commits
4b2c4401
Commit
4b2c4401
authored
Jun 14, 2018
by
KUI\ahkui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add init database
parent
5016e885
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
0 deletions
+36
-0
docker-compose.yml
docker-compose.yml
+1
-0
.gitignore
postgres/docker-entrypoint-initdb.d/.gitignore
+1
-0
createdb.sh.example
postgres/docker-entrypoint-initdb.d/createdb.sh.example
+34
-0
No files found.
docker-compose.yml
View file @
4b2c4401
...
...
@@ -322,6 +322,7 @@ services:
build
:
./postgres
volumes
:
-
${DATA_PATH_HOST}/postgres:/var/lib/postgresql/data
-
${POSTGRES_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d
ports
:
-
"
${POSTGRES_PORT}:5432"
environment
:
...
...
postgres/docker-entrypoint-initdb.d/.gitignore
0 → 100644
View file @
4b2c4401
*.sh
postgres/docker-entrypoint-initdb.d/createdb.sh.example
0 → 100644
View file @
4b2c4401
#!/bin/bash
#
# Copy createdb.sh.example to createdb.sh
# then uncomment then set database name and username to create you need databases
#
# example: .env POSTGRES_USER=appuser and need db name is myshop_db
#
# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
# CREATE USER $POSTGRES_USER;
# CREATE DATABASE myshop_db;
# GRANT ALL PRIVILEGES ON DATABASE myshop_db TO $POSTGRES_USER;
# EOSQL
#
# this sh script will auto run when the postgres container starts and the $DATA_PATH_HOST/postgres not found.
#
set
-e
# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
# CREATE USER db1;
# CREATE DATABASE db1;
# GRANT ALL PRIVILEGES ON DATABASE db1 TO db1;
# EOSQL
# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
# CREATE USER db2;
# CREATE DATABASE db2;
# GRANT ALL PRIVILEGES ON DATABASE db2 TO db2;
# EOSQL
# psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
# CREATE USER db3;
# CREATE DATABASE db3;
# GRANT ALL PRIVILEGES ON DATABASE db3 TO db3;
# EOSQL
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment