90 lines
1.6 KiB
Markdown
90 lines
1.6 KiB
Markdown
## bash alias
|
|
|
|
You can configure an bash alias in your `~/.bashrc` like this:
|
|
|
|
```
|
|
## genpasswd alias
|
|
alias genpasswd='echo $(curl -s https://passwd.scu.si/api/password)'
|
|
```
|
|
|
|
After making above changes you have to reload your ~/bashrc, in order to activate your changes.
|
|
```
|
|
. ~/.bashrc
|
|
```
|
|
|
|
Now you can enter `genpasswd` and get a fresh password from the API Endpoint.
|
|
|
|
## get 10 fresh passwords
|
|
|
|
```bash
|
|
for i in {1..10}; do echo $(curl -s https://passwd.scu.si/api/password); done
|
|
```
|
|
|
|
# building the app
|
|
|
|
you can build the app yourself like this:
|
|
|
|
```
|
|
go build -o password-generator ./
|
|
```
|
|
|
|
NOTE: If you build the app manually in go, like shown in this example, it will probably not run, since it misses a writeable `/data` directory.
|
|
|
|
|
|
# build a docker container
|
|
|
|
```
|
|
docker build -t web-password:dev .
|
|
|
|
```
|
|
|
|
# start the docker container
|
|
|
|
```
|
|
docker run -p 8080:8080 -v app_data:/data web-password:dev
|
|
```
|
|
|
|
## docker-compose
|
|
|
|
There are two example docker-compose files in the [misc](./) directory.
|
|
|
|
### docker-compose.yml
|
|
|
|
A basic variant that just brings up the container and export port 8080.
|
|
The basic variant can be used without modifications.
|
|
|
|
### docker-compose.traefik.yml
|
|
|
|
The other one is meant to be used behind a traefik reverse proxy.
|
|
This variant has lables to configure traefik accordingly.
|
|
The traefik variant needs to be adjusted to your environment before
|
|
you can use it successfully.
|
|
|
|
### initial pull
|
|
|
|
```
|
|
docker compose pull
|
|
```
|
|
|
|
### start up
|
|
|
|
```
|
|
docker compose up -d
|
|
```
|
|
|
|
### bring down
|
|
|
|
```
|
|
docker compose down
|
|
```
|
|
|
|
### update container
|
|
|
|
In order to update your container to the current version, do this:
|
|
```
|
|
docker compose pull
|
|
docker compose up -d
|
|
```
|
|
|
|
|