From 12db1b0961e178b4e4303226066d4bb4a9dd3691 Mon Sep 17 00:00:00 2001 From: Stanislav Khromov Date: Sun, 9 Oct 2022 21:46:54 +0200 Subject: [PATCH] Improve onboarding docs --- .gitignore | 1 + .nvmrc | 1 + README.md | 51 ++++++++++++++++++++++++++++++++++ docker-compose.development.yml | 25 +++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 .nvmrc create mode 100644 docker-compose.development.yml diff --git a/.gitignore b/.gitignore index 54410324..57eb3c26 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ /.next/ /out/ /prisma/ +prisma # production /build diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..25bf17fc --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 \ No newline at end of file diff --git a/README.md b/README.md index ce9f2bfe..8ad15df4 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,57 @@ docker compose pull docker compose up --force-recreate ``` +## Setting up a local development environment for Umami + +If you want to run Umami locally for development purposes, you can follow these instructions. + +1. Set correct Node version and install dependencies: + +```bash +nvm use +npm i +``` + +2. Run the development Dockerfile which will start PostgreSQL and Adminer (for database administration) + +```bash +docker-compose -f docker-compose.development.yml up +``` + +3. Create an `.env` file with the following content: + +``` +DATABASE_URL=postgresql://umami:umami@localhost:54320/umami +``` + +4. Run: + +```bash +ln -s ./db/postgresql prisma +npm run build-db-client +``` + +This will synlink the schema from `db/postgresql` to `prisma/` and generate your Prisma client. + +5. Run migrations + +```bash +yarn update-db +``` + +6. Start the server + +```bash +yarn dev +``` + +You can now visit: http://localhost:3000/ + +7. Debug database + +An Adminer instance is provided, you can reach it at: +http://localhost:8080/ + ## License MIT diff --git a/docker-compose.development.yml b/docker-compose.development.yml new file mode 100644 index 00000000..b5cc5f77 --- /dev/null +++ b/docker-compose.development.yml @@ -0,0 +1,25 @@ +--- +version: '3' +services: + db: + image: postgres:12-alpine + environment: + POSTGRES_DB: umami + POSTGRES_USER: umami + POSTGRES_PASSWORD: umami + ports: + - "54320:5432" + adminer: + image: michalhosna/adminer + ports: + - 8080:8080 + environment: + ADMINER_DB: umami + ADMINER_DRIVER: pgsql + ADMINER_PASSWORD: umami + ADMINER_SERVER: db + ADMINER_USERNAME: umami + ADMINER_AUTOLOGIN: 1 + ADMINER_NAME: Adminer +volumes: + umami-db-data: \ No newline at end of file