diff --git a/environment/uat/README.md b/environment/uat/README.md index 5c60828..04e74f3 100644 --- a/environment/uat/README.md +++ b/environment/uat/README.md @@ -2,30 +2,59 @@ Hostname: `uat.api.retropilot.org` -## Usage +## Setup -### Environment +This setup assumes you have `docker` and `docker-compose` installed on your machine, and that you have added the +relevant users to the `docker` group. -Copy `.env.sample` to `.env` and edit as needed. +```sh +# install docker and setup systemd to start it on boot +sudo yum install docker-ce docker-ce-cli containerd.io +sudo systemctl start docker +sudo systemctl enable docker -``` -cp .env.sample .env +# add $USER to the docker group +sudo usermod -aG docker $USER ``` -### Deployment +Clone the Git repo to `/data/retropilot-server`. We can clone it using the `--shared` argument to allow multiple users +to read/write these files (taking advantage of the Linux `sgid` permissions bit). + +```sh +# create /data directory and relax permissions to let a non-root user write to it +sudo mkdir /data +sudo chmod a+w /data + +# clone the repository +cd /data +git clone https://github.com/RetroPilot/retropilot-server.git --shared --branch uat + +# allow any user in the 'docker' group to read/write the files in this directory +sudo chgrp -R docker retropilot-server + +# tighten /data permissions again so that not non-root users cannot write to it +sudo chmod a-w /data +``` + +## Deployment + +Make sure to create and modify the `.env` file as required for your environment. Note that the first time you run the PostgreSQL container it will have to initialise. The server and worker cannot interact with it before this happens. -Before first run: -``` +Before first run (in `/data/retropilot-server`): +```sh cd environment/uat -# Create the database +# copy and modify the `.env` file as required +cp .env.sample .env + +# create the database docker-compose up db # CTRL-C when "database system is ready to accept connections" message appears -# Allow the API program to initialise the database schema +# allow the API to initialise the database schema docker-compose up db api # CTRL-C when "RetroPilot Server listening at" message appears ```