Follow

I feel completely stupid. Tried to use Docker to install (run) an app on my linux machine. I failed. The story should've had a happy ending with localhost:8080/libreplan leading me to libreplan screen. It didn't happen. Is there a nice tutorial about using docker to run apps? It has to be very simple. Something like Docker for Dummies but dumber. Way dumber.

@paladin make sure you’re opening ports (docker run -p 8080 image) and/or your firewall isn’t blocking it

@paladin @blueberry Where did the 1 in mariadb1:db come from?

I see you're following the directions here:
hub.docker.com/r/libreplan/lib

I'm also unsure how libreplan expects port 8080 to be exposed when they don't forward it

@paladin @blueberry You might try adding "-p 8080:8080" to the second command to fix that specific thing.

When you run these commands, does anything show up with "docker container ls"? Can you use "docker logs [docker-name]" to see the logs?

@paladin @blueberry I just looked at their provided docker compose file and they messed up their instructions!

The parameters in this file are correct:
github.com/LibrePlan/docker-im

@urusan @blueberry Ok, that is one thing solved.
Let see if I got other instructions right:
1. Use docker-compose file - ok
2. and the sql install script . don't know how to
3. Launch a mariadb container - ok
4. Launch and attach libreplan container - Error

@paladin @blueberry There's an implicit or there:
1. docker-compose
2. SQL install script
OR
1. Setup db
2. Setup and connect libreplan
3. Presumably run SQL install script

@paladin @blueberry The error is because the container is already set up and running from the docker-compose step. The original container is taking up the port.

But it's simple to fix, just don't use "docker run" at all.

@paladin @blueberry As for how to run that SQL install script...it's weird that they're asking you to do that, especially since they are using Liquibase.

For anyone not familiar with Liquibase, it's a Java library to set up a database schema automatically. It uses a cross-db schema definition language. The setup SQL is the final product of running liquibase (for MySQL).

The mainstream paradigm is that if your liquibase-using program starts up and finds an empty database, it should set it up.

@paladin @blueberry Sorry, wait, they ran it on postgres, not MySQL or MariaDB.

@paladin @blueberry Here's what you would run against a MySQL or MariaDB database to set it up:
github.com/LibrePlan/docker-im

It's just plain SQL/DDL, so you just need to run the script against the database. There's a variety of ways to do this. For each database there's a command line utility to run SQL, there's usually a nice GUI tool, and many have a website associated with the database that you can navigate to. There's also some generic tools for this, but I don't know what is good.

@paladin @blueberry That said, there's a good chance that their documentation is misleading about this whole "needing to run a SQL setup script" thing and Liquibase will just handle it for you on startup.

If I were you, I would just clean everything back to square one, run docker-compose again like you did last time, and then just navigate to the site to see if it worked automatically.

If that fails, then go see if the database is the issue and if you need to run that script.

@urusan @blueberry

Hi ... I can't work this out... It is like there is always: use docker compose or do it manually ... github.com/LibrePlan/docker-im

@paladin @blueberry Are you the user who created that issue on github?

If so, it looks like the problem was that the database was not initialized.

So, the opposite of what I was thinking earlier, good to know.

@paladin @blueberry Does your local "/absolute/path/to/folder/sql" exist and contain install.sql?

If so, is it the postgres version of install.sql?

@urusan @blueberry Where is "absolute path"?

This is my docker compose file:
db:
container_name: db
image: mysql:5
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: my-secret-pw
MYSQL_DATABASE: libreplan
MYSQL_USER: libreplan
MYSQL_PASSWORD: secret
volumes:
- "./sql:/docker-entrypoint-initdb.d"

web:
container_name: web
image: libreplan/libreplan:1.4.1-mysql
ports:
- "8080:8080"
links:
- db

@paladin @urusan I was able to get it working, but I don't recommend using the Docker image since it's 5 years old.

That said, follow the instructions here: cryptpad.fr/code/#/2/code/view

@urusan I also got the install.sql file in the same folder as docker-compose.yml file

@urusan If I understod correctly I can go with docker compose and use the install.sql file
or
manually create two containers

Is this so or?

@paladin So, with your current docker-compose file, it's mounting the ./sql folder (which is supposed to have install.sql inside it) into a folder in your database, which will autorun on (first) startup.

./sql is going to be the sql folder inside whatever directory you run `docker-compose up` from.

So, it sounds like you just need to make a sql folder to put the install.sql file into, so it can be mounted properly.

@paladin It's also possible to mount a single file, if you give the full path of the file on both sides of the mount definition:
./install.sql:/docker-entrypoint-initdb.d/install.sql

That would mount just the install.sql file from the current directory into that folder.

@paladin Oh, and yes, both of those are viable options.

Manually creating 2 containers would require install.sql btw.

That said, another option is to make a Dockerfile that loads install.sql permanently into the database image.

I would personally go with docker-compose though.

@paladin Oh wait, you are using mysql after all. I assumed you were using postgres

@paladin By the way, I just noticed your database died. Any idea why it died?

Of particular importance is making sure you fed it the right install.sql. The postgres version is in a different dialect and thus won't be understandable to a MySql database.

Show newer
Show newer

@urusan @blueberry What is the easiest database to learn from those mentioned here?

@paladin @blueberry Postgres is more modern and fully featured. I would recommend it if you want to learn more about databases. I'd also recommend it if you don't care and it's an option.

MySQL and MariaDB are more common, but also more old fashioned and idiosyncratic. Also, the split is because Oracle acquired MySQL.

Really it doesn't matter all that much though, databases are usually used behind abstraction layers.

@urusan @blueberry There are two options... postgres or mysql (or mariadb...) I'd be happy with the one that works :)

@paladin @blueberry If you go with Postgres and have to run the install script, I know that this tool is good for mucking around with the database pgadmin.org

@paladin @blueberry MariaDB seems to have a long list of generic db tools mariadb.com/kb/en/graphical-an

Also, don't forget the command line tools, especially since they can be scripted.

@urusan @blueberry :) maria1 came because I didn't kill maria. Now there is maria2 even. :D Thank you very much for your help! I will try to set this up a bit later and let yku all know how it went.

@paladin @blueberry By the way, posting what you were using really helped. It made it a lot easier to pinpoint what was going on.

I saw your post yesterday but was too busy to help properly between work and childcare, but with it being vague I didn't have much to go on.

Let us know if you hit another roadblock. It sounds like you are making good progress though. :)

Sign in to participate in the conversation
Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.