Based on the repository content, I'll provide detailed steps to migrate your Wiki.js installation from DigitalOcean to your own server.
Step 1: Back up your existing Wiki.js data
- Connect to your DigitalOcean Droplet via SSH
- The critical data is stored in two places:
- Your PostgreSQL/MySQL database (containing pages and settings)
- The uploads directory (containing images and files)
- To backup the database:
# For PostgreSQL (default)
pg_dump -U wikijs wiki > wikijs_backup.sql
# For MySQL
mysqldump -u wikijs -p wiki > wikijs_backup.sql
- To backup the uploads directory:
# The uploads are typically in the data directory
tar -czf uploads_backup.tar.gz /path/to/wiki/data
- Download both backup files to your local machine:
scp root@your-droplet-ip:wikijs_backup.sql .
scp root@your-droplet-ip:uploads_backup.tar.gz .
Step 2: Set up Wiki.js on your own server
- Install Docker and Docker Compose on your server
- Create a new directory for Wiki.js:
mkdir wikijs
cd wikijs
- Create a
docker-compose.yml file with this content (based on the example in the repo):
version: "3"
services:
db:
image: postgres:15-alpine
environment:
POSTGRES_DB: wiki
POSTGRES_PASSWORD: your_secure_password
POSTGRES_USER: wikijs
logging:
driver: "none"
restart: unless-stopped
volumes:
- db-data:/var/lib/postgresql/data
wiki:
image: requarks/wiki:2
depends_on:
- db
environment:
DB_TYPE: postgres
DB_HOST: db
DB_PORT: 5432
DB_USER: wikijs
DB_PASS: your_secure_password
DB_NAME: wiki
restart: unless-stopped
ports:
- "80:3000"
- "443:3443"
volumes:
- ./data:/wiki/data
volumes:
db-data:
Step 3: Restore your data
- Start the database container only:
docker-compose up -d db
- Wait a minute for the database to initialize, then restore your backup:
# For PostgreSQL
cat wikijs_backup.sql | docker-compose exec -T db psql -U wikijs wiki
- Extract your uploads backup to the data directory:
tar -xzf uploads_backup.tar.gz -C ./data
- Start Wiki.js:
docker-compose up -d
Step 4: Verify the migration
- Access your new Wiki.js installation at http://your-server-ip
- Log in using your existing administrator credentials
- Verify that:
- All pages are present and accessible
- Images and uploads are displaying correctly
- User accounts and permissions are intact
Additional notes:
- Make sure to update your DNS records to point to your new server
- Consider setting up HTTPS using a reverse proxy like Nginx
- Keep your backup files secure as they contain sensitive information
- The default port is 3000, but the docker-compose file maps it to 80/443 for convenience
If you encounter any issues:
- Check the container logs:
docker-compose logs
- Verify database connection settings in the environment variables
- Ensure proper file permissions on the data directory
- Make sure all ports are accessible through your firewall
Remember to regularly backup your Wiki.js installation on your new server using the same backup procedure described above.