Skip to content

Commit 996ab29

Browse files
committed
New installation script for windows to fix various issues and new Vagrant files for testing
1 parent db3ee67 commit 996ab29

29 files changed

Lines changed: 505 additions & 396 deletions

File tree

README.md

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,65 +21,51 @@ Environment variables:
2121
##### Examples
2222

2323
Download and install FusionAuth without Elasticsearch
24+
2425
```bash
2526
sh -c "curl -fsSL https://raw.githubusercontent.com/FusionAuth/fusionauth-install/master/install.sh | sh"
2627
```
2728

2829
Download and install with Elasticsearch
30+
2931
```bash
3032
sh -c "curl -fsSL https://raw.githubusercontent.com/FusionAuth/fusionauth-install/master/install.sh | sh -s - -s"
3133
```
3234

3335
#### Windows
3436

3537
Download and install FusionAuth without Elasticsearch
38+
3639
```powershell
37-
. { iwr -useb https://raw.githubusercontent.com/FusionAuth/fusionauth-install/master/install.ps1 } | iex; install
38-
REM Optionally register the service with the following commands
39-
cd fusionauth\fusionauth-app\bin
40-
FusionAuthApp.exe /install
40+
Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/FusionAuth/fusionauth-install/main/install.ps1 | iex
4141
```
4242

4343
Download and install FusionAuth with Elasticsearch
44+
4445
```powershell
45-
. { iwr -useb https://raw.githubusercontent.com/FusionAuth/fusionauth-install/master/install.ps1 } | iex; install -includeSearch 1
46-
REM Optionally register the service with the following commands
47-
cd fusionauth\fusionauth-app\bin
48-
FusionAuthApp.exe /install
46+
Invoke-WebRequest -UseBasicParsing -Uri https://raw.githubusercontent.com/FusionAuth/fusionauth-install/main/install.ps1 -OutFile install.ps1
47+
.\install.ps1 -IncludeSearch 1
4948
```
5049

51-
If you run into an error, you may need to change your execution policy. `Set-ExecutionPolicy Bypass -scope CurrentUser`
52-
53-
### Docker
54-
55-
https://hub.docker.com/u/fusionauth/
56-
57-
https://github.com/FusionAuth/fusionauth-containers
50+
After you have downloaded and install FusionAuth using the commands above, you can start it like this:
5851

