This project is a raspberry pi website for my home server with features to control other servers on my home server for ease of use. The aim of this project is to make controlling other servers easier.
This projects is created with:
- NodeJS version: v18.13.0
- ejs version: v3.1.8
- mongoose version: v6.9.0
- express version: v4.18.2
- dotenv version: v16.0.3
Pi website requires the following dependencies to run:
IMPORTANT!!! Please note that if you are going to clone this repository please fork it first. You can clone the repository with the following command:
git clone https://github.com/Cyrof/password_manager_2.0.gitOR You can download the zip file here or the tar file here.
You can get the docker image from here. Use the command given on the page to get the docker image.
You can get the docker image and container from my dockerhub repository here. The detailed installation guide can be found there.
- Steps:
- .env file format
- Step 1 (Create .env file):
- Step 2 (Create database on mongodb):
- Step 3 (Generate hexadecimal secret key):
- Step 4 (Set folder path for sharedfolder page function):
- Step 5 (Set port to use):
- Step 6 (Ngrok authentication token):
- Step 7 (Set git branch for auto readme file url updates):
- Step 8 (set your name for git config)
- Step 9 (set your github email for git config)
- Step 10 (set your github username for git config)
- Step 11 (set your github personal access token)
Copy the following into your .env file and change the following accordingly.
https://24d8-116-87-173-227.ngrok-free.app
SECRET_KEY={hexadecimal_secret_key}
SHARED_FOLDER_PATH={Path_for_sharedfolder}
PORT={port}
AUTH={NgrokAuthenticationToken}
GIT_BRANCH={github_branch}
GIT_NAME={your_name}
GIT_EMAIL={your_github_email}
GIT_UNAME={Your_github_username}
GIT_PAT={your_github_personal_access_token}
Create the .env file in the same directory as the app.js file
OR
If you have downloaded it as a docker image or docker container, create the .env file on your file system first.
Login to mongodb and create a cluster with whatever cluster name.
To do so, navigate to Database Deployments and click the create button to create the cluster.
After creating the cluster, create a database as well as 2 collections named users and sessions in the same database.
To do the following, navigate into the cluster by clicking on the Browse Collection button. Then in Collections tab click on Create Database button to create the database and collections.
After creating the required database and collections, add the following into your .env file by editing the DATABASE_URL https://d86a-116-87-173-227.ngrok-free.app
- Username
- Password
- Cluster Name
- Database Name
Follow this link to generate an encryptiion key with the following parameters:
- 256 bit
- hexadecimal setting: True
After generating the encryptiion key copy it and edit the SECRET_KEY variable.
For this step it may very from user to user. You can either use a created folder or the entire drive for the shared folder directory path. Which ever you have decided on, copy the absolute path and edit the SHARED_FOLDER_PATH variable.
Decide a port to use for use this http server preferably the standard port such as port 8080 or 3000. After you have decided, edit the PORT variable in the .env file.
To get your ngrok authentication token, login to ngrok and click on Your Authtoken. At the top of the page it should display your authentication token. Copy it and edit the AUTH in the .env file.
Set The branch to your main branch on your git hub repository. Get the branch name and edit the GIT_BRANCH variable in the .env file.
IMPORTANT!!! Please note that if you do not setup the required prerequisites the code will not work properly.
Set your own name for git cli config for the docker container to send git hub requests. Edit the GIT_NAME variable in the .env file.
Set your github email for docker container to access github. Edit the GIT_EMAIL variable in the .env file.
Set your github username to create a remote to github repository. Edit the GIT_UNAME variable in the .env file.
To set up your github personal access token, click on this link to have a detailed instructions on how to create a personal access token. After which, copy the personal access token and edit the GIT_PAT variable in the .env file. IMPORTANT!!! Please note that the personal access token is only viewable once. Once your have left or refreshed the page, it will no longer be accessible.
If your have downloaded this project as a docker image or docker container and have created the .env file outside of the project directory, please use this commands to get the .env file into the docker container
$ docker cp {path_to_.env} {container_name}:/usr/scr/app