<p>1) Updated existing Craft 2 from the Control Panel</p>

<p>2) <code>.env</code></p>

<pre><code>DB_DRIVER="mysql"
DB_SERVER="localhost"
DB_USER="root"
DB_PASSWORD="pwd"
DB_DATABASE="dbname"
DB_SCHEMA="public"
DB_TABLE_PREFIX="some_"
DB_PORT=""
</code></pre>

<p>3 ) <code>/var/www/html/somename/config/general.php</code></p>

<pre><code>&lt;?php

return [
    // Global settings
    '*' =&gt; [
        'defaultWeekStartDay' =&gt; 1,

        'omitScriptNameInUrls' =&gt; true,

        'cpTrigger' =&gt; 'admin',

        'securityKey' =&gt; getenv('SECURITY_KEY'),


        'useProjectConfigFile' =&gt; true,
    ],
    // Dev environment settings
    'dev' =&gt; [
        'devMode' =&gt; true,
        'useCompressedJs' =&gt; false,
        'allowUpdates' =&gt; true,
        'environmentVariables' =&gt; [
            'basePath' =&gt; '/var/www/html/craftcms3/web/',
            'baseUrl'  =&gt; 'http://craftcms3.local/',
        ],
        'siteUrl' =&gt; 'http://craftcms3.local/',
    ],

    // Staging environment settings
    'staging' =&gt; [
        // Prevent administrative changes from being made on staging
        'allowAdminChanges' =&gt; false,
    ],

    // Production environment settings
    'production' =&gt; [
        // Prevent administrative changes from being made on production
        'allowAdminChanges' =&gt; false,
    ],
];
</code></pre>

<p>4) and followed other mentioned steps at <a href="https://docs.craftcms.com/v3/upgrade.html#performing-the-upgrade" rel="nofollow noreferrer">https://docs.craftcms.com/v3/upgrade.html#performing-the-upgrade</a> </p>

<blockquote>
  <p>Permission at root:</p>
</blockquote>

<pre><code>sudo chown www-data:www-data  -R *
sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;
</code></pre>

<p>Error when I hit <a href="http://craftcms3.local/admin" rel="nofollow noreferrer">http://craftcms3.local/admin</a> </p>

<pre><code>craft\web\ServiceUnavailableHttpException in /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php:689
Stack trace:
#0 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(223): craft\web\Application-&gt;_processUpdateLogic(Object(craft\web\Request))
#1 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
#2 /var/www/html/craftcms3/web/index.php(22): yii\base\Application-&gt;run()
#3 {main}
</code></pre>

<blockquote>
  <p>Till now I haven't installed any plugins in Craft 3</p>
</blockquote>

<p>Update: </p>

<p>I tried again by following all steps above got the DB UPDATE screen after long time my system freezes now i got this error.</p>

<pre><code>Database Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'locale' in 'craft_categorygroups_i18n'
The SQL being executed was: ALTER TABLE `craft_categorygroups_i18n` ADD `siteId` int(11) AFTER `locale`

Migration: craft\migrations\m160807_144858_sites

Output:

