Coder Social home page Coder Social logo

Comments (11)

tobybatch avatar tobybatch commented on July 30, 2024 1

You shouldn't be pulling into the container. All changes will be lost when (if) the container restarts unless you are mounting /opt/kimai into a volume.

You should be just need to change the tag in the docker-compose and run a

 docker-compose stop kimai
 docker-compose up --build

The container will re-use the db form the previous version and then run the migrations (https://github.com/tobybatch/kimai2/blob/master/tags/1.0/startup.sh#L71).

However, I just tested this and it failed. Let me investigate.

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024 1

Fix coming soon. Totally my fault. I copied instruction from the install docs for kimai without understanding what they did. In the install kimai creates the DB and then added the DB migrations to the DB because the schema is now up to date. /opt/kimai/bin/console -n doctrine:migrations:version --add --all

What I should have done is execute the migations that are needed, /opt/kimai/bin/console -n -vv doctrine:migrations:migrate --allow-no-migration. I've fixed this and pushed new builds for the 0.9, 1.0 and 1.0.1 container images.

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024 1

@yayitazale The schema has become out of date, I'll try and find out why but for now if we apply all the migrations it will fail on the ones that have been already applied and bring the schema up to date.
Start the v 1.0.1 container and shell into it

docker-compose exec kimai bash

Run all the migration, there wil be errors but we can ignore them.

for x in 20180701120000 20180715160326 20180730044139 20180805183527 20180903202256 20180905190737 20180924111853 20181031220003 20190124004014 20190201150324 20190219200020 20190305152308 20190321181243 20190502161758 20190510205245 20190605171157 20190617100845; do ./bin/console doctrine:migrations:execute -n $x; done

I am refactoring the containers At the moment. I'll make surebetter migration support is included.

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024 1

A bit of a hammer based solution ;)

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

Yes you will need to run the migrations. Back everything up and then start the q.o container and then shell into the container:

docker exec -ti NAME bash

and run:

bin/console doctrine:migrations:version --add --all -n

I'll leave this issue open as I will add this to the docker start script.

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

It doesn't work. I followed the steps of DB updating:

git fetch --tags
git checkout 1.0.1 
composer install --no-dev --optimize-autoloader
bin/console cache:clear --env=prod
bin/console cache:warmup --env=prod
bin/console doctrine:migrations:migrate

The comand "git checkout 1.0.1 " says

error: Your local changes to the following files would be overwritten by checkout:
composer.lock
Please commit your changes or stash them before you switch branches.
Aborting

And final step says nothing to migrate.

Running
bin/console doctrine:migrations:version --add --all -n
doesn't make any change, even forcing the recreation of the container.

What I'm doing wrong?

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

Thanks, I'll give a try as soon as it is publish.

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

This is still not working...

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

Can you let me have your docker-compose file please (both before and after the version bump). Just redact the passwords.

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

Before:

version: '3'
services:

  mydb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiu
      - MYSQL_PASSWORD=kimaip
      - MYSQL_ROOT_PASSWORD=changeme
    volumes:
        - mysql:/var/lib/mysql
    command: --default-storage-engine innodb
    restart: always

  kimai:
    image: kimai/kimai2:0.9
    environment:
        - APP_ENV=prod
        # These are added to override the the DB URL from env when checking the$
        - DATABASE_URL=mysql://kimaiu:kimaip@mydb/kimai
    depends_on:
        - mydb
    restart: always
    ports:
      - 80:8001

volumes:
  mysql:

After

version: '3'
services:

  mydb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiu
      - MYSQL_PASSWORD=kimaip
      - MYSQL_ROOT_PASSWORD=changeme
    volumes:
        - mysql:/var/lib/mysql
    command: --default-storage-engine innodb
    restart: always

  kimai:
    image: kimai/kimai2:1.0.1
    environment:
        - APP_ENV=prod
        # These are added to override the the DB URL from env when checking the$
        - DATABASE_URL=mysql://kimaiu:kimaip@mydb/kimai
    depends_on:
        - mydb
    restart: always
    ports:
      - 80:8001

volumes:
  mysql:

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

Many thanks, it works like a charm.

from kimai2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.