Skip to content

Commit

Permalink
[infra] system wide installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
patatoid committed Dec 27, 2023
1 parent 194ad82 commit 7b24ae2
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ This server has been also certified for the Config and Dynamic OpenID Provider p

A [loom presentation](https://www.loom.com/share/77006360fdac44bc9113fab9cf30aba5) about how to get a server up and running.

### System wide setup (Debian based)

You can perform a system wide installation performing the following command. It will create a systemd service to run the server. During the installation, you will be asked to fill out the environment variables for the server. The environment takes `.env.example` as a basis.

> Remember to change admin username / password for the install to be secured
```
curl -s https://raw.githubusercontent.com/malach-it/boruta-server/master/scripts/setup.debian.sh | sudo sh
```

The applications will be available on different ports (depending on the filled out environment configuration):
- http://localhost:8080 for the authorization server
- http://localhost:8081 for the admin interface
- http://localhost:8082 for the gateway
- http://localhost:8083 for the microgateway

### Run an instance from docker

A docker image is available at `malachit/boruta-server` on [DockerHub](https://hub.docker.com/r/malachit/boruta-server), you will need a postgres instance installed on your system with credentials provided as environment variables in `.env.*`.
Expand Down
45 changes: 45 additions & 0 deletions scripts/setup.debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

##
# Dependencies
# - systemd
echo '# Boruta server setup'
echo '## install dependencies'
apt-get -q update
apt-get -q install -y libssl-dev wget vim postgresql postgresql-client

echo '## install boruta'
cd /opt
wget -q https://github.com/malach-it/boruta-server/releases/download/0.2.0/boruta.tar.gz
tar xf boruta.tar.gz

wget -q -O /opt/boruta/.env.production https://raw.githubusercontent.com/malach-it/boruta-server/0.2.0/.env.example
vim /opt/boruta/.env.production

cat > /etc/systemd/system/boruta.service <<- EOF
[Unit]
Description=Boruta server
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/boruta
EnvironmentFile=/opt/boruta/.env.production
ExecStartPre=-su -w POSTGRES_USER,POSTGRES_PASSWORD - postgres -c "psql -c \"CREATE USER \${POSTGRES_USER} WITH CREATEDB PASSWORD '\${POSTGRES_PASSWORD}'\""
ExecStartPre=/opt/boruta/bin/boruta eval "Boruta.Release.setup()"
ExecStart=/opt/boruta/bin/boruta start
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
chmod +x /etc/systemd/system/boruta.service


echo '## Enable boruta service'
systemctl daemon-reload
systemctl enable boruta
systemctl start boruta

exit 0

0 comments on commit 7b24ae2

Please sign in to comment.