Backup strategies
It is highly recommended to back up the data both in the database, the media files and the values.yaml regularly and before running updates.
Backing up the media folder
To create an archive out of the UPLOADS_DIR and preserve permissions and ownership run the following command:
sudo tar --same-owner -zcvpf uploads.tgz UPLOADS_DIR/
Make sure that you preserve both the file permissions and the ownership while creating the tar package by using --same-owner
Note: This will create an archive of the entire UPLOADS_DIR folder and all of its subdirectories:
backend-uploads/
This is where the 3YD application uploads and stores 3D filesbutton3d-media/
This is where the 3YD application stores documents like:Materials Datasheets (PDF)
Order Notes - Order confirmation doc, Invoices, Delivery Confirmation notes (all in PDF)
Fulfillment partner Logos, Key Manager logos (.png, .jpg)
button3d-private-media/
This is where private media files like Basket/Order attachments are storedpsql/
This is where data from the embedded Postgres database is stored (only if used)
Restoring the media folder
In case you need to restore the Media, 3D and DB folders from an archive follow below steps.
Use cases when required to restore from the archive:
The server on which the application is running, crashes beyond recovery.
The storage is compromised or corrupted and cannot be recovered
Migrating to a new server with improved specifications.
On the freshly installed server, follow the Installation guide up to and including step 3.
Create and
cd
to a directory on the server where the application will be unpacked:mkdir -p 3yd_v404 && cd 3yd_404
Download the archive package from the link provided by the 3YD Technical Support team:
curl -o 3yd_v4.0.4.tgz “Download Link“
Note: The link should be surrounded in double quotes ““ as it contains symbols interpreted as special characters by the bash shellUnpack the installation package:
tar -zxvf 3yd_v4.0.4.tgz
Now copy the most recent archive on the new server and place it next to the 3yd application folder.
To extract the backup and preserve permissions and ownership run the following commandcd $HOME && sudo tar --same-owner -xvf uploads.tgz
To confirm the extracted data has the correct ownership and permissions run the below commands: sudo ls -lah UPLOADS_DIR/
Example with expected results:
# PSQL folder inside UPLOADS_DIR should be owned by user and group of root root
user@server:~$ sudo ls -lah UPLOADS_DIR/
drwxrwxrwx 3 root root 4.0K Aug 20 07:39 psql
sudo ls -lah UPLOADS_DIR/psql
Example with expected results:
# PSQL/data and all of its subdirectories folders should be owned by user 1001 and group root
user@server:~$ sudo ls -lah UPLOADS_DIR/psql
total 12K
drwx------ 19 1001 root 4.0K Aug 20 11:32 data
sudo ls -lah UPLOADS_DIR/psql/data
Example with expected results:
user@server:~$ sudo ls -lah UPLOADS_DIR/psql/data
total 96K
drwx------ 19 1001 root 4.0K Aug 20 11:32 .
drwxrwxrwx 3 root root 4.0K Aug 20 07:39 ..
-rw------- 1 1001 root 3 Aug 20 07:39 PG_VERSION
drwx------ 6 1001 root 4.0K Aug 20 07:39 base
drwx------ 2 1001 root 4.0K Aug 20 11:32 global
drwx------ 2 1001 root 4.0K Aug 20 07:39 pg_commit_ts
drwx------ 2 1001 root 4.0K Aug 20 07:39 pg_dynshmem
-rw------- 1 1001 root 1.6K Aug 20 07:39 pg_ident.conf
drwx------ 4 1001 root 4.0K Aug 20 12:42 pg_logical
drwx------ 4 1001 root 4.0K Aug 20 07:39 pg_multixact
drwx------ 2 1001 root 4.0K Aug 20 11:32 pg_notify
drwx------ 2 1001 root 4.0K Aug 20 07:39 pg_replslot
drwx------ 2 1001 root 4.0K Aug 20 07:39 pg_serial
drwx------ 2 1001 root 4.0K Aug 20 07:39 pg_snapshots
drwx------ 2 1001 root 4.0K Aug 20 10:26 pg_stat
drwx------ 2 1001 root 4.0K Aug 20 12:50 pg_stat_tmp
drwx------ 2 1001 root 4.0K Aug 20 07:39 pg_subtrans
drwx------ 2 1001 root 4.0K Aug 20 07:39 pg_tblspc
drwx------ 2 1001 root 4.0K Aug 20 07:39 pg_twophase
drwx------ 3 1001 root 4.0K Aug 20 07:45 pg_wal
drwx------ 2 1001 root 4.0K Aug 20 07:39 pg_xact
-rw------- 1 1001 root 88 Aug 20 07:39 postgresql.auto.conf
-rw------- 1 1001 root 249 Aug 20 11:32 postmaster.opts
-rw------- 1 1001 root 79 Aug 20 11:32 postmaster.pid
Now you can continue following the Installation guide from step 5
5. Find out the domain under which the app should be publicly reachable (DOMAIN, hostname like app.example.com
)
Note: We suggest exporting the two variables above in your .bashrc
by appending the two lines to the end of the file.
Reload your ./bashrc
with source ~/.bashrc
6. Run the install script:
sudo ./install.sh $DOMAIN $UPLOADS_DIR; exec bash -l
7. You can now make changes to the configuration file values.yaml
.
8. Apply the changed configuration:
sudo ./upgrade.sh
9. Check the status of the application:
kubectl get pods