Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore gitlab backup #532

Closed
taniadaniela opened this issue Dec 9, 2015 · 7 comments
Closed

Restore gitlab backup #532

taniadaniela opened this issue Dec 9, 2015 · 7 comments

Comments

@taniadaniela
Copy link

I've started my container using 7.8.3 image an now I want to restore a backup from my old server..
For restoring the backup I've stopped and removed the gitlab container, when I try to execute the command I got:

docker run --name gitlab -it --rm \
> sameersbn/gitlab:7.8.3 app:rake gitlab:backup:restore
ERROR: 
  Please configure the database connection.
  Refer http://git.io/wkYhyA for more information.
  Cannot continue without a database. Aborting...

Any help please?

this is my docker-compose file

postgresql:
  restart: always
  image: sameersbn/postgresql:9.4-10
  environment:
    - DB_USER=gitlab
    - DB_PASS=password
    - DB_NAME=gitlabhq_production
  volumes:
    - /srv/docker/gitlab/postgresql:/var/lib/postgresql
gitlab:
  restart: always
  image: sameersbn/gitlab:7.8.3
  links:
    - redis:redisio
    - postgresql:postgresql
  ports:
    - "10080:80"
    - "10022:22"
  environment:
    - DEBUG=false
    - TZ=Asia/Kolkata
    - GITLAB_TIMEZONE=Kolkata

    - GITLAB_SECRETS_DB_KEY_BASE=mykey

    - GITLAB_HOST=localhost
    - GITLAB_PORT=10080
    - GITLAB_SSH_PORT=10022
    - GITLAB_RELATIVE_URL_ROOT=

    - GITLAB_NOTIFY_ON_BROKEN_BUILDS=true
    - GITLAB_NOTIFY_PUSHER=false

    - GITLAB_EMAIL=notifications@example.com
    - GITLAB_EMAIL_REPLY_TO=noreply@example.com
    - GITLAB_INCOMING_EMAIL_ADDRESS=reply@example.com

    - GITLAB_BACKUPS=daily
    - GITLAB_BACKUP_TIME=01:00

    - SMTP_ENABLED=false
    - SMTP_DOMAIN=www.example.com
    - SMTP_HOST=smtp.gmail.com
    - SMTP_PORT=587
    - SMTP_USER=mailer@example.com
    - SMTP_PASS=password
    - SMTP_STARTTLS=true
    - SMTP_AUTHENTICATION=login

    - IMAP_ENABLED=false
    - IMAP_HOST=imap.gmail.com
    - IMAP_PORT=993
    - IMAP_USER=mailer@example.com
    - IMAP_PASS=password
    - IMAP_SSL=true
    - IMAP_STARTTLS=false
  volumes:
    - /srv/docker/gitlab/gitlab:/home/git/data
redis:
  restart: always
  image: sameersbn/redis:latest
  volumes:
    - /srv/docker/gitlab/redis:/var/lib/redis

The tar folder is located in the backup_path

@taniadaniela taniadaniela changed the title Restore backup Restore gitlab backup Dec 9, 2015
@taniadaniela taniadaniela reopened this Dec 10, 2015
@sameersbn
Copy link
Owner

@taniadaniela can you try docker-compose run gitlab app:rake gitlab:backup:restore

@taniadaniela
Copy link
Author

@sameersbn I'm getting the following error:

Unpacking backup ... done
Restoring database ... 
Restoring PostgreSQL database gitlabhq_production ... psql:/home/git/data/backups/db/database.sql:22: ERROR:  syntax error at or near "`"
LINE 1: DROP TABLE IF EXISTS `application_settings`;
                             ^
psql:/home/git/data/backups/db/database.sql:38: ERROR:  syntax error at or near "`"
LINE 1: CREATE TABLE `application_settings` (
                     ^
psql:/home/git/data/backups/db/database.sql:45: ERROR:  syntax error at or near "`"
LINE 1: LOCK TABLES `application_settings` WRITE;
......

I've made the backup from a PostgreSql db to a PostgreSql db so I don't understand why is there a syntax problem.

@sameersbn
Copy link
Owner

I think the backup was created with a mysql database.

@taniadaniela
Copy link
Author

yes I've made a mistake, I will use it with a mysql db.

@sameersbn
Copy link
Owner

ps. please use the command docker-compose run --rm gitlab app:rake gitlab:backup:restore. I have added --rm to it because the restart policy in the docker-compose.yml will make it relaunch in the background.

@sameersbn
Copy link
Owner

I would suggest using mysql to restore and upgrade the installation. Once done, you can follow these instructions to migrate to postgresql.

P.S. Please create backups along each step of the way.

@taniadaniela
Copy link
Author

@sameersbn Thank you so much.. I have started my Gitlab in my new server..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants