add env var for password and set up .idea editor
This commit is contained in:
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
9
.idea/ente_setup.iml
generated
Normal file
9
.idea/ente_setup.iml
generated
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="Go" enabled="true" />
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/ente_setup.iml" filepath="$PROJECT_DIR$/.idea/ente_setup.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
12
setup_postgres.sh
Normal file → Executable file
12
setup_postgres.sh
Normal file → Executable file
@ -3,6 +3,12 @@
|
|||||||
# Exit immediately if a command exits with a non-zero status.
|
# Exit immediately if a command exits with a non-zero status.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Check if the DB_PASSWORD environment variable is set
|
||||||
|
if [ -z "$DB_PASSWORD" ]; then
|
||||||
|
echo "The environment variable DB_PASSWORD is not set. Please set it and rerun the script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Update package lists
|
# Update package lists
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
@ -16,8 +22,8 @@ sudo systemctl enable postgresql
|
|||||||
# Switch to the postgres user
|
# Switch to the postgres user
|
||||||
sudo -i -u postgres bash << EOF
|
sudo -i -u postgres bash << EOF
|
||||||
|
|
||||||
# Create user 'ente' with password 'ente_password'
|
# Create user 'ente' with the password from the environment variable
|
||||||
psql -c "CREATE USER ente WITH PASSWORD 'ente_password';"
|
psql -c "CREATE USER ente WITH PASSWORD '$DB_PASSWORD';"
|
||||||
|
|
||||||
# Create a new database owned by 'ente'
|
# Create a new database owned by 'ente'
|
||||||
psql -c "CREATE DATABASE ente_db OWNER ente;"
|
psql -c "CREATE DATABASE ente_db OWNER ente;"
|
||||||
@ -55,6 +61,6 @@ sudo systemctl restart postgresql
|
|||||||
|
|
||||||
# Confirm PostgreSQL is running and listening on the correct port
|
# Confirm PostgreSQL is running and listening on the correct port
|
||||||
sudo systemctl status postgresql
|
sudo systemctl status postgresql
|
||||||
# netstat -plnt | grep postgres
|
netstat -plnt | grep postgres
|
||||||
|
|
||||||
echo "PostgreSQL has been set up successfully with SSL. User 'ente' has been created with access via TCP/IP and SSL."
|
echo "PostgreSQL has been set up successfully with SSL. User 'ente' has been created with access via TCP/IP and SSL."
|
||||||
|
Reference in New Issue
Block a user