Deploy with Docker
Learn how to deploy AcademyKit with Docker
Docker compose is the easiest way to get started with self-hosted AcademyKit. However if you have database on separately installed, then you might want to use the docker run directly.
Before you begin
You need the following installed in your system:
- Docker
- docker-compose if you want to deploy with docker compose
Prepare the connection string to database as below format
Server={serverAddress};Database={dbName};User={dbUsername};Password={dbPassword};Convert Zero Datetime=True;
and replace {connectionString}
in below command
docker run --name academykit \
-e ConnectionStrings__DefaultConnection="{connectionString}" \
-e JWT__DurationInMinutes=60 \
-e ConnectionStrings__HangfireConnection="{connectionString}Allow User Variables=True;" \
-e Hangfire__User=sysAdmin \
-e Hangfire__Password=sysAdminPassword \
-e AppUrls__App=http://localhost:80 \
-p 80:80 \
--restart always \
academykit/academy:main
Now visit http://localhost:80 to start using AcademyKit.
- Create a docker network
docker network create academy-kit-network
- Run MySQL Change the password, username and container name as required
docker run --name academykit-db \
--network academy-kit-network \
-e MYSQL_ROOT_PASSWORD=password \
-e MYSQL_USER=academykit \
-e MYSQL_PASSWORD=password \
-e MYSQL_DATABASE=academykit \
-p 3306:3306 \
--restart always \
mysql:8.0.33
- Run the academyKit Change the environment variables as required.
docker run --name academykit \
--network academy-kit-network \
-e ConnectionStrings__DefaultConnection="Server=academykit-db;Database=academykit;User=academykit;Password=password;Convert Zero Datetime=True;" \
-e JWT__DurationInMinutes=60 \
-e ConnectionStrings__HangfireConnection="Server=academykit-db;Database=academykit;User=academykit;Password=password;Convert Zero Datetime=True;Allow User Variables=True;" \
-e Hangfire__User=sysAdmin \
-e Hangfire__Password=pwadfssw0rd \
-e AppUrls__App=http://localhost:80 \
-p 80:80 \
--restart always \
academykit/academy:main
Now visit http://localhost:80 to start using AcademyKit.
Docker compose is the easiest way to get started with self-hosted AcademyKit.
Quick Start
-
Create
docker-compose.yml
inside a folder as below:docker-compose.ymlversion: "3.9" services: academykit-db: image: mysql:8.0.33 container_name: academykit-db environment: MYSQL_ROOT_PASSWORD: password MYSQL_USER: academykit MYSQL_PASSWORD: password MYSQL_DATABASE: academykit ports: - "3306:3306" restart: always volumes: - academykit-db-data:/var/lib/mysql academykit: image: academykit/academy:main container_name: academykit environment: ConnectionStrings__DefaultConnection: "Server=academykit-db;Database=academykit;User=academykit;Password=password;Convert Zero Datetime=True;" JWT__DurationInMinutes: "60" ConnectionStrings__HangfireConnection: "Server=academykit-db;Database=academykit;User=academykit;Password=password;Convert Zero Datetime=True;Allow User Variables=True;" Hangfire__User: "sysAdmin" Hangfire__Password: "pwadfssw0rd" AppUrls__App: "http://localhost:80" ports: - "80:80" restart: always depends_on: - academykit-db volumes: academykit-db-data:
2. Run the docker compose
```bash
docker compose up
Now visit http://localhost:80 to start using AcademyKit.
Application Configuration
Once app is running, let’s go the configure it.