ResourceHub API. Not for production. Get/Post, Json Serialize/Deserialize
This commit is contained in:
3
ResourceHub/Database/.env
Normal file
3
ResourceHub/Database/.env
Normal file
@@ -0,0 +1,3 @@
|
||||
REDIS_PORT=7878
|
||||
REDIS_PASSWORD=fswerfds
|
||||
|
||||
15
ResourceHub/Database/docker-compose.yml
Normal file
15
ResourceHub/Database/docker-compose.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
services:
|
||||
cache:
|
||||
image: redis:7.4-alpine
|
||||
restart: always
|
||||
ports:
|
||||
- "${REDIS_PORT}:6379" # port_on_public:port_in_docker_container
|
||||
command: redis-server --save 20 1 --loglevel warning --requirepass ${REDIS_PASSWORD}
|
||||
volumes:
|
||||
- cache:/data
|
||||
environment:
|
||||
- REDIS_PASSWORD=${REDIS_PASSWORD} # Optional, if you will use it in the container
|
||||
- REDIS_PORT=${REDIS_PORT}
|
||||
volumes:
|
||||
cache:
|
||||
driver: local
|
||||
34
ResourceHub/Database/run.sh
Executable file
34
ResourceHub/Database/run.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if .env file already exists
|
||||
if [ -f .env ]; then
|
||||
echo ".env file already exists. Starting Docker Compose..."
|
||||
else
|
||||
# Prompt the user for the Redis password
|
||||
read -p "Set a Redis port: " REDIS_PORT
|
||||
read -p "Enter your new Redis password: " REDIS_PASSWORD
|
||||
echo
|
||||
|
||||
# Create the .env file and write the password
|
||||
cat <<EOL > .env
|
||||
REDIS_PORT=$REDIS_PORT
|
||||
REDIS_PASSWORD=$REDIS_PASSWORD
|
||||
|
||||
EOL
|
||||
|
||||
# Inform the user
|
||||
|
||||
echo ".env file created"
|
||||
echo
|
||||
echo "--------------------------------------------------------------"
|
||||
echo "Redis Database accesed with URI: http://127.0.0.1:$REDIS_PORT"
|
||||
echo "Redis password is: $REDIS_PASSWORD"
|
||||
echo "--------------------------------------------------------------"
|
||||
fi
|
||||
|
||||
# Start Docker Compose
|
||||
docker-compose up -d
|
||||
|
||||
# show docker container
|
||||
echo
|
||||
docker ps
|
||||
1
ResourceHub/Database/stop.sh
Executable file
1
ResourceHub/Database/stop.sh
Executable file
@@ -0,0 +1 @@
|
||||
docker-compose down
|
||||
Reference in New Issue
Block a user