Deployment went ok
$ docker-compose up --build -d
Pulling chromedp (chromedp/headless-shell:)...
latest: Pulling from chromedp/headless-shell
d50302ca539a: Pull complete
69d2c752f612: Pull complete
527878a8f279: Pull complete
1382262a21c8: Pull complete
Digest: sha256:8fd8cbd828b1b438d971808af93df21e9c89f5ecc74e20199649d7a5dd874927
Status: Downloaded newer image for chromedp/headless-shell:latest
Building assassin
Step 1/4 : FROM alpine
latest: Pulling from library/alpine
df20fa9351a1: Pull complete
Digest: sha256:185518070891758909c9f839cf4ca393ee977ac378609f700f60a771a2dfe321
Status: Downloaded newer image for alpine:latest
---> a24bb4013296
Step 2/4 : RUN apk --no-cache add ca-certificates
---> Running in 0dd0bd2e017a
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/1) Installing ca-certificates (20191127-r4)
Executing busybox-1.31.1-r16.trigger
Executing ca-certificates-20191127-r4.trigger
OK: 6 MiB in 15 packages
Removing intermediate container 0dd0bd2e017a
---> e9b7c4088018
Step 3/4 : ADD AssassinGo /
---> 5fc9fbed4823
Step 4/4 : CMD [ "./AssassinGo" ]
---> Running in 997d69792b5a
Removing intermediate container 997d69792b5a
---> ac5b8168c24b
Successfully built ac5b8168c24b
Successfully tagged assassingo_assassin:latest
Creating assassingo_mariadb_1 ... done
Creating assassingo_chromedp_1 ... done
Creating assassingo_assassin_1 ... done
but impossible to connect to the DB
$ cat backup.sql | docker exec -i assassingo_mariadb_1 /usr/bin/mysql -uroot --password=assassingo ag
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
$ cat backup.sql | docker exec -i assassingo_mariadb_1 /usr/bin/mysql -uag --password=password ag
ERROR 1045 (28000): Access denied for user 'ag'@'localhost' (using password: YES)
It's weird because it's exactly the creds in docker-compose.yml
version: '3'
services:
assassin:
build: .
ports:
- 8000:8000
links:
- mariadb
- chromedp
volumes:
- ./web/:/web/
- ./dict/:/dict/
environment:
- DB_Db=ag
- DB_User=ag
- DB_Passwd=password
- SecretKey=biubiubiu
mariadb:
image: mariadb
expose:
- "3306"
environment:
- MYSQL_ROOT_PASSWORD=assassingo
- MYSQL_DATABASE=ag
- MYSQL_USER=ag
- MYSQL_PASSWORD=password
chromedp:
image: chromedp/headless-shell
ports:
- 9222:9222
Let's attach to the container and see what happens:
$ docker exec -it assassingo_mariadb_1 /bin/bash
We can connect without password with root acount but not with the password so we must ommit the -p
option.
root@baf5f6902c5a:/# mysql -u root
MariaDB [(none)]> use mysql;
MariaDB [mysql]> select host,user,password from user;
+--------------+------+----------+
| Host | User | Password |
+--------------+------+----------+
| localhost | root | |
| baf5f6902c5a | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| baf5f6902c5a | | |
+--------------+------+----------+
Ok so it seems the stuff in docker-compose.yml
was never set.
I removed all containers and rebuilt them without attaching to see what happens. Here I filtered only mariadb logs:
mariadb_1 | 2020-07-05 14:15:23+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server started.
mariadb_1 | 2020-07-05 14:15:23+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mariadb_1 | 2020-07-05 14:15:23+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server started.
mariadb_1 | 2020-07-05 14:15:24+00:00 [Note] [Entrypoint]: Initializing database files
mariadb_1 |
mariadb_1 |
mariadb_1 | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
mariadb_1 | To do so, start the server, then issue the following commands:
mariadb_1 |
mariadb_1 | '/usr/bin/mysqladmin' -u root password 'new-password'
mariadb_1 | '/usr/bin/mysqladmin' -u root -h password 'new-password'
mariadb_1 |
mariadb_1 | Alternatively you can run:
mariadb_1 | '/usr/bin/mysql_secure_installation'
mariadb_1 |
mariadb_1 | which will also give you the option of removing the test
mariadb_1 | databases and anonymous user created by default. This is
mariadb_1 | strongly recommended for production servers.
mariadb_1 |
mariadb_1 | See the MariaDB Knowledgebase at http://mariadb.com/kb or the
mariadb_1 | MySQL manual for more instructions.
mariadb_1 |
mariadb_1 | Please report any problems at http://mariadb.org/jira
mariadb_1 |
mariadb_1 | The latest information about MariaDB is available at http://mariadb.org/.
mariadb_1 | You can find additional information about the MySQL part at:
mariadb_1 | http://dev.mysql.com
mariadb_1 | Consider joining MariaDB's strong and vibrant community:
mariadb_1 | https://mariadb.org/get-involved/
mariadb_1 |
mariadb_1 | 2020-07-05 14:16:01+00:00 [Note] [Entrypoint]: Database files initialized
mariadb_1 | 2020-07-05 14:16:01+00:00 [Note] [Entrypoint]: Starting temporary server
mariadb_1 | 2020-07-05 14:16:01+00:00 [Note] [Entrypoint]: Waiting for server startup
mariadb_1 | 2020-07-05 14:16:01 0 [Note] mysqld (mysqld 10.4.10-MariaDB-1:10.4.10+maria~bionic) starting as process 124 ...
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Using Linux native AIO
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Uses event mutexes
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Number of pools: 1
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Using SSE2 crc32 instructions
mariadb_1 | 2020-07-05 14:16:01 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Completed initialization of buffer pool
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Creating shared tablespace for temporary tables
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Waiting for purge to start
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: 10.4.10 started; log sequence number 140103; transaction id 21
mariadb_1 | 2020-07-05 14:16:01 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mariadb_1 | 2020-07-05 14:16:01 0 [Note] Plugin 'FEEDBACK' is disabled.
mariadb_1 | 2020-07-05 14:16:02 0 [Warning] 'user' entry 'root@4fbf5bb74dc0' ignored in --skip-name-resolve mode.
mariadb_1 | 2020-07-05 14:16:02 0 [Warning] 'user' entry '@4fbf5bb74dc0' ignored in --skip-name-resolve mode.
mariadb_1 | 2020-07-05 14:16:02 0 [Warning] 'proxies_priv' entry '@% root@4fbf5bb74dc0' ignored in --skip-name-resolve mode.
mariadb_1 | 2020-07-05 14:16:02 0 [Note] InnoDB: Buffer pool(s) load completed at 200705 14:16:02
mariadb_1 | 2020-07-05 14:16:02 0 [Note] Reading of all Master_info entries succeeded
mariadb_1 | 2020-07-05 14:16:02 0 [Note] Added new Master_info '' to hash table
mariadb_1 | 2020-07-05 14:16:02 0 [Note] mysqld: ready for connections.
mariadb_1 | Version: '10.4.10-MariaDB-1:10.4.10+maria~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 0 mariadb.org binary distribution
mariadb_1 | 2020-07-05 14:16:02+00:00 [Note] [Entrypoint]: Temporary server started.
So what I did then is to remove the volumes, because if a volume for mariadb already exists it won't override it and so not creating users.
I rebuilt again the users are still not created, it's mroe an issue with mariadb behavior than with assassingo.