diff --git a/pgadmin4/pgAdmin on Raspberry Pi. Deploying pgAdmin 4 as a web… by Jaime Martín Agüí Medium(1).md b/pgadmin4/pgAdmin on Raspberry Pi. Deploying pgAdmin 4 as a web… by Jaime Martín Agüí Medium(1).md deleted file mode 100644 index 8ef02fa..0000000 --- a/pgadmin4/pgAdmin on Raspberry Pi. Deploying pgAdmin 4 as a web… by Jaime Martín Agüí Medium(1).md +++ /dev/null @@ -1,53 +0,0 @@ -Additionally, install the following library for improved performance: - -``` -pip install simple-websocket -``` - -Create now the _config\_local.py_ configuration file: - -``` -vim /home/pi/pgadmin4/lib/python3.9/site-packages/pgadmin4/config_local.py -``` - -Paste the following code in the file: - -``` -import osPGADMIN_DEFAULT_EMAIL = ''PGADMIN_DEFAULT_PASSWORD = ''LOG_FILE = '/home/pi/pgadmin4/var/log'SQLITE_PATH = '/home/pi/pgadmin4/var/pgadmin4.db'SESSION_DB_PATH = '/home/pi/pgadmin4/var/sessions'STORAGE_DIR = '/home/pi/pgadmin4/var/storage'DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))AZURE_CREDENTIAL_CACHE_DIR = os.path.join(DATA_DIR, 'azurecredentialcache')DEFAULT_SERVER = '0.0.0.0' -``` - -After these simple steps, we will be able to start pgAdmin by running the following command (remember that the virtual environment has to be activated): - -``` -pgadmin4 -``` - -This will boot a Flask built-in **development** server, with the pgAdmin application running on port **5050**. If we are in the same LAN as the Raspberry Pi, we can access the platform using its private IP, by entering the following direction in our browser: - -``` -http://:5050 -``` - -> _Take into account that this environment_ **_should not be used in production_**_, as it is ment for development purposes and it might not be particularly efficient, stable, or secure. For a production environment, the application should be deployed either behind a webserver running as a reverse proxy, or using the WSGI interface._ - -However, if we want to access pgAdmin from outside the LAN, we will have to configure **port forwarding**, so that the requests arriving at port 5050 of our public IP can reach the Raspberry Pi, where the pgAdmin application is running. - -This can be done from the web-based interface of the router, usually in the NAT settings, under the “Network” section. - -Press enter or click to view image in full size - -![](https://miro.medium.com/v2/resize:fit:700/1*wFr1RPm9dkiUvsPxrweFNw.png) - -In this case, we have defined a new Web Server (HTTP) rule and mapped the external port 5050 to the same port on the private IP address of our Raspberry Pi. - -We can now check that we can access pgAdmin from anywhere over the internet, by entering in the browser the public IP of the network that contains the Raspberry Pi, or the associated hostname (in case we have created it using a Dynamic DNS service) followed by the port: - -``` -http://:5050 -``` - -This will open the pgAdmin platform, in which we can login with the email and password, previously defined in the configuraion file, to start managing our databases. - -## Conclusion - -Setting up pgAdmin 4 on a Raspberry Pi is a really simple process that provides a friendly interface to work with our data and that can considerably enhance our efficiency. Deploying it as a web application allows any user with an internet connection and the appropriate permissions to enter the platform, which makes it a great extra tool for our database server. \ No newline at end of file