-
Notifications
You must be signed in to change notification settings - Fork 126
Deploying
This documentation will walk you through the steps to deploy this project on vercel.
- Create Google Cloud project and enable the Google Drive API
- Create service account
- Create shared folder for service account
- Configuring the project
- Configuring .env
- Deploying
To create a Google Cloud project, follow these steps:
- Go to the Google Cloud Platform Console: https://console.cloud.google.com
- Click the Create Project button.
- Enter a project name and click the Create button.
- Go to the Google Drive API Library: https://console.cloud.google.com/apis/library/drive.googleapis.com
- Enable the API
To create service account, follow these steps:
- Go to the Credentials menu on APIs & Services
- Click Create Credentials button then Service account.
- Enter service account name and description, and click Done button.
- Open the service account you created, then go to Keys tab.
- Click Add key button then Create new key, and choose JSON then create.
- Go to base64 encode (https://www.base64encode.org), then encode the content of the JSON (make sure there are no extra space on the end)
- Save this encoded base64 auth, we will use this later.
Shared account are used so we can add share permission to the service account, and also make the search only limited to that folder.
- Go to you Google Drive
- Create new folder, you can name it whatever you like.
- Right click the folder, then click share.
- Add service account email from the JSON files to the people with access, and change the General access to Anyone with the link as viewer.
- Copy the link and take the folder ID. (https://drive.google.com/drive/folders/[id]?usp=sharing)
Fork this project if you haven't, then open /config/gIndex.config.ts
.
Every config have it's own description, but make sure you change the rootFolder with the folder ID you create before.
In the root folder there are .env.example
, you can copy it and name it to .env.local
or .env
and change the value.
There are only 4 keys inside of .env file:
- GD_SERVICE_B64: Encoded base64 that we get from before
-
NEXT_PUBLIC_ENCRYPTION_KEY: 16 characters key that will be used to encrypt the folder / file password.
- If it's empty it will use
next-drive-index
instead. - If it's under 16 characters long, it will add
0
until it's 16 characters. - If it's more than 16 characters long, it will cut the key to 16 characters.
- If it's empty it will use
- NEXT_PUBLIC_SITE_PASSWORD: The password that will be used if you set private index to true in config files.
- NEXT_PUBLIC_VERCEL_URL: WILL BE USED FOR DEV PURPOSE ONLY. Vercel will set this to the project url automatically, so there no need to add this to vercel deployment.
- Open your vercel dashboard
- Click add new > project button
- Select the repository you fork
- On the Environment Variables section, insert all .env content there (you can copy the content and then paste it to automatically populate the .env)
- Deploy and enjoy.
For another service, you can check their own documentation for how to deploy a project. And also, make sure to match fileSizeLimit to your the service limit in gIndex.config.ts