Skip to content

Instantly share code, notes, and snippets.

@fluidum
Last active May 18, 2023 13:57
Show Gist options
  • Save fluidum/9c1b46cf74efdc47627d0bde01e1cf8d to your computer and use it in GitHub Desktop.
Save fluidum/9c1b46cf74efdc47627d0bde01e1cf8d to your computer and use it in GitHub Desktop.
strapi migration examples to empty instance

Creating new instance

npx create-strapi-app@latest strapi-import --quickstart

Copying src/, script/, package.json and data.zip from https://github.com/strapi/foodadvisor

cp -r foodadvisor/api/src/ strapi-import/
cd strapi-import/
cp ../foodadvisor/api/package.json .
cp ../foodadvisor/api/data.zip  .
cp -r ../foodadvisor/api/script/ .

Updating package.json versions between foodadvisor and new instance

{
  "name": "foodadvisor",
  "private": true,
  "version": "2.0.0",
  "description": "Official Strapi Demo Application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi",
    "seed": "node script/seed.js"
  },
  "dependencies": {
    "@ckeditor/strapi-plugin-ckeditor": "^0.0.7",
    "@offset-dev/strapi-calendar": "^0.0.10",
    "@strapi/plugin-graphql": "^4.10.5",
    "@strapi/plugin-i18n": "4.10.5",
    "@strapi/plugin-seo": "^1.8.0",
    "@strapi/plugin-users-permissions": "4.10.5",
    "@strapi/strapi": "4.10.5",
    "@webbio/strapi-plugin-scheduler": "^0.1.2",
    "better-sqlite3": "8.0.1",
    "fs-extra": "^10.0.0",
    "strapi-plugin-cookie-manager": "^1.0.7",
    "strapi-plugin-populate-deep": "^1.1.2",
    "strapi-plugin-todo": "^0.0.9",
    "unzip-stream": "^0.3.1",
    "uuid-v4": "^0.1.0"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "FOODADVISOR-LOCAL-77d063d7-294d-4ef2-a887-897429e804e0"
  },
  "engines": {
    "node": ">=14.x.x <=18.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}

Installing with additional parameters. I have Node v18.16.0 (LTS) and for unknown reason last packages has issues without timeout parameter

yarn install --network-timeout 100000 --ignore-nodes

Importing premade data from data.zip

yarn seed

Starting strapi

yarn develop

Creating new instance

npx create-strapi-app@latest strapi-import-from-export --quickstart

Copying working package.json from (https://github.com/strapi/foodadvisor)

cp strapi-import/package.json strapi-import-from-export/

Copying src directory from https://github.com/strapi/foodadvisor

cp -R strapi-import/src/ strapi-import-from-export/

Changing current directory

cd strapi-import-from-export/

Updating package.json versions between foodadvisor and new instance

{
  "name": "foodadvisor",
  "private": true,
  "version": "2.0.0",
  "description": "Official Strapi Demo Application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi",
    "seed": "node script/seed.js"
  },
  "dependencies": {
    "@ckeditor/strapi-plugin-ckeditor": "^0.0.7",
    "@offset-dev/strapi-calendar": "^0.0.10",
    "@strapi/plugin-graphql": "^4.10.5",
    "@strapi/plugin-i18n": "4.10.5",
    "@strapi/plugin-seo": "^1.8.0",
    "@strapi/plugin-users-permissions": "4.10.5",
    "@strapi/strapi": "4.10.5",
    "@webbio/strapi-plugin-scheduler": "^0.1.2",
    "better-sqlite3": "8.0.1",
    "fs-extra": "^10.0.0",
    "strapi-plugin-cookie-manager": "^1.0.7",
    "strapi-plugin-populate-deep": "^1.1.2",
    "strapi-plugin-todo": "^0.0.9",
    "unzip-stream": "^0.3.1",
    "uuid-v4": "^0.1.0"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "FOODADVISOR-LOCAL-77d063d7-294d-4ef2-a887-897429e804e0"
  },
  "engines": {
    "node": ">=14.x.x <=18.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}

Installing with additional parameters. I have Node v18.16.0 (LTS) and for unknown reason last packages has issues without timeout parameter

yarn install --network-timeout 100000 --ignore-nodes

Restoring from strapi export that was made of foodadvisor api backend

npm run strapi import -- -f ../foodadvisor/api/export_20230517145017.tar.gz

Starting strapi

yarn develop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment