Skip to content

Commit

Permalink
docker postgres permission issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pan261 committed Feb 12, 2022
1 parent 1e725d2 commit 4bd8af0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@ NGROK_AUTH=[ngrok_auth_token]
- You will also need an ngrok account (free tier works): https://ngrok.com/
- The webhook token can by anything, here is an example: https://forge.autodesk.com/en/docs/webhooks/v1/reference/http/tokens-POST/


## Database
- You will need to install postgres to connect to the server through terminal: `psql -h localhost -p 5432 -d filesync -U user`
- User, password, and db are all configured in the environment file
- To reset the db, delete the /postgres/db_data folder

### File Permission Issues with Docker
- If on WSL, you may need to copy /postgres/wsl.conf into /etc/wsl.conf and restart WSL
- On Linux, you can run `sudo chown -R $USER postgres/db_data/` for any permissions issues after initializing the db
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: "3.8"

services:
ngrok:
container_name: ngrok
image: wernight/ngrok:latest
ports:
- 4040:4040
Expand All @@ -13,15 +14,17 @@ services:
# access through `psql -h localhost -p 5432 -d filesync -U user`, password is 'pass'
# to be able to build after the initializing the db, you may need to run `sudo chown -R $USER db_data/`
database:
container_name: postgres
image: 'postgres:13'
env_file: ./.env
volumes:
- ./postgres/db_data/:/var/lib/postgresql/data/
- ./postgres/db_data/:/var/lib/postgresql/data:z
- ./postgres/init/create_tables.sql:/docker-entrypoint-initdb.d/create_tables.sql
ports:
- ${PORT_DB}:${PORT_DB}

server:
container_name: server
build:
context: .
dockerfile: Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion postgres/init/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS storage (
folder_name VARCHAR(8) NOT NULL,
file_version INT NOT NULL,
fusion_id VARCHAR(50),
PRIMARY KEY (file_name_ext, folder_name)
PRIMARY KEY (file_display_name, folder_name)
);

CREATE TABLE IF NOT EXISTS archive (
Expand Down
16 changes: 16 additions & 0 deletions postgres/wsl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[automount]
enabled = true
options = "metadata,uid=1000,gid=1000,umask=0022,fmask=11,case=off"
mountFsTab = false
crossDistro = true

[filesystem]
umask = 0022

[network]
generateHosts = true
generateResolvConf = true

[interop]
enabled = true
appendWindowsPath = true

0 comments on commit 4bd8af0

Please sign in to comment.