2.1 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	Docker
- follow the instructions to install docker.
- open terminal and run: docker pull postgres3runmake init_database. It will create the database scheme on remote specified by DATABASE_URL. You can connect you database using pgAdmin.
The information you enter must be the same as the make init_postgres. e.g.
export DB_USER=postgres
export DB_PASSWORD=password
export DB_NAME=flowy
export DB_PORT=5432
Run
By default, Docker images do not expose their ports to the underlying host machine. We need to do it explicitly using the -p flag.
docker run -p 8000:8000 backend
Sqlx
sqlx-cli
Sqlx and Diesel commands
- 
create migration - sqlx: sqlx migrate add $(table)
- diesel: diesel migration generation $(table)
 
- 
run migration - sqlx: sqlx migrate run
- diesel: diesel migration run
 
- 
reset database - sqlx: sqlx database reset
- diesel: diesel database reset
 
offline mode
cargo sqlx prepare -- --bin backend
Type mapping
Q&A
- Receive{ code: 24, kind: Other, message: "Too many open files" } on arbiterafter running cargo test on backend.
This is due to a limit enforced by the operating system on the maximum number of open file descriptors (including sockets) for each process. Raising the file descriptor limit using
ulimit -n 2048to solve this issue. It won't stay after reboot so check on google how to persist that value if you want to.or you can try:
launchctl limit maxfiles 2048 2048launchctl limit maxfilesDon't forget to relaunch your terminal.
 
			
