chore: Move API source code to API folder.
This commit is contained in:
parent
8015b0af74
commit
d3a664fea4
59 changed files with 43 additions and 38 deletions
|
@ -18,9 +18,11 @@
|
|||
|
||||
2. Run `nix-shell`, or alternatively `source init.sh` if you're not using Nix.
|
||||
|
||||
3. After that, run the project in development mode: `npm run dev`.
|
||||
<h3 align="center">API Development</h3>
|
||||
|
||||
4. If you want to explore your database, run `npx prisma studio` to open the database editor.
|
||||
1. After that, run the project in development mode: `npm run dev`.
|
||||
|
||||
2. If you want to explore your database, run `npx prisma studio` to open the database editor.
|
||||
|
||||
<h2 align="center">Production Deployment</h2>
|
||||
|
||||
|
@ -36,7 +38,7 @@
|
|||
|
||||
3. Build the docker stack: `docker compose --env-file .env up -d`
|
||||
|
||||
<h3 align="center">Troubleshooting</h3>
|
||||
<h2 align="center">Troubleshooting</h2>
|
||||
|
||||
* I'm using the SSH tunneling, and I can't reach any of the tunnels publicly.
|
||||
- Be sure to enable GatewayPorts in your sshd config (in `/etc/ssh/sshd_config` on most systems). Also, be sure to check your firewall rules on your system and your network.
|
0
.gitignore → api/.gitignore
vendored
0
.gitignore → api/.gitignore
vendored
32
api/init.sh
Executable file
32
api/init.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
if [ ! -d ".tmp" ]; then
|
||||
echo "Hello and welcome to the NextNet (backend) project! Please wait while I initialize things for you..."
|
||||
cp dev.env .env
|
||||
mkdir .tmp
|
||||
fi
|
||||
|
||||
lsof -i:5432 | grep postgres 2> /dev/null > /dev/null
|
||||
IS_PG_RUNNING=$?
|
||||
|
||||
if [ ! -f ".tmp/ispginit" ]; then
|
||||
if [[ "$IS_PG_RUNNING" == 0 ]]; then
|
||||
kill -9 $(lsof -t -i:5432) > /dev/null 2> /dev/null
|
||||
fi
|
||||
|
||||
echo " - Database not initialized! Initializing database..."
|
||||
mkdir .tmp/pglock
|
||||
|
||||
initdb -D .tmp/db
|
||||
pg_ctl -D .tmp/db -l .tmp/logfile -o "--unix_socket_directories='$PWD/.tmp/pglock/'" start
|
||||
createdb -h localhost -p 5432 nextnet
|
||||
|
||||
psql -h localhost -p 5432 nextnet -c "CREATE ROLE nextnet WITH LOGIN SUPERUSER PASSWORD 'nextnet';"
|
||||
|
||||
npm install --save-dev
|
||||
npx prisma migrate dev
|
||||
|
||||
touch .tmp/ispginit
|
||||
elif [[ "$IS_PG_RUNNING" == 1 ]]; then
|
||||
pg_ctl -D .tmp/db -l .tmp/logfile -o "--unix_socket_directories='$PWD/.tmp/pglock/'" start
|
||||
fi
|
||||
|
||||
source .env # Make sure we actually load correctly
|
0
package-lock.json → api/package-lock.json
generated
0
package-lock.json → api/package-lock.json
generated
|
@ -1,9 +1,9 @@
|
|||
services:
|
||||
nextnet:
|
||||
nextnet-api:
|
||||
build:
|
||||
context: "."
|
||||
context: "./api"
|
||||
dockerfile: Dockerfile
|
||||
image: nextnet/latest
|
||||
image: nextnet-api/latest
|
||||
container_name: nextnet-api
|
||||
restart: always
|
||||
ports:
|
||||
|
|
35
init.sh
Executable file → Normal file
35
init.sh
Executable file → Normal file
|
@ -1,32 +1,3 @@
|
|||
if [ ! -d ".tmp" ]; then
|
||||
echo "Hello and welcome to the NextNet project! Please wait while I initialize things for you..."
|
||||
cp dev.env .env
|
||||
mkdir .tmp
|
||||
fi
|
||||
|
||||
lsof -i:5432 | grep postgres 2> /dev/null > /dev/null
|
||||
IS_PG_RUNNING=$?
|
||||
|
||||
if [ ! -f ".tmp/ispginit" ]; then
|
||||
if [[ "$IS_PG_RUNNING" == 0 ]]; then
|
||||
kill -9 $(lsof -t -i:5432) > /dev/null 2> /dev/null
|
||||
fi
|
||||
|
||||
echo " - Database not initialized! Initializing database..."
|
||||
mkdir .tmp/pglock
|
||||
|
||||
initdb -D .tmp/db
|
||||
pg_ctl -D .tmp/db -l .tmp/logfile -o "--unix_socket_directories='$PWD/.tmp/pglock/'" start
|
||||
createdb -h localhost -p 5432 nextnet
|
||||
|
||||
psql -h localhost -p 5432 nextnet -c "CREATE ROLE nextnet WITH LOGIN SUPERUSER PASSWORD 'nextnet';"
|
||||
|
||||
npm install --save-dev
|
||||
npx prisma migrate dev
|
||||
|
||||
touch .tmp/ispginit
|
||||
elif [[ "$IS_PG_RUNNING" == 1 ]]; then
|
||||
pg_ctl -D .tmp/db -l .tmp/logfile -o "--unix_socket_directories='$PWD/.tmp/pglock/'" start
|
||||
fi
|
||||
|
||||
source .env # Make sure we actually load correctly
|
||||
pushd api > /dev/null 2> /dev/null
|
||||
source init.sh
|
||||
popd > /dev/null 2> /dev/null
|
Loading…
Add table
Add a link
Reference in a new issue