Skip to content

Commit

Permalink
Add initial files
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanrousseau committed Sep 28, 2020
1 parent 74e4370 commit aff237e
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debug.log
36 changes: 36 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
echo "Stop octopus-local."
systemctl is-active --quiet octopus-local && systemctl stop octopus-local

docker-compose down

if [ ! -d "mssql" ]; then
echo "Create mssql folder."
mkdir mssql
echo "Set owner of mssql/."
chown -R mssql:0 mssql/
echo "mssql/ configured."
fi

if [ ! -d "sqlserver" ]; then
echo "Create sqlserver folder."
mkdir sqlserver
echo "Set owner of sqlserver/."
chown -R mssql:0 sqlserver/
echo "sqlserver/ configured."
fi

docker-compose up -d
mv octopus-local.service /etc/systemd/system
mv octopus.local /etc/nginx/sites-available

echo "Start octopus-local."
systemctl is-enabled --quiet octopus-local || systemctl enable octopus-local
systemctl start octopus-local
echo "Reload systemctl daemon."
systemctl daemon-reload
echo "Restart nginx."
systemctl restart nginx

write_highlight "[octopus.local](https://octopus.local)"

exit 0
48 changes: 48 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: "3"
services:
db:
image: mcr.microsoft.com/mssql/server
environment:
SA_PASSWORD: ""
ACCEPT_EULA: "N"
# Prevent SQL Server from consuming the defult of 80% physical memory.
MSSQL_MEMORY_LIMIT_MB: 2048
ports:
- 1401:1433
healthcheck:
test:
[
"CMD",
"/opt/mssql-tools/bin/sqlcmd",
"-U",
"sa",
"-P",
"thisisn'ttherightpassword",
"-Q",
"select 1",
]
interval: 10s
retries: 10
volumes:
- ./mssql:/var/opt/mssql/data
octopus-server:
image: octopusdeploy/octopusdeploy:latest
privileged: true
environment:
ACCEPT_EULA: "N"
OCTOPUS_SERVER_NODE_NAME: ""
DB_CONNECTION_STRING: ""
ADMIN_USERNAME: ""
ADMIN_PASSWORD: ""
ADMIN_EMAIL: ""
OCTOPUS_SERVER_BASE64_LICENSE: ""
MASTER_KEY: ""
ports:
- 8080:8080
- 10943:10943
depends_on:
- db
volumes:
- ./taskLogs:/taskLogs
- ./artifacts:/artifacts
- ./repository:/repository
13 changes: 13 additions & 0 deletions octopus-local.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=#{Project.Octopus.ServiceDescription}
Requires=docker.service
After=docker.service

[Service]
WorkingDirectory=#{Project.Octopus.InstallLocation}
ExecStart=/usr/bin/docker-compose up
ExecStop=/usr/bin/docker-compose stop
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target
21 changes: 21 additions & 0 deletions octopus.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
server {
listen 443 ssl;

ssl_certificate /etc/ssl/octopus.crt;
ssl_certificate_key /etc/ssl/octopus.key;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 180m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
add_header Strict-Transport-Security "max-age=31536000" always;

server_name octopus.local;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_pass http://127.0.0.1:#{Project.Octopus.Port};
}
}
6 changes: 6 additions & 0 deletions predeploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if id "mssql" >/dev/null 2>&1; then
echo "User mssql exists."
else
echo "Create user mssql."
useradd -M -s /bin/bash -u 10001 -g 0 mssql
fi

0 comments on commit aff237e

Please sign in to comment.