• Kirill Smelkov's avatar
    gitlab: Compile assets on instantiation and make sure DB is properly... · 5a744de7
    Kirill Smelkov authored
    gitlab: Compile assets on instantiation and make sure DB is properly setup/migrated before unicorn runs
    
    There are several actions that needs to be done on gitlab instance
    upgrade:
    
        - we have to (re-)compile assets
        - we have to migrate DB
    
    and also before the first run
    
        - we have to initialize DB
    
    We can compile assets as part of instantiation process, but regarding
    DB migration / setup - it is not currently possible to do that as part
    of instantiation - for that operations we need PG & Redis to be already
    running, but the first time slapos instantiates an SR it first prepares
    all services, and only after instantiation is done, starts them all. There is
    currently no way to hook into starting process, and run some scripts
    after one service is started but before another service startup...
    
    So the solution is: to perform such actions in delayed mode as part of
    application - unicorn service - startup: it makes sure PG is running and
    initializes it and does other actions which needs to be done to migrate
    the DB. Only if/after they succeed the main application is started.
    
    NOTE the comment about unicorn/gitlab startup slowness from the previous
        patch still holds true - so in order to get "all ok" after
        instantiation, it is required to perform the instantiation several
        times, because unicorn promise initially fails.
    
    /cc @kazuhiko, @jerome
    5a744de7
instance.cfg.in 2.23 KB