Modifying justfile scripts
This commit is contained in:
parent
7c0fdd142f
commit
132da145c8
1 changed files with 25 additions and 6 deletions
31
justfile
31
justfile
|
@ -1,9 +1,9 @@
|
|||
pg_pass := "password"
|
||||
pg_user := "postgres"
|
||||
pg_container := "postgres"
|
||||
pg_container := "postgres-frostbyte" # This is the name of the postgres container
|
||||
pg_port := "5432"
|
||||
network := "fb_network"
|
||||
db_name := "frostbyte"
|
||||
db_name := "frostbyte" # This is the name of the database
|
||||
|
||||
conn_string := "postgres://" + pg_user + ":" + pg_pass + "@" + pg_container + ":" + pg_port / db_name
|
||||
conn_local := "postgres://" + pg_user + ":" + pg_pass + "@" + "localhost" + ":" + pg_port / db_name
|
||||
|
@ -24,6 +24,7 @@ build-container-server-debug:
|
|||
start-debug: start-postgres-dev clean-podman init-sqlx build-container-server-debug
|
||||
podman network create {{network}} --ignore
|
||||
podman run -d --network {{network}} -e {{env_string}} -p 8080:8080 --name frostbyte-debug fb-server-debug
|
||||
podman ps | grep frostbyte-debug
|
||||
@echo "Debug server started."
|
||||
|
||||
# Builds a release container
|
||||
|
@ -36,12 +37,15 @@ start-release: start-postgres-dev clean-podman init-sqlx build-container-release
|
|||
podman run -d --network {{network}} -e {{env_string}} -p 8080:8080 --name frostbyte fb-server
|
||||
|
||||
# Initializes the database, runs migrations and then prepares sqlx
|
||||
[private]
|
||||
init-sqlx: install-sqlx
|
||||
echo {{env_local}} > server/.env
|
||||
cd server && sqlx database create --connect-timeout 40 # Postgres takes a while to start up
|
||||
cd server && sqlx migrate run
|
||||
cd server && cargo sqlx prepare
|
||||
cd server && cargo sqlx prepare # If this fails, try running just clean
|
||||
|
||||
# Shorthand for installing sqlx
|
||||
[private]
|
||||
install-sqlx:
|
||||
cargo install sqlx-cli
|
||||
|
||||
|
@ -61,18 +65,33 @@ clean-podman:
|
|||
podman container rm -f frostbyte
|
||||
podman container rm -f frostbyte-debug
|
||||
|
||||
# Removes the database container
|
||||
[private]
|
||||
clean-db:
|
||||
podman container rm -f {{pg_container}}
|
||||
|
||||
# Removes the network
|
||||
[private]
|
||||
clean-network:
|
||||
podman network rm -f {{network}}
|
||||
|
||||
# Forcefully removes the frostbyte images
|
||||
[private]
|
||||
clean-images:
|
||||
podman image rm -f fb-server
|
||||
podman image rm -f fb-server-debug
|
||||
podman image rm -f postgres
|
||||
|
||||
# Cleans up everything related to the project
|
||||
clean: clean-podman clean-images
|
||||
rm -rf client/dist
|
||||
rm -rf client/node_modules
|
||||
clean: clean-podman clean-db clean-images clean-network && state
|
||||
rm -rf client-solid/dist
|
||||
rm -rf client-solid/node_modules
|
||||
rm -rf server/public
|
||||
rm -rf server/target
|
||||
@echo "Cleaned up! Make sure to clean up podman volumes and networks."
|
||||
|
||||
state:
|
||||
podman ps -a
|
||||
podman images ls -a
|
||||
podman network ls
|
||||
du -sch client* server
|
||||
|
|
Loading…
Reference in a new issue