docs: :memo: Add docker-compose.yml and improve doc #17
Tim Izzo tim@octree.ch
Fri, 28 Jul 2023 18:09:59 +0200
4 files changed,
45 insertions(+),
6 deletions(-)
M
README.md
→
README.md
@@ -32,12 +32,17 @@ ```
### Run with Docker +First, create containers with Docker-Compose: + ```shell -docker build -t caroster . -cp backend/.env.example backend/.env -nano .env # Edit with your own configuration -docker run -d -p 80:80 --env-file backend/.env caroster +docker-compose up ``` + +Wait a few minutes while the application downloads needed packages, +then go to http://localhost:8080. + +You can log on http://localhost:8080/admin with email `admin@example.org` +and password `caroster`. ## Development
M
backend/.env.example
→
backend/.env.example
@@ -1,4 +1,4 @@
-STRAPI_URL=http://localhost:8080 +STRAPI_URL=http://localhost:1337 HOST=0.0.0.0 APP_KEYS="toBeModified1,toBeModified2" API_TOKEN_SALT=tobemodified
M
backend/config/database.ts
→
backend/config/database.ts
@@ -4,7 +4,7 @@ client: "postgres",
connection: { host: env("DATABASE_HOST", "127.0.0.1"), port: env.int("DATABASE_PORT", 5432), - database: env("DATABASE_NAME", "caroster-v4"), + database: env("DATABASE_NAME", "caroster"), user: env("DATABASE_USERNAME", "postgres"), password: env("DATABASE_PASSWORD", "password"), ssl: env.bool("DATABASE_SSL", false),
A
docker-compose.yml
@@ -0,0 +1,34 @@
+version: "3" +services: + app: + image: octree/caroster + build: + context: . + ports: + - 8080:80 + environment: + STRAPI_URL: http://localhost:8080 + DATABASE_HOST: psql + DATABASE_NAME: caroster + DATABASE_USERNAME: postgres + DATABASE_PASSWORD: 6Akfg28GAU + APP_KEYS: toBeModified1,toBeModified2 + API_TOKEN_SALT: tobemodified + ADMIN_JWT_SECRET: tobemodified + JWT_SECRET: tobemodified + INIT_ADMIN_USERNAME: admin + INIT_ADMIN_PASSWORD: caroster + INIT_ADMIN_FIRSTNAME: Admin + INIT_ADMIN_LASTNAME: Caroster + INIT_ADMIN_EMAIL: admin@example.org + + psql: + image: postgres + volumes: + - psql_data:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: 6Akfg28GAU + POSTGRES_DB: caroster + +volumes: + psql_data: