Skip to content

Commit 612c42d

Browse files
committed
[devenv] updated to ubuntu 22 and mysql 8 with minor fixes
1 parent 991f03a commit 612c42d

9 files changed

+29
-21
lines changed

.devcontainer/docker-compose.yml

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
version: '3.7'
2-
3-
41
services:
52

63
kt:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
## How to install KT
77

8-
You need [Docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/) installed on your machine.
8+
You need [Docker](https://docs.docker.com/install/) installed on your machine.
99

1010
Install KT with this script:
1111
```

docker/dev/Dockerfile

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
FROM ubuntu:18.04
1+
FROM ubuntu:22.04
22

33
RUN apt-get update && apt-get install -y \
4-
python-minimal \
4+
python2-dev \
55
python-pip \
6-
libmysqlclient-dev
6+
libmysqlclient-dev \
7+
libjpeg-dev
8+
9+
# Client programs should only need to #include the <mysql.h> header file.
10+
# In particular, <my_config.h> should not be needed, and is no longer installed.
11+
# https://stackoverflow.com/a/69382475
12+
RUN ln -s /usr/include/mysql/mysql.h /usr/include/mysql/my_config.h
713

814
COPY requirements.txt /tmp/
9-
RUN pip install -r /tmp/requirements.txt
15+
RUN python2 -m pip install -r /tmp/requirements.txt
1016

1117
WORKDIR /app
1218

13-
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
19+
CMD ["python2", "manage.py", "runserver", "0.0.0.0:8000"]

docker/dev/docker-compose.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
version: '3.7'
2-
3-
41
services:
52

63
kt:
@@ -12,16 +9,23 @@ services:
129
ports:
1310
- '8000:8000'
1411
depends_on:
15-
- db
12+
db:
13+
condition: service_healthy
1614

1715
db:
18-
image: mysql:5.7
16+
image: mysql:8.0
1917
environment:
2018
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
2119
volumes:
2220
- type: volume
2321
source: db-data
2422
target: /var/lib/mysql
23+
healthcheck:
24+
test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD
25+
start_period: 5s
26+
interval: 5s
27+
timeout: 5s
28+
retries: 10
2529

2630

2731
volumes:

scripts/create-dev-db.sql

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CREATE DATABASE ktdb_dev CHARACTER SET utf8 COLLATE utf8_hungarian_ci;
2-
GRANT ALL ON ktdb_dev.* TO ktadmin@'%' IDENTIFIED BY 'password';
2+
CREATE USER IF NOT EXISTS ktadmin@'%' IDENTIFIED BY 'password';
3+
GRANT ALL ON ktdb_dev.* TO ktadmin@'%';
34
FLUSH PRIVILEGES;

scripts/init-dev-db.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ DC_FILE="${__root_dir}/docker/dev/docker-compose.yml"
88
PROJECT_NAME="kt-dev"
99

1010
function dc {
11-
docker-compose -f "${DC_FILE}" -p "${PROJECT_NAME}" "$@"
11+
docker compose -f "${DC_FILE}" -p "${PROJECT_NAME}" "$@"
1212
}
1313

1414
function stop_system {
@@ -26,11 +26,11 @@ KT_CONTAINER_ID=$(dc ps -q kt)
2626
sleep 5 # TODO: wait until logline "mysqld: ready for connections"
2727
docker exec -i "${DB_CONTAINER_ID}" mysql -u root < "${__dir}/create-dev-db.sql"
2828
sleep 5 # TODO: why is some waiting needed?
29-
docker exec "${KT_CONTAINER_ID}" python manage.py migrate
29+
docker exec "${KT_CONTAINER_ID}" python2 manage.py migrate
3030
echo 'Initialized.'
3131

3232
echo 'Loading test data...'
33-
docker exec "${KT_CONTAINER_ID}" python manage.py loaddata fixtures/initial_data.json
33+
docker exec "${KT_CONTAINER_ID}" python2 manage.py loaddata fixtures/initial_data.json
3434
echo 'Loaded'
3535

3636
# NOTE: trap is doing "dc down"

scripts/show-logs.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44
__root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
55

66

7-
docker-compose \
7+
docker compose \
88
-f "${__root_dir}/docker/dev/docker-compose.yml" \
99
-p kt-dev \
1010
logs -f --tail=20 kt

scripts/start-dev.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44
__root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
55

66

7-
docker-compose \
7+
docker compose \
88
-f "${__root_dir}/docker/dev/docker-compose.yml" \
99
-p kt-dev \
1010
up -d

scripts/stop-dev.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44
__root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
55

66

7-
docker-compose \
7+
docker compose \
88
-f "${__root_dir}/docker/dev/docker-compose.yml" \
99
-p kt-dev \
1010
down

0 commit comments

Comments
 (0)