Note: Installation guide is for dockerized version. manual deployment of staging server's services can be figured out on own but is completely unnecessary as staging server itself uses docker to deploy repositories.
Docker engine must be installed (you can use inbuilt docker compose or install docker-compose).
Refer to the following guide on how to install if it's not installed: docs.docker.com
git clone https://github.com/IRIS-NITK/Staging-Server.git
to clone with IRIS modules (for IRIS developers):
git clone --recurse-submodules https://github.com/IRIS-NITK/Staging-Server.git
enter staging server's directory
cd staging-server
build docker image for staging-server's services
docker-compose build
create environment file, copy .env.example
to .env
.
- change domain to your root domain of choice for staging server and deployments.
- change HOST_PARENT_WD to current working directory on your host.
- change GITLAB_URL to your instance of gitlab if you want to setup SSO with gitlab and deploy with it.
Important: comment out database mount in docker-compose.yaml
to generate a fresh database file.
- "./db.sqlite3:/STAGING_APP/db.sqlite3:rw"
you can use the following sed command to do so.
sed -i '/\.\/db\.sqlite3:\/STAGING_APP\/db\.sqlite3:rw/s/^/#/' docker-compose.yml
start staging-server. (use -d
arg to run as daemon on subsequent deployments if required)
docker-compose up
copy database file to host:
docker-compose cp gunicorn:/STAGING_APP/db.sqlite3 ./db.sqlite3
uncomment database mount (Important), or your data will not persist on restarts.
shutdown staging server or (use ctrl+c
)
docker-compose down
uncomment staging-server app's mounts for easier development so you won't have to rebuild everytime.(There are multiple mounts) Make sure to comment it back again before commiting/pushing to the repository.
- "./:/STAGING_APP:rw"
exec into staging-server:
docker-compose exec -it gunicorn bash
create superuser:
python manage.py createsuperuser
The app will be visible on http://localhost:9000 by default.
Go to http://localhost:9000/admin
Click on Sites then click on the existing site. Rename as shown and click SAVE
- Go to User Settings > Applications then create an application as shown
- Copy the Application ID and Secret from GitLab into Client ID and Secret key
- Double click on localhost:9000 to move it into Chosen sites and click SAVE
- Go to Settings > Developer Settings > OAuth Apps > New OAuth App and fill as shown
- Copy the Client ID and a Client secret from Github into Client ID and Secret key
- Double click on localhost:9000 to move it into Chosen sites and click SAVE
Exposed ports feature is disabled and staging-server now only exposes deployments through nginx so in order to access deployments without a valid domain. You'll need to modify /etc/hosts
and add the particular domain for each deployments and access it.