This repository has been archived by the owner on Jan 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Building
Darwin Froese edited this page Oct 25, 2017
·
5 revisions
Hacksite can be built using the supplied scripts that will make everything much easier or manually using the same steps.
- Verify that you have the latest Go version installed and it's accessible from where you cloned Hacksite
- Verify that you have Yarn installed and that it's accessible from where you cloned Hacksite
- Verify that you have the environment variable
GOROOT
set (This is needed to generate the certificates for SSL)
Hacksite uses environment configuration files to configure different information for the server.
{
// These options configure information for the server
"Server": {
// These are the certificate files for HTTPS
"KeyLocation": "certs/key.pem",
"CertLocation": "certs/cert.pem",
// This is the port that the HTTPS server will listen on
// The HTTP to HTTPS redirect always listens on :80
"Port": ":5000",
// This is the relative path to your compiled web client
"WebFileLocation": "./webdist"
},
// These options configure the logger
"Logger": {
"LogFileLocation": "./logs"
},
// These options configure the database
"Database": {
// "bolt" will use boltDB (preferred method for locally running Hacksite)
// which will create a database on disk (database.db)
// "dynamodb" will use Amazons DynamoDB and will
// require the AWS section to be configured
"System": "bolt"
},
// These options configure AWS access settings
"Aws": {
// These are the IAM settings needed for the user that
// will be used to connect to AWS
"AccessKey": "",
"SecretKey": "",
"Token": "",
"Region": ""
}
}
To build Hacksite on Windows you need to do the following
- If you want to use a different environment config than
environments/dev.env.json
specify it as a temporary environment variableSET enviroment_file=path/to/file
- Run
make.bat
--make.bat
will start by grabbing all of the Go and Web dependencies and generate certs prior to running the command specified
The make.bat
file has an optional command that you can pass to perform certain actions:
-
default
- This will build both the web client and the server (this is the default command if you don't pass any in) -
test
- This will run tests on both the web client and the server -
buildServer
- This will build just the server -
buildWeb
- This will build just the web client -
testServer
- This will test just the server -
testClient
- This will test just the client
To build Hacksite on OS X and Linux you just need to use the makefile supplied
- If you want to use a different environment config file than
environments/dev.env.json
, specify it by overriding the value in the makefilemake [command] ENVIRONMENT_FILE=/path/to/envfile
- Run
make
with an optional parameter
-
all
- This will callsetup
server
andweb
(this is the default action if no optional command is specified)-
all
will not generate local certificates, you need to use the commandlocal
orbuildLocal
for that
-
-
local
- This will callsetup
buildLocal
andweb
-
setup
- This will call bothsetup-go
andsetup-web
-
setup-go
- This will get all of the go dependencies -
setup-web
- This will get all of the web dependencies -
buildLocal
- This will generate local certificates and build the server -
server
- This will build the go server -
web
- This will build the web client -
serverTests
- This will build the server and run the server test (This also clears out the local database to make sure there is no conflicting data)
- Get the go dependencies:
- run
go get -t -v -d ./...
- run
- Get the web dependencies: (in the webclient directory)
- run
yarn
- run
- Generate the certificates: (pass in the goroot environment variable for your system)
- run
go run {goroot}/src/crypto/tls/generate_cert.go --host localhost
- run
- Build the server:
- run
go build server/cmd/server.go
- run
- Build the web client:
- run
yarn run build
- run
- Testing the server: (this only tests the pkg folder where all the tests are)
- run
go test -v ./server/pkg/...
- run
- Testing the webclient:
- run
yarn run test
- run