Sets new users to trial by default and docs improvements (#1536)

* Sets new users to trial by default

* Update README.md

* Update README.md

* Docs improvements

* Adds migration
pull/1488/head^2
Omar López 2022-01-17 12:42:38 -07:00 committed by GitHub
parent 55f25d9194
commit 103877737e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 45 deletions

View File

@ -1,10 +1,12 @@
{
"recommendations": [
"DavidAnson.vscode-markdownlint", // markdown linting
"yzhang.markdown-all-in-one", // nicer markdown support
"esbenp.prettier-vscode", // prettier plugin
"dbaeumer.vscode-eslint", // eslint plugin
"bradlc.vscode-tailwindcss", // hinting / autocompletion for tailwind
"heybourn.headwind", // automatically sort tailwind classes in predictable order, kinda like "prettier for tailwind",
"ban.spellright", // Spell check for docs
"stripe.vscode-stripe" // stripe VSCode extension
]
}

View File

@ -6,5 +6,7 @@
"source.fixAll.eslint": true
},
"eslint.run": "onSave",
"typescript.preferences.importModuleSpecifier": "non-relative"
"typescript.preferences.importModuleSpecifier": "non-relative",
"spellright.language": ["en"],
"spellright.documentTypes": ["markdown"]
}

113
README.md
View File