&gt; execute SQL: SET FOREIGN_KEY_CHECKS = 0 ... done (time: 0.000s)
&gt; dropping {{%sites}} if it exists ... done (time: 0.271s)
&gt; create table {{%sites}} ... done (time: 0.385s)
&gt; create unique index craft_sites_handle_unq_idx on {{%sites}} (handle) ... done (time: 0.343s)
&gt; create index craft_sites_sortOrder_idx on {{%sites}} (sortOrder) ... done (time: 0.284s)
&gt; insert into {{%sites}} ... done (time: 0.041s)
&gt; update in {{%userpermissions}} ... done (time: 0.004s)
&gt; add column siteId integer AFTER `locale` to table {{%categorygroups_i18n}} ...Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'locale' in 'craft_categorygroups_i18n'
The SQL being executed was: ALTER TABLE `craft_categorygroups_i18n` ADD `siteId` int(11) AFTER `locale` (/var/www/html/craftcms3/vendor/yiisoft/yii2/db/Schema.php:664)
#0 /var/www/html/craftcms3/vendor/yiisoft/yii2/db/Command.php(1295): yii\db\Schema-&gt;convertException(Object(PDOException), 'ALTER TABLE `cr...')
#1 /var/www/html/craftcms3/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command-&gt;internalExecute('ALTER TABLE `cr...')
#2 /var/www/html/craftcms3/vendor/yiisoft/yii2/db/Migration.php(377): yii\db\Command-&gt;execute()
#3 /var/www/html/craftcms3/vendor/craftcms/cms/src/migrations/m160807_144858_sites.php(547): yii\db\Migration-&gt;addColumn('{{%categorygrou...', 'siteId', Object(craft\db\mysql\ColumnSchemaBuilder))
#4 /var/www/html/craftcms3/vendor/craftcms/cms/src/migrations/m160807_144858_sites.php(150): craft\migrations\m160807_144858_sites-&gt;addSiteColumn('{{%categorygrou...', 'siteId', true, 'locale')
#5 /var/www/html/craftcms3/vendor/craftcms/cms/src/db/Migration.php(56): craft\migrations\m160807_144858_sites-&gt;safeUp()
#6 /var/www/html/craftcms3/vendor/craftcms/cms/src/db/MigrationManager.php(243): craft\db\Migration-&gt;up(true)
#7 /var/www/html/craftcms3/vendor/craftcms/cms/src/db/MigrationManager.php(163): craft\db\MigrationManager-&gt;migrateUp(Object(craft\migrations\m160807_144858_sites))
#8 /var/www/html/craftcms3/vendor/craftcms/cms/src/services/Updates.php(215): craft\db\MigrationManager-&gt;up()
#9 /var/www/html/craftcms3/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(521): craft\services\Updates-&gt;runMigrations(Array)
#10 /var/www/html/craftcms3/vendor/craftcms/cms/src/controllers/UpdaterController.php(209): craft\controllers\BaseUpdaterController-&gt;runMigrations(Array, 'restore-db')
#11 [internal function]: craft\controllers\UpdaterController-&gt;actionMigrate()
#12 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#13 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&gt;runWithParams(Array)
#14 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller-&gt;runAction('migrate', Array)
#15 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&gt;runAction('migrate', Array)
#16 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module-&gt;runAction('updater/migrate', Array)
#17 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(683): craft\web\Application-&gt;runAction('updater/migrate')
#18 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(223): craft\web\Application-&gt;_processUpdateLogic(Object(craft\web\Request))
#19 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
#20 /var/www/html/craftcms3/web/index.php(22): yii\base\Application-&gt;run()
#21 {main}
</code></pre>

CC BY-SA 4.0
2019-03-06T14:36:53.543Z
Have you looked at the `web.log` file in `storage/logs/` for more details on why the error is happening? A 503 error could be because Craft is unable to connect to your database, for example.
Martin Spain
CC BY-SA 4.0
2019-03-06T15:50:23.647Z
You should ad the db port as well. This is 99% a db connection problem.
Do you need to make an ssl connection to your db? that's what I ran into.
KSPR
CC BY-SA 4.0
2019-03-06T15:59:20.293Z
I am doing this on my localhost, Currently i don't have access to my system, will add the available port and check. and suggested below i will check the log as well if it exists.
inrsaurabh
<craft3><upgrades>
Got HTTP 503 – Service Unavailable error while updating to Craft 3
# Got HTTP 503 – Service Unavailable error while updating to Craft 3

(Asked by: username_0 on 2019-03-06)

1) Updated existing Craft 2 from the Control Panel
2) .env
DB_DRIVER="mysql"
DB_SERVER="localhost"
DB_USER="root"
DB_PASSWORD="pwd"
DB_DATABASE="dbname"
DB_SCHEMA="public"
DB_TABLE_PREFIX="some_"
DB_PORT=""

3 ) /var/www/html/somename/config/general.php
 [
        'defaultWeekStartDay' => 1,

        'omitScriptNameInUrls' => true,

        'cpTrigger' => 'admin',

        'securityKey' => getenv('SECURITY_KEY'),


        'useProjectConfigFile' => true,
    ],
    // Dev environment settings
    'dev' => [
        'devMode' => true,
        'useCompressedJs' => false,
        'allowUpdates' => true,
        'environmentVariables' => [
            'basePath' => '/var/www/html/craftcms3/web/',
            'baseUrl'  => 'http://craftcms3.local/',
        ],
        'siteUrl' => 'http://craftcms3.local/',
    ],

    // Staging environment settings
    'staging' => [
        // Prevent administrative changes from being made on staging
        'allowAdminChanges' => false,
    ],

    // Production environment settings
    'production' => [
        // Prevent administrative changes from being made on production
        'allowAdminChanges' => false,
    ],
];

4) and followed other mentioned steps at https://docs.craftcms.com/v3/upgrade.html#performing-the-upgrade 

Permission at root:

sudo chown www-data:www-data  -R *
sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;

