[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]uploads/2023-06-08 13:45 -  
[TXT]README.md2023-06-08 13:45 2.9K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]data.db.bak2023-06-08 13:45 304K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]data-2.db.bak2023-06-08 13:45 460K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]data-3.db.bak2023-06-08 13:45 524K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]data-4.db.bak2023-06-08 13:45 524K0fb859dc fixed mobile overflwo options [كارل مبارك]
[   ]data-5.db.bak2023-06-08 13:45 524K0fb859dc fixed mobile overflwo options [كارل مبارك]
# Backups and Restoration

After last year, we never know what can happen. This directory contains the necessary database files and instructions to restore Pia's room.

### Overview

Pia's room, its front-end, backend, and database are all contained in the [parent](../) directory. The directory has been compressed into [piacw.zip](/piacw.zip) on February 1, 2021 at 11:31.

This directory contains backups of Pia's room's database in the following structure:

1. A **data-X.db.bak** file. This file is a manual copy of the `data.db` file that describes the contents of the API as Pia had put them in. The original file was generated and is updated by the current running instance of Strapi. It can be found [here](../dev/pias-backend-2/.tmp/data.db). To back up this file, I just occasionally make a copy of the original and move it to this folder. The most recent back-up of `data.db` is `data-X.db.bak`, with the highest 'X'. Currently this is [`data-5.db.bak`](data-5.db.bak).
2. An **uploads** folder. This folder is a manual copy of the `uploads` folder that contains the files that Pia uploaded to Strapi, including all images and their auto-generated size alternates. This folder was created by Strapi and is updated regularly. Its contents are always referenced by `data.db`. The original uploads folder is [here](../dev/pias-backend-2/public/uploads). I back up this folder by making a copy manually here: [`uploads`](uploads).
3. A **README.md** file with instructions for restoration. This file.

### Instructions

Follow these instructions on the server that will host Pia's Room.

First, download and unpack the compressed project folder, [piacw.zip](/piacw.zip), then:
```bash
cd piacw
```

Copy the most recent `data-X.db.bak` file to Strapi's `.tmp` directory:
```bash
cp backups/data-4.ddb.bak dev/pias-backend-2/.tmp/data.db
```

Copy the `uploads` folder to Strapi's public directory:
```bash
cp -r backups/uploads dev/pias-backend-2/public/uploads
```

Start the back-end server (Strapi)
```bash
cd dev/pias-backend-2/
npm install
npm run develop
```

If everything looks ok, build and start Strapi.
```bash
NODE_ENV=production npm run build
NODE_ENV=production npm run start
```

Start the front-end server (Vue)
```bash
cd dev/final/
npm install
npm run serve
```

If everything looks ok, build the front-end.
```bash
npm run build
```

This generates a `dist` directory containing the build files that can be served statically. At this point you need to configure two apache/nginx sites on the server. The first is `api.piacw.com`, and needs to reverse proxy to the running Strapi server, most likely at `localhost:1337`. The second is `piacw.com`, and needs to point to the build files of the front-end by changing the web root to `dev/final/dist`.

Finally, generate self-signed certificates for **both** sites and restart your server.


### Conclusion

Pia's Room should be online at [piacw.com](https://piacw.com) and her CMS accessible at [api.piacw.com](https://api.piacw.com).