@ -39,7 +39,7 @@
<img width="100%" alt="booking-screen" src="https://user-images.githubusercontent.com/8019099/134363898-4b29e18f-3e61-42b7-95bc-10891056249d.gif">
# Scheduling infrastructure for absolutely everyone.
# Scheduling infrastructure for absolutely everyone
The open source Calendly alternative. You are in charge
of your own data, workflow and appearance.
@ -48,7 +48,7 @@ Calendly and other scheduling tools are awesome. It made our lives massively eas
That's where Cal.com comes in. Self-hosted or hosted by us. White-label by design. API-driven and ready to be deployed on your own domain. Full control of your events and data.
### Product of the Month: April
## Product of the Month: April
#### Support us on [Product Hunt](https://www.producthunt.com/posts/calendso?utm_source=badge-top-post-badge&utm_medium=badge&utm_souce=badge-calendso)
@ -81,45 +81,55 @@ Here is what you need to be able to run Cal.
- PostgreSQL
- Yarn _(recommended)_
You will also need Google API credentials. You can get this from the [Google API Console](https://console.cloud.google.com/apis/dashboard). More details on this can be found below under the [Obtaining the Google API Credentials section](#Obtaining-the-Google-API-Credentials).
> If you want to enable any of the available integrations, you may want to obtain additional credentials for each one. More details on this can be found below under the [integrations section](#integrations).
## Development
### Setup
1. Clone the repo
```sh
git clone https://github.com/calendso/calendso.git
```
1. Go to the project folder
```sh
cd calendso
```
1. Copy `.env.example` to `.env`
```sh
cp .env.example .env
```
1. Install packages with yarn
```sh
yarn
```
#### Quick start with `yarn dx`
> - **Requires Docker and Docker Compose to be installed**
> - Will start a local Postgres instance with a few test users - the credentials will be logged in the console
```bash
git clone git@github.com:calendso/calendso.git
cd calendso
yarn
cp .env.example .env
```sh
yarn dx
```
#### Manual
#### Manual setup
1. Clone the repo
```sh
git clone https://github.com/calendso/calendso.git
```
2. Install packages with yarn
```sh
yarn install
```
3. Copy `.env.example` to `.env`
4. Configure environment variables in the .env file. Replace `<user>`, `<pass>`, `<db-host>`, `<db-port>` with their applicable values
1. Configure environment variables in the .env file. Replace `<user>`, `<pass>`, `<db-host>`, `<db-port>` with their applicable values
```
DATABASE_URL='postgresql://<user>:<pass>@<db-host>:<db-port>'
GOOGLE_API_CREDENTIALS='secret'
```
<details>
<summary>If you don't know how to configure the DATABASE_URL, then follow the steps here</summary>
<summary>If you don't know how to configure the DATABASE_URL, then follow the steps here to create a quick DB using Heroku</summary>
1. Create a free account with [Heroku](https://www.heroku.com/).
@ -145,26 +155,35 @@ yarn dx
8. To view your DB, once you add new data in Prisma, you can use [Heroku Data Explorer](https://heroku-data-explorer.herokuapp.com/).
</details>
5. Set up the database using the Prisma schema (found in `prisma/schema.prisma`)
1. Set a 32 character random string in your .env file for the `CALENDSO_ENCRYPTION_KEY` (You can use a command like `openssl rand -base64 24` to generate one).
1. Set up the database using the Prisma schema (found in `prisma/schema.prisma`)
```sh
npx prisma migrate deploy
```
6. Run (in development mode)
1. Run (in development mode)
```sh
yarn dev
```
7. Open [Prisma Studio](https://www.prisma.io/studio) to look at or modify the database content:
```
#### Setting up your first user
1. Open [Prisma Studio](https://www.prisma.io/studio) to look at or modify the database content:
```sh
npx prisma studio
```
8. Click on the `User` model to add a new user record.
9. Fill out the fields `email`, `username`, `password`, and set `metadata` to empty `{}` (remembering to encrypt your password with [BCrypt](https://bcrypt-generator.com/)) and click `Save 1 Record` to create your first user.
10. Open a browser to [http://localhost:3000](http://localhost:3000) and login with your just created, first user.
11. Set a 32 character random string in your .env file for the CALENDSO_ENCRYPTION_KEY.
1. Click on the `User` model to add a new user record.
1. Fill out the fields `email`, `username`, `password`, and set `metadata` to empty `{}` (remembering to encrypt your password with [BCrypt](https://bcrypt-generator.com/)) and click `Save 1 Record` to create your first user.
> New users are set on a `TRIAL` plan by default. You might want to adjust this behavior to your needs in the `prisma/schema.prisma` file.
1. Open a browser to [http://localhost:3000](http://localhost:3000) and login with your just created, first user.
### E2E-Testing
```bash
```sh
# In first terminal
yarn dx
# In second terminal
@ -174,14 +193,16 @@ yarn test-playwright
### Upgrading from earlier versions
1. Pull the current version:
```
```sh
git pull
```
2. Apply database migrations by running <b>one of</b> the following commands:
In a development environment, run:
```
```sh
npx prisma migrate dev
```
@ -189,7 +210,7 @@ yarn test-playwright
In a production environment, run:
```
```sh
npx prisma migrate deploy
```
@ -203,14 +224,18 @@ yarn test-playwright
```
4. Start the server. In a development environment, just do:
```
```sh
yarn dev
```
For a production build, run for example:
```
```sh
yarn build
yarn start
```
5. Enjoy the new version.
<!-- DEPLOYMENT -->
@ -249,7 +274,9 @@ Contributions are what make the open source community such an amazing place to b
5. Push to the branch (`git push origin feature/AmazingFeature`)
6. Open a pull request
## Obtaining the Google API Credentials
## Integrations
### Obtaining the Google API Credentials
1. Open [Google API Console](https://console.cloud.google.com/apis/dashboard). If you don't have a project in your Google Cloud subscription, you'll need to create one before proceeding further. Under Dashboard pane, select Enable APIS and Services.
2. In the search box, type calendar and select the Google Calendar API search result.
@ -263,7 +290,7 @@ Contributions are what make the open source community such an amazing place to b
10. The key will be created and you will be redirected back to the Credentials page. Select the newly generated client ID under OAuth 2.0 Client IDs.
11. Select Download JSON. Copy the contents of this file and paste the entire JSON string in the .env file as the value for GOOGLE_API_CREDENTIALS key.
## Obtaining Microsoft Graph Client ID and Secret
### Obtaining Microsoft Graph Client ID and Secret
1. Open [Azure App Registration](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps) and select New registration
2. Name your application
@ -272,7 +299,7 @@ Contributions are what make the open source community such an amazing place to b
5. Use **Application (client) ID** as the **MS_GRAPH_CLIENT_ID** attribute value in .env
6. Click **Certificates & secrets** create a new client secret and use the value as the **MS_GRAPH_CLIENT_SECRET** attribute
## Obtaining Zoom Client ID and Secret
### Obtaining Zoom Client ID and Secret
1. Open [Zoom Marketplace](https://marketplace.zoom.us/) and sign in with your Zoom account.
2. On the upper right, click "Develop" => "Build App".
@ -288,12 +315,12 @@ Contributions are what make the open source community such an amazing place to b
12. Click "Done".
13. You're good to go. Now you can easily add your Zoom integration in the Cal.com settings.
## Obtaining Daily API Credentials
### Obtaining Daily API Credentials
1. Open [Daily](https://www.daily.co/) and sign into your account.
2. From within your dashboard, go to the [developers](https://dashboard.daily.co/developers) tab.
3. Copy your API key.
4. Now paste the API key to your .env file into the `DAILY_API_KEY` field in your .env file.
1. Open [Daily](https://www.daily.co/) and sign into your account.
2. From within your dashboard, go to the [developers](https://dashboard.daily.co/developers) tab.
3. Copy your API key.
4. Now paste the API key to your .env file into the `DAILY_API_KEY` field in your .env file.
<!-- LICENSE -->

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "users" ALTER COLUMN "plan" SET DEFAULT E'TRIAL';

View File

@ -121,7 +121,7 @@ model User {
identityProvider IdentityProvider @default(CAL)
identityProviderId String?
invitedTo Int?
plan UserPlan @default(PRO)
plan UserPlan @default(TRIAL)
Schedule Schedule[]
webhooks Webhook[]
brandColor String @default("#292929")