Error when I hit http://craftcms3.local/admin 
craft\web\ServiceUnavailableHttpException in /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php:689
Stack trace:
#0 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(223): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#1 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#2 /var/www/html/craftcms3/web/index.php(22): yii\base\Application->run()
#3 {main}


Till now I haven't installed any plugins in Craft 3

Update: 
I tried again by following all steps above got the DB UPDATE screen after long time my system freezes now i got this error.
Database Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'locale' in 'craft_categorygroups_i18n'
The SQL being executed was: ALTER TABLE `craft_categorygroups_i18n` ADD `siteId` int(11) AFTER `locale`

Migration: craft\migrations\m160807_144858_sites

Output:

> execute SQL: SET FOREIGN_KEY_CHECKS = 0 ... done (time: 0.000s)
> dropping {{%sites}} if it exists ... done (time: 0.271s)
> create table {{%sites}} ... done (time: 0.385s)
> create unique index craft_sites_handle_unq_idx on {{%sites}} (handle) ... done (time: 0.343s)
> create index craft_sites_sortOrder_idx on {{%sites}} (sortOrder) ... done (time: 0.284s)
> insert into {{%sites}} ... done (time: 0.041s)
> update in {{%userpermissions}} ... done (time: 0.004s)
> add column siteId integer AFTER `locale` to table {{%categorygroups_i18n}} ...Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'locale' in 'craft_categorygroups_i18n'
The SQL being executed was: ALTER TABLE `craft_categorygroups_i18n` ADD `siteId` int(11) AFTER `locale` (/var/www/html/craftcms3/vendor/yiisoft/yii2/db/Schema.php:664)
#0 /var/www/html/craftcms3/vendor/yiisoft/yii2/db/Command.php(1295): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE `cr...')
#1 /var/www/html/craftcms3/vendor/yiisoft/yii2/db/Command.php(1091): yii\db\Command->internalExecute('ALTER TABLE `cr...')
#2 /var/www/html/craftcms3/vendor/yiisoft/yii2/db/Migration.php(377): yii\db\Command->execute()
#3 /var/www/html/craftcms3/vendor/craftcms/cms/src/migrations/m160807_144858_sites.php(547): yii\db\Migration->addColumn('{{%categorygrou...', 'siteId', Object(craft\db\mysql\ColumnSchemaBuilder))
#4 /var/www/html/craftcms3/vendor/craftcms/cms/src/migrations/m160807_144858_sites.php(150): craft\migrations\m160807_144858_sites->addSiteColumn('{{%categorygrou...', 'siteId', true, 'locale')
#5 /var/www/html/craftcms3/vendor/craftcms/cms/src/db/Migration.php(56): craft\migrations\m160807_144858_sites->safeUp()
#6 /var/www/html/craftcms3/vendor/craftcms/cms/src/db/MigrationManager.php(243): craft\db\Migration->up(true)
#7 /var/www/html/craftcms3/vendor/craftcms/cms/src/db/MigrationManager.php(163): craft\db\MigrationManager->migrateUp(Object(craft\migrations\m160807_144858_sites))
#8 /var/www/html/craftcms3/vendor/craftcms/cms/src/services/Updates.php(215): craft\db\MigrationManager->up()
#9 /var/www/html/craftcms3/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(521): craft\services\Updates->runMigrations(Array)
#10 /var/www/html/craftcms3/vendor/craftcms/cms/src/controllers/UpdaterController.php(209): craft\controllers\BaseUpdaterController->runMigrations(Array, 'restore-db')
#11 [internal function]: craft\controllers\UpdaterController->actionMigrate()
#12 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#13 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#14 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller->runAction('migrate', Array)
#15 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('migrate', Array)
#16 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module->runAction('updater/migrate', Array)
#17 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(683): craft\web\Application->runAction('updater/migrate')
#18 /var/www/html/craftcms3/vendor/craftcms/cms/src/web/Application.php(223): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#19 /var/www/html/craftcms3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#20 /var/www/html/craftcms3/web/index.php(22): yii\base\Application->run()
#21 {main}

**Tags:** craft3, upgrades
> **Comments:**
> **username_1**: Have you looked at the `web.log` file in `storage/logs/` for more details on why the error is happening? A 503 error could be because Craft is unable to connect to your database, for example.  
> **username_2**: You should ad the db port as well. This is 99% a db connection problem. Do you need to make an ssl connection to your db? that's what I ran into.  
> **username_0**: I am doing this on my localhost, Currently i don't have access to my system, will add the available port and check. and suggested below i will check the log as well if it exists.  

---

## 0 answers

