-
Notifications
You must be signed in to change notification settings - Fork 41
1.1 Local setup
This page describes preparing your local environment to run the tools you need for GovCMS, and then setting up a new project.
Since we cater for a variety of developers with different experience, and many are working with limited tools in government, we can't provide perfect documentation for everyone. If you have issues please refer to Getting help.
- Dependencies
- Note for Windows
- Upcoming opportunities
- Instructions to install Pygmy (Windows)
- Instructions to install Pygmy (Mac/Linux/WSL)
- Changing the pygmy-go ports
- Building your project
If your site is using the GovCMS platform, and you want to develop this site locally, you will need these tools.
We are trying to improve the Windows experience. Most commands need to be carried out in Powershell but some may require Git-bash. Use both tools with elevated permissions. DOS prompt is not appropriate for local development.
See also the Amazee docs as well as the Windows-specific tips in this user contributed guide.
There is a trial version of Pygmy written in Go.
This will help to address many of the common issues users have had with Pygmy in the past including:
- Windows support (which may help Windows users who cannot install Ruby gems at present).
- Granular control over ports and services (run Pygmy on HTTPS with no effort; run phpmyadmin/portainer as well)
- Install choco Open PowerShell as Admin Run
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
-
Install make Run
choco install make
-
Clone the pygmy-go repo
Change to directory. e.g. cd C:\programs
Run git clone https://github.com/pygmystack/pygmy.git pygmy-go
Change to directory to pygmy-go. e.g. cd C:\programs\pygmy-go
- Compile pygmy-go to make pygmy.exe
_Note, If you have a SSL scanning program, e.g. zscaler by your organization, ensure the extra ssl cert is added to docker file first to avoid error "unable to get local issuer certificate"!
Instructions for Zscaler (windows)
- Open Windows Start menu
- "mmc.exe"
- File
- add /remove snap-in
- Certificates
- Add
- Either My account or Computer account, doesn't matter (won't appear if not run as admin - so can be skipped)
- OK
- [In left side bar]
- Trusted Root Certification Authorities
- Certificates
- Find Zscaler Root Certificate
- Right click
- Tasks
- Export (Format CER - base64) to [pygmy folder]/zscaler.cer
Then Add the following lines to the [pygmy folder]/Dockerfile
after COPY service/ /go/src/github.com/pygmystack/pygmy/service/
COPY zscaler.cer /tmp/
RUN apk update
RUN apk add curl openssl
RUN openssl x509 -inform PEM -in /tmp/zscaler.cer -out /usr/local/share/ca-certificates/zscaler.crt
RUN update-ca-certificates
Run make build;
- Add pygmy.exe to PATH
Run systempropertiesadvanced.exe
=> Advanced tab => Environment Variables > Click edit on PATH for System variables
Add builds to that PATH property e.g. C:\programs\pygmy-go\builds
- Open to new command prompt (cmd.exe)
This will have the new PATH, then run pygmy up
as usual.
- Clone the pygmy-go repo
Change to directory. e.g. cd /Users/[username]/programs
(replace [username] with your username)
Run git clone https://github.com/pygmystack/pygmy.git pygmy-go
Change to directory to pygmy-go. e.g.
-
cd /Users/[username]/programs/pygmy-go
(Mac) -
cd /home/[username]/programs/pygmy-go
(Linux/WSL)
- Compile pygmy-go to make pygmy executable
_Note, If you have a SSL scanning program, e.g. zscaler by your organization, ensure the extra ssl cert is added to docker file first to avoid error "unable to get local issuer certificate"!
Instructions for Zscaler (mac)
MAC - export certificate:- Open a web browser such as chrome
- Browse a HTTPS sites such as https://www.google.com.au/
- Click on the padlock on the left of the address bar.
- Click "This site is secure".
- Click "Certificate is valid".
- Click "Details"
- Select the root Zscaler certificate (top most) [ zscaler is not preent, you skip this entire zscaler step]
- Click export -> format DER (.cer file extension), e.g. filename
zscaler.cer
- Then Add the following lines to the
[pygmy folder]/Dockerfile
afterCOPY service/ /go/src/github.com/pygmystack/pygmy/service/
COPY zscaler.cer /tmp/
RUN apk update
RUN apk add curl openssl
RUN openssl x509 -inform PEM -in /tmp/zscaler.cer -out /usr/local/share/ca-certificates/zscaler.crt
RUN update-ca-certificates
-
Run
make build
-
Add pygmy to PATH and make executable.
Change directory to the builds folder: e.g.
-
cd /Users/[username]/programs/pygmy-go/builds
(Mac) -
cd /home/[username]/programs/pygmy-go/builds
(Linux/WSL)
- Copy the correct executable file to the user binaries folder.
e.g. cp ./builds/[pygmy-file] /usr/local/bin/pygmy
Where [pygmy file] is:
-
pygmy-linux-arm64-static
(Intel Mac) -
pygmy-linux-arm-static
(M1 (arm) Mac) -
pygmy-linux-amd64-static
(Linux / WSL - most Linux OSs are 64bit)
So for example, for an M1 Mac, run cp ./builds/pygmy-linux-arm64-static /usr/local/bin/pygmy
- Mark file permission as executable.
sudo chmod +x /usr/local/bin/pygmy
Done, run pygmy up
as usual.
-
To change the pygmy-go's haproxy port (website port), add a file
.pygmy.yml
to your user folder. e.g.C:\users\myusername\.pygmy.yml
-
And Put the contents (adjust 7088 / 7089 to the port you want)
services:
amazeeio-haproxy:
HostConfig:
PortBindings:
80/tcp:
- HostPort: 7088
443/tcp:
- HostPort: 7089
- Then clean up pygmy-go's containers and start them again. (ignore the error: Error response from daemon: error while removing network: network amazeeio-network id deadXXXX has active endpoints)
pygmy clean
pygmy up
You should see the message: Using config file: C:\Users\myusername\.pygmy.yml
when pygmy up
is run.
You can also see the current configuration by running pygmy export --output /path/to/output-config-file.yml
These instructions will help you set up your project locally. It assumes that you have been provisioned with a GovCMS project in Gitlab. If you have not been provisioned with a project, you can test this process by installing the scaffold for PaaS or SaaS (depending on the flavour of hosting you may choose for your future project), and skipping to step 3.
-
Validate that you have the tools you need. Refer to these commands for help.
-
Clone your project's Gitlab repository. The clone URL can be found at https://projects.govcms.gov.au/ORGNAME/PROJECTNAME
Your should ensure that the location of your clone is included in Docker's file sharing.
git clone [email protected]:ORGNAME/PROJECTNAME.git
cd PROJECTNAME
- Build and start the docker containers:
# This is identical to `ahoy up`.
docker-compose up -d
- Build the codebase with Composer:
# This is identical to `ahoy composer install`.
docker-compose exec -T test composer install
- Install a vanilla GovCMS site:
# This is identical to `ahoy install`.
docker-compose exec -T test drush si -y govcms
- You should have a running site now, which you can visit at http://PROJECTNAME.docker.amazee.io. To login to Drupal as user 1 you can run:
# This is identical to `ahoy login`.
docker-compose exec -T test drush uli