59-
#### Docker Compose
60-
The reference [docker-compose.yml](https://raw.githubusercontent.com/FusionAuth/fusionauth-containers/master/docker/fusionauth/docker-compose.yml) defaults to use the database as the User search engine.
61-
62-
In order to install with Elasticsearch as the User search engine, include the reference [docker-compose.override.yml](https://raw.githubusercontent.com/FusionAuth/fusionauth-containers/master/docker/fusionauth/docker-compose.override.yml).
52+
```powershell
53+
cd fusionauth\bin
54+
.\startup.ps1
55+
```
6356

64-
Review our [Docker Install Guide](https://fusionauth.io/docs/v1/tech/installation-guide/docker) for additional assistance.
57+
Or you can install the Windows Service like this:
6558

66-
```bash
67-
curl -o docker-compose.yml https://raw.githubusercontent.com/FusionAuth/fusionauth-containers/master/docker/fusionauth/docker-compose.yml
68-
# Uncomment the following line to install and configure Elasticsearch as the User search engine
69-
# curl -o docker-compose.override.yml https://raw.githubusercontent.com/FusionAuth/fusionauth-containers/master/docker/fusionauth/docker-compose.override.yml
70-
curl -o .env https://raw.githubusercontent.com/FusionAuth/fusionauth-containers/master/docker/fusionauth/.env
71-
docker-compose up
59+
```powershell
60+
cd fusionauth\fusionauth-app\bin
61+
FusionAuthApp.exe /install
7262
```
7363

74-
#### Docker Images
75-
76-
FusionAuth App ([On Docker Hub](https://hub.docker.com/r/fusionauth/fusionauth-app/))
64+
### Other options
7765

78-
```
79-
docker pull fusionauth/fusionauth-app
80-
```
66+
We have a bunch of other ways to download and install FusionAuth. Those options are located here:
8167

82-
When running FusionAuth in Docker with Elasticsearch as the User search engine, it is recommended to either connect to an external Elasticsearch service, or use the Docker images provided by Elasticsearch. See the reference `docker-compose.yml` and `docker-compose.override.yml` in the [fusionauth-containers repository](https://github.com/FusionAuth/fusionauth-containers/tree/master/docker/fusionauth) for an example in configuring Elasticsearch with FusionAuth.
68+
https://fusionauth.io/download
8369

8470
### Documentation
8571

install.ps1

Lines changed: 66 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,76 @@
1-
new-module -name FusionAuth -scriptblock {
2-
function Install-FusionAuth()
3-
{
4-
param (# This must come first
5-
[bool]$includeSearch = 0
6-
)
1+
param (# This must come first
2+
[bool]$IncludeSearch = 0
3+
)
74

8-
# Get current setting
9-
$old_erroractionpreference = $erroractionpreference
10-
$erroractionpreference = 'stop' # quit if anything goes wrong
5+
function DownloadAndExpandZip($uri, $tempFile, $destination)
6+
{
7+
Write-Output "Downloading archive, destination $destination"
8+
Invoke-WebRequest -Uri $uri -OutFile $tempFile
119

12-
# Try importing BitsTransfer
13-
if (!(Get-module BitsTransfer))
14-
{
15-
Import-Module BitsTransfer -ErrorAction SilentlyContinue
16-
}
17-
18-
if (($PSVersionTable.PSVersion.Major) -lt 5)
19-
{
20-
Write-Output "PowerShell 5 or greater is required to run this installer."
21-
Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
22-
break
23-
}
24-
25-
function DownloadAndExpandZip($uri, $tempFile, $destination)
26-
{
27-
Write-Output "Downloading archive, destination ${destination}"
28-
29-
if (Get-module BitsTransfer)
30-
{
31-
Start-BitsTransfer -Source $uri -Destination $tempFile
32-
}
33-
else
34-
{
35-
(New-Object System.Net.WebClient).DownloadFile($uri, $tempFile)
36-
}
37-
38-
Write-Output "Expanding archive"
39-
40-
if (Test-Path "$env:Temp/fusionauth")
41-
{
42-
Remove-Item -Force -Recurse "$env:Temp/fusionauth"
43-
}
44-
45-
New-Item "$env:Temp/fusionauth" -ItemType Directory
46-
47-
Expand-Archive -Path $tempFile -DestinationPath "$env:Temp/fusionauth"
48-
49-
New-Item $destination -ItemType Directory -ea 0
50-
51-
robocopy "$env:Temp/fusionauth" $destination /E /XC /XN /XO /NFL /NDL /NJH /NS /NC
52-
}
53-
54-
$BASE_URL = "https://files.fusionauth.io/products/fusionauth"
55-
$VERSION = Invoke-WebRequest -UseBasicParsing -Uri https://metrics.fusionauth.io/api/latest-version
56-
# Trim the trailing \ since we add it when we set the destination directory, and it may come back on the FullName property
57-
# > C:\> (Get-Item -Path ".\").FullName => C:\
58-
# > C:\foo> (Get-Item -Path ".\").FullName => C:\foo
59-
$CURRENT_DIRECTORY = (Get-Item -Path ".\").FullName.TrimEnd("\")
60-
61-
Write-Output "Install FusionAuth version ${VERSION}"
10+
Write-Output "Expanding archive"
11+
Expand-Archive -Force -Path $tempFile -DestinationPath "$destination"
12+
}
6213

63-
if (Test-Path "$CURRENT_DIRECTORY\fusionauth\fusionauth-app")
64-
{
65-
Remove-Item -Force -Recurse "$CURRENT_DIRECTORY\fusionauth\fusionauth-app"
66-
}
67-
if (Test-Path "$CURRENT_DIRECTORY\fusionauth\fusionauth-search")
68-
{
69-
Remove-Item -Force -Recurse "$CURRENT_DIRECTORY\fusionauth\fusionauth-search"
70-
}
71-
if (Test-Path "$CURRENT_DIRECTORY\fusionauth\bin")
72-
{
73-
Remove-Item -Force -Recurse "$CURRENT_DIRECTORY\fusionauth\bin"
74-
}
14+
# Get current setting
15+
$old_erroractionpreference = $erroractionpreference
16+
$erroractionpreference = 'stop' # quit if anything goes wrong
7517

76-
echo "Installing zip packages"
18+
if (($PSVersionTable.PSVersion.Major) -lt 5)
19+
{
20+
Write-Output "PowerShell 5 or greater is required to run this installer."
21+
Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
22+
break
23+
}
7724

78-
# Install search first so that we get the search version of fusionauth.properties (which enables search)
79-
if ($includeSearch)
80-
{
81-
DownloadAndExpandZip "${BASE_URL}/${VERSION}/fusionauth-search-${VERSION}.zip" "$env:Temp\fusionauth-search.zip" "$CURRENT_DIRECTORY\fusionauth"
82-
}
83-
DownloadAndExpandZip "${BASE_URL}/${VERSION}/fusionauth-app-${VERSION}.zip" "$env:Temp\fusionauth-app.zip" "$CURRENT_DIRECTORY\fusionauth"
25+
$BaseURL = "https://files.fusionauth.io/products/fusionauth"
26+
$Version = Invoke-WebRequest -UseBasicParsing -Uri https://metrics.fusionauth.io/api/latest-version
27+
# Trim the trailing \ since we add it when we set the destination directory, and it may come back on the FullName property
28+
# > C:\> (Get-Item -Path ".\").FullName => C:\
29+
# > C:\foo> (Get-Item -Path ".\").FullName => C:\foo
30+
$CurrentDirectory = (Get-Item -Path ".\").FullName.TrimEnd("\")
31+
32+
# Handle POSIX compliant operating systems that use the variable TMPDIR instead (i.e. macOS, Linux, Unix)
33+
$TempDir = $env:Temp
34+
if (!$TempDir)
35+
{
36+
$TempDir = $env:TMPDIR
37+
}
8438

85-
Write-Output ""
86-
Write-Output "Install is complete. Time for tacos."
87-
Write-Output ""
88-
Write-Output " 1. To start FusionAuth run the following command"
89-
Write-Output " .\fusionauth\bin\startup.ps1"
90-
Write-Output ""
91-
Write-Output " 2. To begin, access FusionAuth by opening a browser to http://localhost:9011"
92-
Write-Output ""
93-
Write-Output " 3. If you're looking for documentation, open your browser and navigate to https://fusionauth.io/docs"
94-
Write-Output ""
95-
Write-Output "Thank you have a nice day."
39+
Write-Output "Install FusionAuth version ${Version}"
9640

97-
# Restore old setting
98-
$erroractionpreference = $old_erroractionpreference # Reset $erroractionpreference to original value
99-
}
41+
if (Test-Path "$CurrentDirectory\fusionauth\fusionauth-app")
42+
{
43+
Remove-Item -Force -Recurse "$CurrentDirectory\fusionauth\fusionauth-app"
44+
}
45+
if (Test-Path "$CurrentDirectory\fusionauth\fusionauth-search")
46+
{
47+
Remove-Item -Force -Recurse "$CurrentDirectory\fusionauth\fusionauth-search"
48+
}
49+
if (Test-Path "$CurrentDirectory\fusionauth\bin")
50+
{
51+
Remove-Item -Force -Recurse "$CurrentDirectory\fusionauth\bin"
52+
}
10053

101-
set-alias install -value Install-FusionAuth
54+
Write-Output "Installing zip packages"
10255

103-
export-modulemember -function Install-FusionAuth -alias install
56+
# Install search first so that we get the search version of fusionauth.properties (which enables search)
57+
if ($IncludeSearch)
58+
{
59+
DownloadAndExpandZip "$BaseURL/$Version/fusionauth-search-$Version.zip" "$TempDir\fusionauth-search.zip" "$CurrentDirectory\fusionauth"
10460
}
61+
DownloadAndExpandZip "$BaseURL/$Version/fusionauth-app-$Version.zip" "$TempDir\fusionauth-app.zip" "$CurrentDirectory\fusionauth"
62+
63+
Write-Output ""
64+
Write-Output "Install is complete. Time for tacos."
65+
Write-Output ""
66+
Write-Output " 1. To start FusionAuth run the following command"
67+
Write-Output " .\fusionauth\bin\startup.ps1"
68+
Write-Output ""
69+
Write-Output " 2. To begin, access FusionAuth by opening a browser to http://localhost:9011"
70+
Write-Output ""
71+
Write-Output " 3. If you're looking for documentation, open your browser and navigate to https://fusionauth.io/docs"
72+
Write-Output ""
73+
Write-Output "Thank you have a nice day."
74+
75+
# Restore old setting
76+
$erroractionpreference = $old_erroractionpreference # Reset $erroractionpreference to original value

test/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Vagrant testing
2+
3+
This folder contains Vagrant files that allow the install scripts to be easily tested across operating systems. It uses Vagrant and UTM.
4+
5+
You'll need to follow these instructions to get everything installed and configured:
6+
7+
https://naveenrajm7.github.io/vagrant_utm/
8+
9+
## Configure FusionAuth
10+
11+
The simplest way to configure FusionAuth in these virtual machines is to point them at your laptop. UTM uses `10.0.2.2` to reference the host machine from the guest machine. Therefore, you can use `10.0.2.2` on port `5432` to access the host machine's PostgreSQL server.
12+
13+
## Using dev packages locally
14+
15+
There are a few directories that allow you to use locally built RPMs and DEBs. In order to make these tests work, you need to run the `copy-packages.sh` script in order to copy over the RPM/DEB bundles from the `fusionauth-app` and `fusionauth-search` projects locally.
16+
17+
Here's the sequence of things that need to be done:
18+
19+
1. Bundle both `fusionauth-app` and `fusionauth-search` by running the command `sb clean bundle` from the project directories. This requires that you install RPM locally as well and that can be done by running `brew install rpm`.
20+
2. Run the `copy-packages.sh` script and specify the version of the local bundle you just created like this: `./copy-packages.sh 1.57.1`
21+
3. Run Vagrant by running `vagrant up`
22+
23+
This should ensure that the latest local bundles are available to the Vagrant VM.

test/centos/Vagrantfile

Lines changed: 0 additions & 87 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.rpm

0 commit comments

Comments
 (0)